42 */ 43 44 public class TestPermission { 45 46 private static final String TEST_SRC = System.getProperty("test.src"); 47 private static final String TEST_CLASSES = System.getProperty("test.classes"); 48 49 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); 50 private static final Path MODS_DIR = Paths.get("mods"); 51 52 // the names of the modules in this test 53 private static List<String> modules = Arrays.asList("test", "m1"); 54 55 /** 56 * Compiles all modules used by the test 57 */ 58 @BeforeTest 59 public void compileAll() throws Exception { 60 for (String mn : modules) { 61 Path msrc = SRC_DIR.resolve(mn); 62 assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString())); 63 } 64 } 65 66 /** 67 * Run the modular test 68 */ 69 @Test 70 public void runTest() throws Exception { 71 int exitValue = executeTestJava("-mp", MODS_DIR.toString(), 72 "-m", "test/jdk.test.Main") 73 .outputTo(System.out) 74 .errorTo(System.out) 75 .getExitValue(); 76 77 assertTrue(exitValue == 0); 78 } 79 } | 42 */ 43 44 public class TestPermission { 45 46 private static final String TEST_SRC = System.getProperty("test.src"); 47 private static final String TEST_CLASSES = System.getProperty("test.classes"); 48 49 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); 50 private static final Path MODS_DIR = Paths.get("mods"); 51 52 // the names of the modules in this test 53 private static List<String> modules = Arrays.asList("test", "m1"); 54 55 /** 56 * Compiles all modules used by the test 57 */ 58 @BeforeTest 59 public void compileAll() throws Exception { 60 for (String mn : modules) { 61 Path msrc = SRC_DIR.resolve(mn); 62 assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString())); 63 } 64 } 65 66 /** 67 * Run the modular test 68 */ 69 @Test 70 public void runTest() throws Exception { 71 int exitValue = executeTestJava("--module-path", MODS_DIR.toString(), 72 "-m", "test/jdk.test.Main") 73 .outputTo(System.out) 74 .errorTo(System.out) 75 .getExitValue(); 76 77 assertTrue(exitValue == 0); 78 } 79 } |