< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleCompareTest.java

Print this page


  32  * @run driver ArchivedModuleCompareTest
  33  */
  34 
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 import jdk.test.lib.process.ProcessTools;
  37 
  38 public class ArchivedModuleCompareTest {
  39     public static void main(String[] args) throws Exception {
  40         String appJar = ClassFileInstaller.getJarPath("app.jar");
  41 
  42         // Test case 1)
  43         // Compare the list of archived system module names with non-archived
  44         // list. They must be the same.
  45         System.out.println("---------------- Test case 1 -----------------");
  46         OutputAnalyzer output = TestCommon.dump(appJar,
  47                         TestCommon.list("PrintSystemModulesApp"));
  48         TestCommon.checkDump(output);
  49 
  50         output = TestCommon.execOff("-cp", appJar, "PrintSystemModulesApp");
  51         output.shouldHaveExitValue(0);
  52         String bootModules1 = output.getStdout();
  53 
  54         output = TestCommon.exec(appJar, "PrintSystemModulesApp");
  55         TestCommon.checkExec(output);
  56         if (output.getStderr().contains("sharing")) {
  57             String bootModules2 = output.getStdout();
  58             TestCommon.checkOutputStrings(bootModules1, bootModules2, ", ");
  59         }
  60 
  61         // Test case 2)
  62         // Verify --show-module-resolution output with the output from
  63         // -Xshare:off run
  64         System.out.println("---------------- Test case 2 -----------------");
  65         output = TestCommon.execOff("-cp", appJar,
  66                                     "--show-module-resolution",
  67                                     "-version");
  68         output.shouldHaveExitValue(0);
  69         String moduleResolutionOut1 = output.getStdout();
  70 
  71         output = TestCommon.exec(appJar,
  72                                  "--show-module-resolution",
  73                                  "-version");
  74         TestCommon.checkExec(output);
  75         if (output.getStderr().contains("sharing")) {
  76             String moduleResolutionOut2 = output.getStdout();
  77             TestCommon.checkOutputStrings(
  78                 moduleResolutionOut1, moduleResolutionOut2, "\n");
  79         }
  80     }
  81 }


  32  * @run driver ArchivedModuleCompareTest
  33  */
  34 
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 import jdk.test.lib.process.ProcessTools;
  37 
  38 public class ArchivedModuleCompareTest {
  39     public static void main(String[] args) throws Exception {
  40         String appJar = ClassFileInstaller.getJarPath("app.jar");
  41 
  42         // Test case 1)
  43         // Compare the list of archived system module names with non-archived
  44         // list. They must be the same.
  45         System.out.println("---------------- Test case 1 -----------------");
  46         OutputAnalyzer output = TestCommon.dump(appJar,
  47                         TestCommon.list("PrintSystemModulesApp"));
  48         TestCommon.checkDump(output);
  49 
  50         output = TestCommon.execOff("-cp", appJar, "PrintSystemModulesApp");
  51         output.shouldHaveExitValue(0);
  52         String bootModules1 = TestCommon.filterOutLogs(output.getStdout());
  53 
  54         output = TestCommon.exec(appJar, "PrintSystemModulesApp");
  55         TestCommon.checkExec(output);
  56         if (output.getStderr().contains("sharing")) {
  57             String bootModules2 = TestCommon.filterOutLogs(output.getStdout());
  58             TestCommon.checkOutputStrings(bootModules1, bootModules2, ", ");
  59         }
  60 
  61         // Test case 2)
  62         // Verify --show-module-resolution output with the output from
  63         // -Xshare:off run
  64         System.out.println("---------------- Test case 2 -----------------");
  65         output = TestCommon.execOff("-cp", appJar,
  66                                     "--show-module-resolution",
  67                                     "-version");
  68         output.shouldHaveExitValue(0);
  69         String moduleResolutionOut1 = TestCommon.filterOutLogs(output.getStdout());
  70 
  71         output = TestCommon.exec(appJar,
  72                                  "--show-module-resolution",
  73                                  "-version");
  74         TestCommon.checkExec(output);
  75         if (output.getStderr().contains("sharing")) {
  76             String moduleResolutionOut2 = TestCommon.filterOutLogs(output.getStdout());
  77             TestCommon.checkOutputStrings(
  78                 moduleResolutionOut1, moduleResolutionOut2, "\n");
  79         }
  80     }
  81 }
< prev index next >