< prev index next >

test/tools/launcher/Settings.java

Print this page




  48         createJar(testJar, tsrc.toString());
  49     }
  50 
  51     static void checkContains(TestResult tr, String str) {
  52         if (!tr.contains(str)) {
  53             System.out.println(tr);
  54             throw new RuntimeException(str + " not found");
  55         }
  56     }
  57 
  58     static void checkNoContains(TestResult tr, String str) {
  59         if (tr.contains(str)) {
  60             System.out.println(tr.status);
  61             throw new RuntimeException(str + " found");
  62         }
  63     }
  64 
  65     private static final String VM_SETTINGS = "VM settings:";
  66     private static final String PROP_SETTINGS = "Property settings:";
  67     private static final String LOCALE_SETTINGS = "Locale settings:";

  68 
  69     static void containsAllOptions(TestResult tr) {
  70         checkContains(tr, VM_SETTINGS);
  71         checkContains(tr, PROP_SETTINGS);
  72         checkContains(tr, LOCALE_SETTINGS);
  73     }
  74 
  75     static void runTestOptionDefault() throws IOException {
  76         String stackSize = "256"; // in kb
  77         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
  78             stackSize = "800";










  79         }
  80         TestResult tr = null;
  81         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
  82                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());


  83         containsAllOptions(tr);
  84         if (!tr.isOK()) {
  85             System.out.println(tr.status);
  86             throw new RuntimeException("test fails");
  87         }
  88         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
  89                 "-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());

  90         containsAllOptions(tr);
  91         if (!tr.isOK()) {
  92             System.out.println(tr.status);
  93             throw new RuntimeException("test fails");
  94         }
  95     }
  96 
  97     static void runTestOptionAll() throws IOException {
  98         init();
  99         TestResult tr = null;
 100         tr = doExec(javaCmd, "-XshowSettings:all");
 101         containsAllOptions(tr);
 102     }
 103 
 104     static void runTestOptionVM() throws IOException {
 105         TestResult tr = null;
 106         tr = doExec(javaCmd, "-XshowSettings:vm");
 107         checkContains(tr, VM_SETTINGS);
 108         checkNoContains(tr, PROP_SETTINGS);
 109         checkNoContains(tr, LOCALE_SETTINGS);




  48         createJar(testJar, tsrc.toString());
  49     }
  50 
  51     static void checkContains(TestResult tr, String str) {
  52         if (!tr.contains(str)) {
  53             System.out.println(tr);
  54             throw new RuntimeException(str + " not found");
  55         }
  56     }
  57 
  58     static void checkNoContains(TestResult tr, String str) {
  59         if (tr.contains(str)) {
  60             System.out.println(tr.status);
  61             throw new RuntimeException(str + " found");
  62         }
  63     }
  64 
  65     private static final String VM_SETTINGS = "VM settings:";
  66     private static final String PROP_SETTINGS = "Property settings:";
  67     private static final String LOCALE_SETTINGS = "Locale settings:";
  68     private static final String STACKSIZE_SETTINGS = "Stack Size:";
  69 
  70     static void containsAllOptions(TestResult tr) {
  71         checkContains(tr, VM_SETTINGS);
  72         checkContains(tr, PROP_SETTINGS);
  73         checkContains(tr, LOCALE_SETTINGS);
  74     }
  75 
  76     static void runTestOptionDefault() throws IOException {
  77         String stackSize = "256"; // in kb
  78         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
  79             stackSize = "800";
  80         } else if (getArch().equals("aarch64")) {
  81             /*
  82              * The max value of minimum stack size allowed for aarch64 can be estimated as
  83              * such: suppose the vm page size is 64KB and the test runs with a debug build,
  84              * the initial _java_thread_min_stack_allowed defined in os_linux_aarch64.cpp is
  85              * 72K, stack guard zones could take 192KB, and the shadow zone needs 128KB,
  86              * after aligning up all parts to the page size, the final size would be 448KB.
  87              * See details in JDK-8163363
  88              */
  89             stackSize = "448";
  90         }
  91         TestResult tr = null;
  92         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
  93                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
  94         // Check the stack size logs printed by -XshowSettings to verify -Xss meaningfully.
  95         checkContains(tr, STACKSIZE_SETTINGS);
  96         containsAllOptions(tr);
  97         if (!tr.isOK()) {
  98             System.out.println(tr.status);
  99             throw new RuntimeException("test fails");
 100         }
 101         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
 102                 "-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
 103         checkContains(tr, STACKSIZE_SETTINGS);
 104         containsAllOptions(tr);
 105         if (!tr.isOK()) {
 106             System.out.println(tr.status);
 107             throw new RuntimeException("test fails");
 108         }
 109     }
 110 
 111     static void runTestOptionAll() throws IOException {
 112         init();
 113         TestResult tr = null;
 114         tr = doExec(javaCmd, "-XshowSettings:all");
 115         containsAllOptions(tr);
 116     }
 117 
 118     static void runTestOptionVM() throws IOException {
 119         TestResult tr = null;
 120         tr = doExec(javaCmd, "-XshowSettings:vm");
 121         checkContains(tr, VM_SETTINGS);
 122         checkNoContains(tr, PROP_SETTINGS);
 123         checkNoContains(tr, LOCALE_SETTINGS);


< prev index next >