8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider
Reviewed-by: mchung
--- a/jdk/test/tools/launcher/ArgsEnvVar.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/ArgsEnvVar.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8170832 8180447
* @summary Arguments passed in environment variable
+ * @modules jdk.compiler
+ * jdk.zipfs
* @build TestHelper
* @run main ArgsEnvVar
*/
--- a/jdk/test/tools/launcher/ArgsFileTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/ArgsFileTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8027634
* @summary Argument parsing from file
+ * @modules jdk.compiler
+ * jdk.zipfs
* @build TestHelper
* @run main ArgsFileTest
*/
--- a/jdk/test/tools/launcher/Arrrghs.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/Arrrghs.java Tue Jul 25 18:36:19 2017 -0700
@@ -26,6 +26,8 @@
* @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
* 6894719 6968053 7151434 7146424 8007333 8077822 8143640 8132379
* @summary Argument parsing validation.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file Arrrghs.java
* @run main/othervm Arrrghs
*/
--- a/jdk/test/tools/launcher/BigJar.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/BigJar.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 7194005
* @summary launcher handling of zip64 archives (Scenario A and B)
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file BigJar.java
* @run main/timeout=600 BigJar
*/
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 4780570 4731671 6354700 6367077 6670965 4882974
* @summary Checks for LD_LIBRARY_PATH and execution on *nixes
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file ExecutionEnvironment.java
* @run main/othervm ExecutionEnvironment
*/
--- a/jdk/test/tools/launcher/LauncherMessageTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/LauncherMessageTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8167063
* @library /test/lib
+ * @modules jdk.compiler
+ * jdk.zipfs
* @build jdk.test.lib.Platform
* jdk.test.lib.util.FileUtils
* @run main LauncherMessageTest
--- a/jdk/test/tools/launcher/MainClassAttributeTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/MainClassAttributeTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -26,6 +26,8 @@
* @bug 7067922
* @author sogoel
* @summary Test negative scenarios for main class attribute
+ * @modules jdk.compiler
+ * jdk.zipfs
* @build MainClassAttributeTest
* @run main MainClassAttributeTest
*/
--- a/jdk/test/tools/launcher/MiscTests.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/MiscTests.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6856415 8154212 8154470
* @summary Miscellaneous tests, Exceptions
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file MiscTests.java
* @run main MiscTests
*/
--- a/jdk/test/tools/launcher/MultipleJRERemoved.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/MultipleJRERemoved.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8067437
* @summary Verify Multiple JRE version support has been removed.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @build TestHelper
* @run main MultipleJRERemoved
*/
--- a/jdk/test/tools/launcher/Settings.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/Settings.java Tue Jul 25 18:36:19 2017 -0700
@@ -27,6 +27,8 @@
* @test
* @bug 6994753 7123582
* @summary tests -XshowSettings options
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file Settings.java
* @run main Settings
* @author ksrini
--- a/jdk/test/tools/launcher/TestHelper.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/TestHelper.java Tue Jul 25 18:36:19 2017 -0700
@@ -51,8 +51,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Arrays;
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
+import java.util.spi.ToolProvider;
import static java.nio.file.StandardCopyOption.*;
import static java.nio.file.StandardOpenOption.*;
@@ -75,7 +74,7 @@
static final boolean haveServerVM;
static final boolean haveClientVM;
- static final JavaCompiler compiler;
+ static final ToolProvider compiler = ToolProvider.findFirst("javac").orElse(null);
static final boolean debug = Boolean.getBoolean("TestHelper.Debug");
static final boolean isWindows =
@@ -130,7 +129,6 @@
if (!is64Bit && !is32Bit) {
throw new RuntimeException("arch model is not 32 or 64 bit ?");
}
- compiler = ToolProvider.getSystemJavaCompiler();
File binDir = new File(JAVAHOME, "bin");
JAVA_BIN = binDir.getAbsolutePath();
@@ -275,7 +273,7 @@
* A convenience method to compile java files.
*/
static void compile(String... compilerArgs) {
- if (compiler.run(null, null, null, compilerArgs) != 0) {
+ if (compiler.run(System.out, System.err, compilerArgs) != 0) {
String sarg = "";
for (String x : compilerArgs) {
sarg.concat(x + " ");
@@ -308,7 +306,7 @@
String compileArgs[] = {
mainClass + ".java"
};
- if (compiler.run(null, null, null, compileArgs) != 0) {
+ if (compiler.run(System.out, System.err, compileArgs) != 0) {
throw new RuntimeException("compilation failed " + mainClass + ".java");
}
if (mEntry == null) {
--- a/jdk/test/tools/launcher/TestMainWithoutEnclosing.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/TestMainWithoutEnclosing.java Tue Jul 25 18:36:19 2017 -0700
@@ -30,6 +30,8 @@
* @test
* @bug 8076264
* @summary Launching app shouldn't require enclosing class for the main class.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile TestMainWithoutEnclosing.java
* @run main TestMainWithoutEnclosing
*/
--- a/jdk/test/tools/launcher/TestSpecialArgs.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/TestSpecialArgs.java Tue Jul 25 18:36:19 2017 -0700
@@ -26,6 +26,8 @@
* @bug 7124089 7131021 8042469 8066185 8074373
* @summary Checks for Launcher special flags, such as MacOSX specific flags,
* and JVM NativeMemoryTracking flags.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
* @run main TestSpecialArgs
*/
--- a/jdk/test/tools/launcher/ToolsOpts.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/ToolsOpts.java Tue Jul 25 18:36:19 2017 -0700
@@ -28,6 +28,8 @@
* javac as a test launcher. Create a dummy javac and intercept options to check
* reception of options as passed through the launcher without having to launch
* javac. Only -J and -cp ./* options should be consumed by the launcher.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @run main ToolsOpts
* @author ssides
*/
--- a/jdk/test/tools/launcher/UnicodeTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/UnicodeTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -24,6 +24,8 @@
/*
* @test
* @bug 5030265
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file UnicodeTest.java
* @run main/othervm UnicodeTest
* @summary Verify that the J2RE can handle all legal Unicode characters
--- a/jdk/test/tools/launcher/UnresolvedExceptions.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/UnresolvedExceptions.java Tue Jul 25 18:36:19 2017 -0700
@@ -24,6 +24,8 @@
/*
* @test
* @bug 4529320
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile -XDignore.symbol.file UnresolvedExceptions.java
* @run main UnresolvedExceptions
* @summary Verifying jvm won't segv if exception not available
--- a/jdk/test/tools/launcher/VersionCheck.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/VersionCheck.java Tue Jul 25 18:36:19 2017 -0700
@@ -26,6 +26,8 @@
* @bug 6545058 6611182 8016209 8139986 8162746
* @summary validate and test -version, -fullversion, and internal, as well as
* sanity checks if a tool can be launched.
+ * @modules jdk.compiler
+ * jdk.zipfs
* @compile VersionCheck.java
* @run main VersionCheck
*/
--- a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -24,7 +24,8 @@
/**
* @test
* @library /lib/testlibrary /test/lib
- * @modules jdk.compiler
+ * @modules java.transaction
+ * jdk.compiler
* @build AddExportsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
* @run testng AddExportsTest
* @summary Basic tests for java --add-exports
--- a/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -25,6 +25,7 @@
* @test
* @library /lib/testlibrary /test/lib
* @modules jdk.compiler
+ * jdk.naming.dns
* @build PatchTest JarUtils jdk.testlibrary.*
* jdk.test.lib.compiler.CompilerUtils
* @run testng PatchTest
--- a/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java Wed Jul 26 09:20:59 2017 +0800
+++ b/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java Tue Jul 25 18:36:19 2017 -0700
@@ -24,7 +24,8 @@
/**
* @test
* @library /lib/testlibrary /test/lib
- * @modules jdk.compiler
+ * @modules java.transaction
+ * jdk.compiler
* @build UpgradeModulePathTest jdk.testlibrary.*
* jdk.test.lib.compiler.CompilerUtils
* @run testng UpgradeModulePathTest