< prev index next >

test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java

Print this page




  33 
  34 import jdk.test.lib.cds.CDSTestUtils;
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 
  37 public class CdsDifferentCompactStrings {
  38     public static void main(String[] args) throws Exception {
  39         createAndLoadSharedArchive("+", "-");
  40         createAndLoadSharedArchive("-", "+");
  41     }
  42 
  43     private static void createAndLoadSharedArchive(String create, String load)
  44         throws Exception
  45     {
  46         String createCompactStringsArgument = "-XX:" + create + "CompactStrings";
  47         String loadCompactStringsArgument   = "-XX:" + load   + "CompactStrings";
  48 
  49         OutputAnalyzer out = CDSTestUtils.createArchive(createCompactStringsArgument);
  50         CDSTestUtils.checkDump(out);
  51 
  52         out = CDSTestUtils.runWithArchive(loadCompactStringsArgument);
  53         if (!CDSTestUtils.isUnableToMap(out)) {

  54             out.shouldMatch("The shared archive file's CompactStrings " +
  55                 "setting .* does not equal the current CompactStrings setting")
  56                 .shouldHaveExitValue(1);
  57         }
  58     }
  59 }


  33 
  34 import jdk.test.lib.cds.CDSTestUtils;
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 
  37 public class CdsDifferentCompactStrings {
  38     public static void main(String[] args) throws Exception {
  39         createAndLoadSharedArchive("+", "-");
  40         createAndLoadSharedArchive("-", "+");
  41     }
  42 
  43     private static void createAndLoadSharedArchive(String create, String load)
  44         throws Exception
  45     {
  46         String createCompactStringsArgument = "-XX:" + create + "CompactStrings";
  47         String loadCompactStringsArgument   = "-XX:" + load   + "CompactStrings";
  48 
  49         OutputAnalyzer out = CDSTestUtils.createArchive(createCompactStringsArgument);
  50         CDSTestUtils.checkDump(out);
  51 
  52         out = CDSTestUtils.runWithArchive(loadCompactStringsArgument);
  53         CDSTestUtils.checkMappingFailure(out);
  54 
  55         out.shouldMatch("The shared archive file's CompactStrings " +
  56                         "setting .* does not equal the current CompactStrings setting")
  57             .shouldHaveExitValue(1);

  58     }
  59 }
< prev index next >