88 "jdk.naming.dns/com.sun.jndi.dns.DnsClient",
89 "jdk.naming.dns/com.sun.jndi.dns.DnsClientBuddy",
90 "jdk.naming.dns/com.sun.jndi.dns2.Zone",
91
92 // jdk.compiler = application class loaded
93 "jdk.compiler/com.sun.tools.javac.Main",
94 "jdk.compiler/com.sun.tools.javac.MainBuddy",
95 "jdk.compiler/com.sun.tools.javac2.Main",
96
97 };
98
99
100 @BeforeTest
101 public void setup() throws Exception {
102
103 // javac -d mods/test src/test/**
104 boolean compiled= CompilerUtils.compile(SRC_DIR.resolve("test"),
105 MODS_DIR.resolve("test"));
106 assertTrue(compiled, "classes did not compile");
107
108 // javac -Xmodule:$MODULE -d patches1/$MODULE patches1/$MODULE/**
109 // jar cf patches/$MODULE-1.jar -C patches1/$MODULE .
110 for (Path src : Files.newDirectoryStream(SRC1_DIR)) {
111 Path output = PATCHES1_DIR.resolve(src.getFileName());
112 String mn = src.getFileName().toString();
113 compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
114 assertTrue(compiled, "classes did not compile");
115 JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-1.jar"), output);
116 }
117
118 // javac -Xmodule:$MODULE -d patches2/$MODULE patches2/$MODULE/**
119 // jar cf patches/$MODULE-2.jar -C patches2/$MODULE .
120 for (Path src : Files.newDirectoryStream(SRC2_DIR)) {
121 Path output = PATCHES2_DIR.resolve(src.getFileName());
122 String mn = src.getFileName().toString();
123 compiled = CompilerUtils.compile(src, output, "-Xmodule:" + mn);
124 assertTrue(compiled, "classes did not compile");
125 JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-2.jar"), output);
126 }
127
128 }
129
130 /**
131 * Run test with patches to java.base, jdk.naming.dns and jdk.compiler
132 */
133 void runTest(String basePatches, String dnsPatches, String compilerPatches)
134 throws Exception
135 {
136 // the argument to the test is the list of classes overridden or added
137 String arg = Stream.of(CLASSES).collect(Collectors.joining(","));
138
139 int exitValue
140 = executeTestJava("--patch-module", "java.base=" + basePatches,
141 "--patch-module", "jdk.naming.dns=" + dnsPatches,
142 "--patch-module", "jdk.compiler=" + compilerPatches,
143 "--add-exports", "java.base/java.lang2=test",
|
88 "jdk.naming.dns/com.sun.jndi.dns.DnsClient",
89 "jdk.naming.dns/com.sun.jndi.dns.DnsClientBuddy",
90 "jdk.naming.dns/com.sun.jndi.dns2.Zone",
91
92 // jdk.compiler = application class loaded
93 "jdk.compiler/com.sun.tools.javac.Main",
94 "jdk.compiler/com.sun.tools.javac.MainBuddy",
95 "jdk.compiler/com.sun.tools.javac2.Main",
96
97 };
98
99
100 @BeforeTest
101 public void setup() throws Exception {
102
103 // javac -d mods/test src/test/**
104 boolean compiled= CompilerUtils.compile(SRC_DIR.resolve("test"),
105 MODS_DIR.resolve("test"));
106 assertTrue(compiled, "classes did not compile");
107
108 // javac --patch-module $MODULE=patches1/$MODULE -d patches1/$MODULE patches1/$MODULE/**
109 // jar cf patches/$MODULE-1.jar -C patches1/$MODULE .
110 for (Path src : Files.newDirectoryStream(SRC1_DIR)) {
111 Path output = PATCHES1_DIR.resolve(src.getFileName());
112 String mn = src.getFileName().toString();
113 compiled = CompilerUtils.compile(src, output, "--patch-module", mn + "=" + src.toString());
114 assertTrue(compiled, "classes did not compile");
115 JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-1.jar"), output);
116 }
117
118 // javac --patch-module $MODULE=patches2/$MODULE -d patches2/$MODULE patches2/$MODULE/**
119 // jar cf patches/$MODULE-2.jar -C patches2/$MODULE .
120 for (Path src : Files.newDirectoryStream(SRC2_DIR)) {
121 Path output = PATCHES2_DIR.resolve(src.getFileName());
122 String mn = src.getFileName().toString();
123 compiled = CompilerUtils.compile(src, output, "--patch-module", mn + "=" + src.toString());
124 assertTrue(compiled, "classes did not compile");
125 JarUtils.createJarFile(PATCHES_DIR.resolve(mn + "-2.jar"), output);
126 }
127
128 }
129
130 /**
131 * Run test with patches to java.base, jdk.naming.dns and jdk.compiler
132 */
133 void runTest(String basePatches, String dnsPatches, String compilerPatches)
134 throws Exception
135 {
136 // the argument to the test is the list of classes overridden or added
137 String arg = Stream.of(CLASSES).collect(Collectors.joining(","));
138
139 int exitValue
140 = executeTestJava("--patch-module", "java.base=" + basePatches,
141 "--patch-module", "jdk.naming.dns=" + dnsPatches,
142 "--patch-module", "jdk.compiler=" + compilerPatches,
143 "--add-exports", "java.base/java.lang2=test",
|