--- old/test/tools/launcher/modules/patch/basic/PatchTest.java 2016-10-26 11:30:46.000000000 -0700 +++ new/test/tools/launcher/modules/patch/basic/PatchTest.java 2016-10-26 11:30:46.000000000 -0700 @@ -25,7 +25,8 @@ * @test * @library /lib/testlibrary * @modules jdk.compiler - * @build PatchTest CompilerUtils JarUtils jdk.testlibrary.* + * java.naming + * @build PatchTest CompilerUtils JarUtils jdk.testlibrary.tasks.JavaTask * @run testng PatchTest * @summary Basic test for --patch-module */ @@ -37,7 +38,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static jdk.testlibrary.ProcessTools.*; +import jdk.testlibrary.tasks.JavaTask; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -130,35 +131,30 @@ /** * Run test with patches to java.base, jdk.naming.dns and jdk.compiler */ - void runTest(String basePatches, String dnsPatches, String compilerPatches) - throws Exception - { + void runTest(String basePatches, String dnsPatches, String compilerPatches) { // the argument to the test is the list of classes overridden or added String arg = Stream.of(CLASSES).collect(Collectors.joining(",")); - int exitValue - = executeTestJava("--patch-module", "java.base=" + basePatches, - "--patch-module", "jdk.naming.dns=" + dnsPatches, - "--patch-module", "jdk.compiler=" + compilerPatches, - "--add-exports", "java.base/java.lang2=test", - "--add-exports", "jdk.naming.dns/com.sun.jndi.dns=test", - "--add-exports", "jdk.naming.dns/com.sun.jndi.dns2=test", - "--add-exports", "jdk.compiler/com.sun.tools.javac2=test", - "--add-modules", "jdk.naming.dns,jdk.compiler", - "--module-path", MODS_DIR.toString(), - "-m", "test/jdk.test.Main", arg) - .outputTo(System.out) - .errorTo(System.out) - .getExitValue(); - - assertTrue(exitValue == 0); + new JavaTask() + .patchModule("java.base", basePatches) + .patchModule("jdk.naming.dns", dnsPatches) + .patchModule("jdk.compiler", compilerPatches) + .addExports("java.base", "java.lang2", "test") + .addExports("jdk.naming.dns", "com.sun.jndi.dns", "test") + .addExports("jdk.naming.dns", "com.sun.jndi.dns2", "test") + .addExports("jdk.compiler", "com.sun.tools.javac2", "test") + .addModules("jdk.naming.dns,jdk.compiler") + .modulePath(MODS_DIR) + .module("test", "jdk.test.Main") + .classArgs(arg) + .run(); } /** * Run test with ---patch-module and exploded patches */ - public void testWithExplodedPatches() throws Exception { + public void testWithExplodedPatches() { // patches1/java.base:patches2/java.base String basePatches = PATCHES1_DIR.resolve("java.base") @@ -177,7 +173,7 @@ /** * Run test with ---patch-module and patches in JAR files */ - public void testWithJarPatches() throws Exception { + public void testWithJarPatches() { // patches/java.base-1.jar:patches/java-base-2.jar String basePatches = PATCHES_DIR.resolve("java.base-1.jar") @@ -197,7 +193,7 @@ /** * Run test with ---patch-module and patches in JAR files and exploded patches */ - public void testWithJarAndExplodedPatches() throws Exception { + public void testWithJarAndExplodedPatches() { // patches/java.base-1.jar:patches2/java.base String basePatches = PATCHES_DIR.resolve("java.base-1.jar")