< 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     private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
  69 
  70     static void containsAllOptions(TestResult tr) {
  71         checkContains(tr, VM_SETTINGS);
  72         checkContains(tr, PROP_SETTINGS);
  73         checkContains(tr, LOCALE_SETTINGS);
  74         if (System.getProperty("os.name").contains("Linux")) {
  75             checkContains(tr, SYSTEM_SETTINGS);
  76         }
  77     }
  78 
  79     static void runTestOptionDefault() throws IOException {
  80         String stackSize = "256"; // in kb
  81         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
  82             stackSize = "800";










  83         }
  84         TestResult tr = null;
  85         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
  86                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());


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

  94         containsAllOptions(tr);
  95         if (!tr.isOK()) {
  96             System.out.println(tr.status);
  97             throw new RuntimeException("test fails");
  98         }
  99     }
 100 
 101     static void runTestOptionSystem() throws IOException {
 102         TestResult tr = doExec(javaCmd, "-XshowSettings:system");
 103         if (System.getProperty("os.name").contains("Linux")) {
 104             checkNoContains(tr, VM_SETTINGS);
 105             checkNoContains(tr, PROP_SETTINGS);
 106             checkNoContains(tr, LOCALE_SETTINGS);
 107             checkContains(tr, SYSTEM_SETTINGS);
 108         } else {
 109             // -XshowSettings prints all available settings when
 110             // settings argument is not recognized.
 111             containsAllOptions(tr);
 112         }
 113     }




  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     private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
  70 
  71     static void containsAllOptions(TestResult tr) {
  72         checkContains(tr, VM_SETTINGS);
  73         checkContains(tr, PROP_SETTINGS);
  74         checkContains(tr, LOCALE_SETTINGS);
  75         if (System.getProperty("os.name").contains("Linux")) {
  76             checkContains(tr, SYSTEM_SETTINGS);
  77         }
  78     }
  79 
  80     static void runTestOptionDefault() throws IOException {
  81         String stackSize = "256"; // in kb
  82         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
  83             stackSize = "800";
  84         } else if (getArch().equals("aarch64")) {
  85             /*
  86              * The max value of minimum stack size allowed for aarch64 can be estimated as
  87              * such: suppose the vm page size is 64KB and the test runs with a debug build,
  88              * the initial _java_thread_min_stack_allowed defined in os_linux_aarch64.cpp is
  89              * 72K, stack guard zones could take 192KB, and the shadow zone needs 128KB,
  90              * after aligning up all parts to the page size, the final size would be 448KB.
  91              * See details in JDK-8163363
  92              */
  93             stackSize = "448";
  94         }
  95         TestResult tr = null;
  96         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
  97                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
  98         // Check the stack size logs printed by -XshowSettings to verify -Xss meaningfully.
  99         checkContains(tr, STACKSIZE_SETTINGS);
 100         containsAllOptions(tr);
 101         if (!tr.isOK()) {
 102             System.out.println(tr.status);
 103             throw new RuntimeException("test fails");
 104         }
 105         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
 106                 "-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
 107         checkContains(tr, STACKSIZE_SETTINGS);
 108         containsAllOptions(tr);
 109         if (!tr.isOK()) {
 110             System.out.println(tr.status);
 111             throw new RuntimeException("test fails");
 112         }
 113     }
 114 
 115     static void runTestOptionSystem() throws IOException {
 116         TestResult tr = doExec(javaCmd, "-XshowSettings:system");
 117         if (System.getProperty("os.name").contains("Linux")) {
 118             checkNoContains(tr, VM_SETTINGS);
 119             checkNoContains(tr, PROP_SETTINGS);
 120             checkNoContains(tr, LOCALE_SETTINGS);
 121             checkContains(tr, SYSTEM_SETTINGS);
 122         } else {
 123             // -XshowSettings prints all available settings when
 124             // settings argument is not recognized.
 125             containsAllOptions(tr);
 126         }
 127     }


< prev index next >