--- old/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java 2018-04-06 15:40:46.125425651 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java 2018-04-06 15:40:45.841398866 -0700 @@ -103,28 +103,30 @@ null, appClasses, "--module-path", moduleDir.toString(), "-m", MAIN_MODULE); - TestCommon.checkExecReturn(output, 0, true, "Loading classes to share"); + TestCommon.checkDump(output); String prefix[] = {"-cp", "\"\"", "-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. - output = TestCommon.execModule(prefix, - null, // --upgrade-module-path - moduleDir.toString(), // --module-path - MAIN_MODULE); // -m - TestCommon.checkExecReturn(output, 0, true, - "[class,load] com.greetings.Main source: shared objects file", - "[class,load] org.astro.World source: shared objects file"); + TestCommon.runWithModules(prefix, + null, // --upgrade-module-path + moduleDir.toString(), // --module-path + MAIN_MODULE) // -m + .assertNormalExit(out -> { + out.shouldContain("[class,load] com.greetings.Main source: shared objects file") + .shouldContain("[class,load] org.astro.World source: shared objects file"); + }); // run with the archive with the --module-path different from the one during // dump time. The classes should be loaded from the jar files. - output = TestCommon.execModule(prefix, - null, // --upgrade-module-path - moduleDir2.toString(), // --module-path - MAIN_MODULE); // -m - output.shouldHaveExitValue(0) - .shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar") - .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + TestCommon.runWithModules(prefix, + null, // --upgrade-module-path + moduleDir2.toString(), // --module-path + MAIN_MODULE) // -m + .assertNormalExit(out -> { + out.shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar") + .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + }); // create an archive with modular jar files in both -cp and --module-path String jars = subJar.toString() + System.getProperty("path.separator") + @@ -133,27 +135,29 @@ "-Xlog:class+load=trace", "-XX:+PrintSystemDictionaryAtExit", "--module-path", moduleDir.toString(), "-m", MAIN_MODULE); - TestCommon.checkExecReturn(output, 0, true, "Loading classes to share"); + TestCommon.checkDump(output); // run with archive with the main class name specified before // the module name with the -m option. Since the -m option was specified // during dump time, the classes in the jar files after the -cp won't be // archived. Therefore, the classes won't be loaded from the archive but // will be loaded from the jar files. - output = TestCommon.execCommon( "-Xlog:class+load=trace", - "-cp", jars, - "--module-path", moduleDir.toString(), - MAIN_CLASS, "-m", MAIN_MODULE); - output.shouldHaveExitValue(0) - .shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar") - .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + TestCommon.run("-Xlog:class+load=trace", + "-cp", jars, + "--module-path", moduleDir.toString(), + MAIN_CLASS, "-m", MAIN_MODULE) + .assertNormalExit(out -> { + out.shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar") + .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + }); + // similar to the above case but without the main class name. The classes // should be loaded from the archive. - output = TestCommon.execCommon( "-Xlog:class+load=trace", - "-cp", jars, - "--module-path", moduleDir.toString(), - "-m", MAIN_MODULE); - TestCommon.checkExecReturn(output, 0, true, + TestCommon.run("-Xlog:class+load=trace", + "-cp", jars, + "--module-path", moduleDir.toString(), + "-m", MAIN_MODULE) + .assertNormalExit( "[class,load] com.greetings.Main source: shared objects file", "[class,load] org.astro.World source: shared objects file"); @@ -162,7 +166,7 @@ null, appClasses, "--module-path", jars, "-m", MAIN_MODULE); - TestCommon.checkExecReturn(output, 0, true, "Loading classes to share"); + TestCommon.checkDump(output); // run with the above archive but with the modular jar containing the // org.astro module in a different location. @@ -170,12 +174,13 @@ // The Main class should still be loaded from the archive. jars = destJar.toString() + System.getProperty("path.separator") + mainJar.toString(); - output = TestCommon.execModule(prefix, - null, // --upgrade-module-path - jars, // --module-path - MAIN_MODULE); // -m - output.shouldHaveExitValue(0) - .shouldContain("[class,load] com.greetings.Main source: shared objects file") - .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + TestCommon.runWithModules(prefix, + null, // --upgrade-module-path + jars, // --module-path + MAIN_MODULE) // -m + .assertNormalExit(out -> { + out.shouldContain("[class,load] com.greetings.Main source: shared objects file") + .shouldMatch(".class.load. org.astro.World source:.*org.astro.jar"); + }); } }