8221918: runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java fails: Shared archive not found
Reviewed-by: jiangli, dholmes
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java Tue Apr 02 13:54:00 2019 +0200
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java Fri Apr 05 09:06:19 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,15 @@
public void process(String args[]) throws Throwable {
if (args.length == 0) {
+ // Dump the shared archive in case it was not generated during the JDK build.
+ // Put the archive at separate file to avoid clashes with concurrent tests.
+ CDSOptions opts = new CDSOptions()
+ .setXShareMode("dump")
+ .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
+ .setUseVersion(false)
+ .addSuffix("-showversion");
+ CDSTestUtils.run(opts).assertNormalExit("");
+
launchChildProcesses(getTests());
} else if (args.length == 3 && args[0].equals("child")) {
Class klass = Class.forName(args[2].replace("/", "."));
@@ -152,7 +161,7 @@
CDSOptions opts = (new CDSOptions())
.setXShareMode("auto")
- .setUseSystemArchive(true)
+ .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
.setUseVersion(false)
.addSuffix("-showversion",
"-Xlog:cds",