# HG changeset patch # User anazarov # Date 1501032979 25200 # Node ID 882cea8089129fbf0b743e1e518f392d5e350f2e # Parent f259efd4f8df1f6c72687d99bc8cce9dc89dbd4b 8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider Reviewed-by: mchung diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/ArgsEnvVar.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/ArgsFileTest.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/Arrrghs.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/BigJar.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/ExecutionEnvironment.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/LauncherMessageTest.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/MainClassAttributeTest.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/MiscTests.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/MultipleJRERemoved.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/Settings.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/TestHelper.java --- 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) { diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/TestMainWithoutEnclosing.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/TestSpecialArgs.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/ToolsOpts.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/UnicodeTest.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/UnresolvedExceptions.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/VersionCheck.java --- 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 */ diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/modules/addexports/AddExportsTest.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/modules/patch/basic/PatchTest.java --- 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 diff -r f259efd4f8df -r 882cea808912 jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java --- 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