test/jdk/tools/launcher/Settings.java
changeset 54541 9ff8d175035d
parent 50545 292a4a87c321
equal deleted inserted replaced
54540:4de70bc80f24 54541:9ff8d175035d
    66 
    66 
    67     private static final String VM_SETTINGS = "VM settings:";
    67     private static final String VM_SETTINGS = "VM settings:";
    68     private static final String PROP_SETTINGS = "Property settings:";
    68     private static final String PROP_SETTINGS = "Property settings:";
    69     private static final String LOCALE_SETTINGS = "Locale settings:";
    69     private static final String LOCALE_SETTINGS = "Locale settings:";
    70     private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
    70     private static final String SYSTEM_SETTINGS = "Operating System Metrics:";
       
    71     private static final String STACKSIZE_SETTINGS = "Stack Size:";
    71 
    72 
    72     static void containsAllOptions(TestResult tr) {
    73     static void containsAllOptions(TestResult tr) {
    73         checkContains(tr, VM_SETTINGS);
    74         checkContains(tr, VM_SETTINGS);
    74         checkContains(tr, PROP_SETTINGS);
    75         checkContains(tr, PROP_SETTINGS);
    75         checkContains(tr, LOCALE_SETTINGS);
    76         checkContains(tr, LOCALE_SETTINGS);
    80 
    81 
    81     static void runTestOptionDefault() throws IOException {
    82     static void runTestOptionDefault() throws IOException {
    82         int stackSize = 256; // in kb
    83         int stackSize = 256; // in kb
    83         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
    84         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
    84             stackSize = 800;
    85             stackSize = 800;
       
    86         } else if (getArch().equals("aarch64")) {
       
    87             /*
       
    88              * The max value of minimum stack size allowed for aarch64 can be estimated as
       
    89              * such: suppose the vm page size is 64KB and the test runs with a debug build,
       
    90              * the initial _java_thread_min_stack_allowed defined in os_linux_aarch64.cpp is
       
    91              * 72K, stack guard zones could take 192KB, and the shadow zone needs 128KB,
       
    92              * after aligning up all parts to the page size, the final size would be 448KB.
       
    93              * See details in JDK-8163363
       
    94              */
       
    95             stackSize = 448;
    85         }
    96         }
    86         TestResult tr;
    97         TestResult tr;
    87         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
    98         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
    88                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
    99                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
       
   100         // Check the stack size logs printed by -XshowSettings to verify -Xss meaningfully.
       
   101         checkContains(tr, STACKSIZE_SETTINGS);
    89         containsAllOptions(tr);
   102         containsAllOptions(tr);
    90         if (!tr.isOK()) {
   103         if (!tr.isOK()) {
    91             System.out.println(tr);
   104             System.out.println(tr);
    92             throw new RuntimeException("test fails");
   105             throw new RuntimeException("test fails");
    93         }
   106         }
    94         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
   107         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
    95                 "-Xss" + (stackSize * 1024), "-XshowSettings", "-jar", testJar.getAbsolutePath());
   108                 "-Xss" + (stackSize * 1024), "-XshowSettings", "-jar", testJar.getAbsolutePath());
       
   109         checkContains(tr, STACKSIZE_SETTINGS);
    96         containsAllOptions(tr);
   110         containsAllOptions(tr);
    97         if (!tr.isOK()) {
   111         if (!tr.isOK()) {
    98             System.out.println(tr);
   112             System.out.println(tr);
    99             throw new RuntimeException("test fails");
   113             throw new RuntimeException("test fails");
   100         }
   114         }