changeset 54435:776b261dff84

8221918: runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java fails: Shared archive not found Reviewed-by: jiangli, dholmes
author shade
date Fri, 05 Apr 2019 09:06:19 +0200
parents dad2c80ae0b2
children d5fb27646df4
files test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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",