8218029: [TESTBUG] Use -Djava.class.path= to specify empty -cp in CDS tests
authoriklam
Mon, 04 Feb 2019 19:42:36 -0800
changeset 53636 962ed57b29c9
parent 53635 247e5ca412f5
child 53637 4366a1e4a021
8218029: [TESTBUG] Use -Djava.class.path= to specify empty -cp in CDS tests Reviewed-by: ccheung, dholmes
test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java
test/hotspot/jtreg/runtime/appcds/TestCommon.java
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java
test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Mon Feb 04 19:42:36 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -44,14 +44,14 @@
             CDSTestUtils.makeClassList(classes).getPath();
         String archiveName = "NonBootLoaderClasses.jsa";
         CDSOptions opts = (new CDSOptions())
-            .addPrefix("-XX:ExtraSharedClassListFile=" + classList, "-cp", "\"\"")
+            .addPrefix("-XX:ExtraSharedClassListFile=" + classList, "-Djava.class.path=")
             .setArchiveName(archiveName);
         CDSTestUtils.createArchiveAndCheck(opts);
 
         // Print the shared dictionary and inspect the output
         opts = (new CDSOptions())
             .setUseVersion(false)
-            .addSuffix( "-cp", "\"\"",
+            .addSuffix("-Djava.class.path=",
                 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
                 "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
         CDSTestUtils.run(opts)
--- a/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/TestCommon.java	Mon Feb 04 19:42:36 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -123,8 +123,7 @@
             cmd.add("-cp");
             cmd.add(opts.appJar);
         } else {
-            cmd.add("-cp");
-            cmd.add("\"\"");
+            cmd.add("-Djava.class.path=");
         }
 
         cmd.add("-Xshare:dump");
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java	Mon Feb 04 19:42:36 2019 -0800
@@ -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
@@ -107,7 +107,7 @@
                                         "--add-modules",
                                         MAIN_MODULE1 + "," + MAIN_MODULE2);
         TestCommon.checkDump(output);
-        String prefix[] = {"-cp", "\"\"", "-Xlog:class+load=trace"};
+        String prefix[] = {"-Djava.class.path=", "-Xlog:class+load=trace"};
 
         // run the com.greetings module with the archive with the --module-path
         // the same as the one during dump time.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java	Mon Feb 04 19:42:36 2019 -0800
@@ -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
@@ -98,7 +98,7 @@
                                         "--add-reads", "com.norequires=org.astro",
                                         "-m", MAIN_MODULE);
         TestCommon.checkDump(output);
-        String prefix[] = {"-cp", "\"\"", "-Xlog:class+load=trace",
+        String prefix[] = {"-Djava.class.path=", "-Xlog:class+load=trace",
                            "--add-modules", SUB_MODULE,
                            "--add-reads", "com.norequires=org.astro"};
 
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java	Mon Feb 04 19:42:36 2019 -0800
@@ -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
@@ -103,7 +103,7 @@
                                         "--module-path", moduleDir.toString(),
                                         "-m", MAIN_MODULE);
         TestCommon.checkDump(output);
-        String prefix[] = {"-cp", "\"\"", "-Xlog:class+load=trace"};
+        String prefix[] = {"-Djava.class.path=", "-Xlog:class+load=trace"};
 
         // run with the archive with the --module-path the same as the one during
         // dump time. The classes should be loaded from the archive.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Tue Feb 05 00:43:38 2019 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Mon Feb 04 19:42:36 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -159,11 +159,10 @@
         boolean isAppLoader = loaderName.equals("app");
         int upgradeModIdx = isAppLoader ? 0 : 1;
         String expectedException = "java.lang.module.FindException: Unable to compute the hash";
-        String prefix[] = new String[4];
-        prefix[0] = "-cp";
-        prefix[1] = "\"\"";
-        prefix[2] = "--add-modules";
-        prefix[3] = "java.net.http";
+        String prefix[] = new String[3];
+        prefix[0] = "-Djava.class.path=";
+        prefix[1] = "--add-modules";
+        prefix[2] = "java.net.http";
 
         // Run the test with --upgrade-module-path set to alternate location of archiveClass
         // The alternate version of archiveClass SHOULD be found.