test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java
changeset 54927 1512d88b24c6
parent 53636 962ed57b29c9
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Fri May 17 10:48:02 2019 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Fri May 17 08:29:55 2019 -0700
@@ -26,8 +26,10 @@
  * @test
  * @requires vm.cds
  * @modules java.base/jdk.internal.misc
+ *          jdk.jartool/sun.tools.jar
  * @library ../..
  * @library /test/lib
+ * @compile ../../test-classes/Hello.java
  * @run driver OverrideTests
  * @summary AppCDS tests for overriding archived classes with -p and --upgrade-module-path
  */
@@ -65,7 +67,7 @@
     private static final String TEST_SRC = System.getProperty("test.src");
     private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
     private static final Path MODS_DIR = Paths.get("mods");
-
+    private static String appJar;
     // the module that is upgraded
     private static final String[] UPGRADED_MODULES = {"jdk.compiler", "java.net.http"};
     private static final Path[] UPGRADEDMODS_DIR = {Paths.get("upgradedmod1"), Paths.get("upgradedmod2")};
@@ -82,6 +84,7 @@
 
 
     public static void main(String[] args) throws Exception {
+        appJar = JarBuilder.getOrCreateHelloJar();
         OverrideTests tests = new OverrideTests();
         tests.compileModulesAndDumpArchive();
         tests.testAppClassOverriding();
@@ -111,7 +114,7 @@
         Asserts.assertTrue(compiled, TEST_MODULE + " did not compile");
 
         // dump the archive with jdk.compiler and java.net.http classes in the class list
-        OutputAnalyzer output  = TestCommon.dump(null /* appJar*/, TestCommon.list(ARCHIVE_CLASSES));
+        OutputAnalyzer output  = TestCommon.dump(appJar, TestCommon.list(ARCHIVE_CLASSES));
         TestCommon.checkDump(output);
         // Make sure all the classes where successfully archived.
         for (String archiveClass : ARCHIVE_CLASSES) {
@@ -160,7 +163,7 @@
         int upgradeModIdx = isAppLoader ? 0 : 1;
         String expectedException = "java.lang.module.FindException: Unable to compute the hash";
         String prefix[] = new String[3];
-        prefix[0] = "-Djava.class.path=";
+        prefix[0] = "-Djava.class.path=" + appJar;
         prefix[1] = "--add-modules";
         prefix[2] = "java.net.http";