< prev index next >

jdk/test/tools/launcher/modules/dryrun/DryRunTest.java

Print this page

        

*** 67,81 **** public void compileTestModule() throws Exception { // javac -d mods/$TESTMODULE src/$TESTMODULE/** assertTrue(CompilerUtils.compile(SRC_DIR.resolve(M_MODULE), MODS_DIR, ! "-modulesourcepath", SRC_DIR.toString())); assertTrue(CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE), MODS_DIR, ! "-modulesourcepath", SRC_DIR.toString())); Files.createDirectories(LIBS_DIR); // create JAR files with no module-info.class assertTrue(jar(M_MODULE, "p/Lib.class")); --- 67,81 ---- public void compileTestModule() throws Exception { // javac -d mods/$TESTMODULE src/$TESTMODULE/** assertTrue(CompilerUtils.compile(SRC_DIR.resolve(M_MODULE), MODS_DIR, ! "--module-source-path", SRC_DIR.toString())); assertTrue(CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE), MODS_DIR, ! "--module-source-path", SRC_DIR.toString())); Files.createDirectories(LIBS_DIR); // create JAR files with no module-info.class assertTrue(jar(M_MODULE, "p/Lib.class"));
*** 99,136 **** public void testModule() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; // no resolution failure ! int exitValue = exec("--dry-run", "-modulepath", dir, "-m", mid); assertTrue(exitValue == 0); } /** * Test dryrun that does not invoke <clinit> of the main class */ public void testMainClinit() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLINIT_CLASS; ! int exitValue = exec("--dry-run", "-modulepath", dir, "-m", mid); assertTrue(exitValue == 0); // expect the test to fail if main class is initialized ! exitValue = exec("-modulepath", dir, "-m", mid); assertTrue(exitValue != 0); } /** ! * Test non-existence module in -addmods */ public void testNonExistAddModules() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; ! int exitValue = exec("--dry-run", "-modulepath", dir, ! "-addmods", "non.existence", "-m", mid); assertTrue(exitValue != 0); } /** --- 99,136 ---- public void testModule() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; // no resolution failure ! int exitValue = exec("--dry-run", "--module-path", dir, "-m", mid); assertTrue(exitValue == 0); } /** * Test dryrun that does not invoke <clinit> of the main class */ public void testMainClinit() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLINIT_CLASS; ! int exitValue = exec("--dry-run", "--module-path", dir, "-m", mid); assertTrue(exitValue == 0); // expect the test to fail if main class is initialized ! exitValue = exec("--module-path", dir, "-m", mid); assertTrue(exitValue != 0); } /** ! * Test non-existence module in --add-modules */ public void testNonExistAddModules() throws Exception { String dir = MODS_DIR.toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; ! int exitValue = exec("--dry-run", "--module-path", dir, ! "--add-modules", "non.existence", "-m", mid); assertTrue(exitValue != 0); } /**
*** 161,188 **** String libs = LIBS_DIR.resolve(M_MODULE + ".jar").toString() + File.pathSeparator + LIBS_DIR.resolve(TEST_MODULE + ".jar").toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; ! // test main method with and without -addmods mm ! int exitValue = exec("-modulepath", LIBS_DIR.toString(), "-m", mid); assertTrue(exitValue != 0); ! exitValue = exec("-modulepath", LIBS_DIR.toString(), ! "-addmods", M_MODULE, "-m", mid); assertTrue(exitValue == 0); ! // test dry run with and without -addmods m // no resolution failure ! exitValue = exec("--dry-run", "-modulepath", LIBS_DIR.toString(), "-m", mid); assertTrue(exitValue == 0); ! exitValue = exec("--dry-run", "-modulepath", LIBS_DIR.toString(), ! "-addmods", M_MODULE, "-m", mid); assertTrue(exitValue == 0); } /** --- 161,188 ---- String libs = LIBS_DIR.resolve(M_MODULE + ".jar").toString() + File.pathSeparator + LIBS_DIR.resolve(TEST_MODULE + ".jar").toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; ! // test main method with and without --add-modules mm ! int exitValue = exec("--module-path", LIBS_DIR.toString(), "-m", mid); assertTrue(exitValue != 0); ! exitValue = exec("--module-path", LIBS_DIR.toString(), ! "--add-modules", M_MODULE, "-m", mid); assertTrue(exitValue == 0); ! // test dry run with and without --add-modules m // no resolution failure ! exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(), "-m", mid); assertTrue(exitValue == 0); ! exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(), ! "--add-modules", M_MODULE, "-m", mid); assertTrue(exitValue == 0); } /**
*** 191,201 **** public void testMissingModule() throws Exception { String subdir = MODS_DIR.resolve(TEST_MODULE).toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; // resolution failure ! int exitValue = exec("--dry-run", "-modulepath", subdir, "-m", mid); assertTrue(exitValue != 0); } private static boolean jar(String name, String entries) throws IOException { Path jar = LIBS_DIR.resolve(name + ".jar"); --- 191,201 ---- public void testMissingModule() throws Exception { String subdir = MODS_DIR.resolve(TEST_MODULE).toString(); String mid = TEST_MODULE + "/" + MAIN_CLASS; // resolution failure ! int exitValue = exec("--dry-run", "--module-path", subdir, "-m", mid); assertTrue(exitValue != 0); } private static boolean jar(String name, String entries) throws IOException { Path jar = LIBS_DIR.resolve(name + ".jar");
< prev index next >