< prev index next >

test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java

Print this page
rev 16468 : [mq]: xmodule-to-patch-module


  56 
  57     private static final Path JMODS = Paths.get(JAVA_HOME, "jmods");
  58     private static final Path MODS_DIR = Paths.get("mods");
  59     private static final Path JARS_DIR = Paths.get("jars");
  60     private static final Path PATCH_DIR = Paths.get("patches");
  61     private static final Path IMAGE = Paths.get("image");
  62 
  63     private static final String JAVA_BASE = "java.base";
  64     private final String[] modules = new String[] { "m1", "m2" };
  65 
  66     @BeforeTest
  67     private void setup() throws Throwable {
  68         Path src = TEST_SRC.resolve("src");
  69         for (String name : modules) {
  70             assertTrue(CompilerUtils.compile(src.resolve(name),
  71                                              MODS_DIR,
  72                                              "--module-source-path", src.toString()));
  73         }
  74 
  75         // compile patched source

  76         assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE),
  77                                          PATCH_DIR.resolve(JAVA_BASE),
  78                                          "-Xmodule:java.base"));
  79         assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve("m2"),
  80                                          PATCH_DIR.resolve("m2")));
  81 
  82         // create an image with only m1 and m2
  83         if (Files.exists(JMODS)) {
  84             // create an image with m1,m2
  85             createImage();
  86         }
  87     }
  88 
  89     @Test
  90     public void test() throws Throwable {
  91         Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE);
  92         Path patchedM2 = PATCH_DIR.resolve("m2");
  93 
  94         Path home = Paths.get(JAVA_HOME);
  95         runTest(home,
  96                 "--module-path", MODS_DIR.toString(),
  97                 "-m", "m1/p1.Main", "1");
  98         runTest(home,




  56 
  57     private static final Path JMODS = Paths.get(JAVA_HOME, "jmods");
  58     private static final Path MODS_DIR = Paths.get("mods");
  59     private static final Path JARS_DIR = Paths.get("jars");
  60     private static final Path PATCH_DIR = Paths.get("patches");
  61     private static final Path IMAGE = Paths.get("image");
  62 
  63     private static final String JAVA_BASE = "java.base";
  64     private final String[] modules = new String[] { "m1", "m2" };
  65 
  66     @BeforeTest
  67     private void setup() throws Throwable {
  68         Path src = TEST_SRC.resolve("src");
  69         for (String name : modules) {
  70             assertTrue(CompilerUtils.compile(src.resolve(name),
  71                                              MODS_DIR,
  72                                              "--module-source-path", src.toString()));
  73         }
  74 
  75         // compile patched source
  76         String patchDir = PATCH_SRC_DIR.resolve(JAVA_BASE).toString();
  77         assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE),
  78                                          PATCH_DIR.resolve(JAVA_BASE),
  79                                          "--patch-module", "java.base=" + patchDir));
  80         assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve("m2"),
  81                                          PATCH_DIR.resolve("m2")));
  82 
  83         // create an image with only m1 and m2
  84         if (Files.exists(JMODS)) {
  85             // create an image with m1,m2
  86             createImage();
  87         }
  88     }
  89 
  90     @Test
  91     public void test() throws Throwable {
  92         Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE);
  93         Path patchedM2 = PATCH_DIR.resolve("m2");
  94 
  95         Path home = Paths.get(JAVA_HOME);
  96         runTest(home,
  97                 "--module-path", MODS_DIR.toString(),
  98                 "-m", "m1/p1.Main", "1");
  99         runTest(home,


< prev index next >