Mercurial > hg > graal-jvmci-8
comparison test/gc/arguments/TestSurvivorAlignmentInBytesOption.java @ 22802:0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
Reviewed-by: jmasa
author | fzhinkin |
---|---|
date | Mon, 15 Dec 2014 18:11:51 +0400 |
parents | 860297c03bbc |
children |
comparison
equal
deleted
inserted
replaced
22801:860297c03bbc | 22802:0ef505d06e12 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 | 23 |
24 import com.oracle.java.testlibrary.ExitCode; | 24 import com.oracle.java.testlibrary.ExitCode; |
25 import com.oracle.java.testlibrary.Utils; | |
26 import com.oracle.java.testlibrary.cli.CommandLineOptionTest; | 25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest; |
27 | |
28 import java.util.Collections; | |
29 import java.util.LinkedList; | |
30 import java.util.List; | |
31 | 26 |
32 /** | 27 /** |
33 * @test | 28 * @test |
34 * @bug 8031323 | 29 * @bug 8031323 |
35 * @summary Verify SurvivorAlignmentInBytes option processing. | 30 * @summary Verify SurvivorAlignmentInBytes option processing. |
36 * @library /testlibrary | 31 * @library /testlibrary |
32 * @requires vm.opt.SurvivorAlignmentInBytes == null | |
33 * & vm.opt.ObjectAlignmentInBytes == null | |
34 * & vm.opt.UnlockExperimentalVMOptions == null | |
35 * & (vm.opt.IgnoreUnrecognizedVMOptions == null | |
36 * | vm.opt.IgnoreUnrecognizedVMOptions == "false") | |
37 * @run main TestSurvivorAlignmentInBytesOption | 37 * @run main TestSurvivorAlignmentInBytesOption |
38 */ | 38 */ |
39 public class TestSurvivorAlignmentInBytesOption { | 39 public class TestSurvivorAlignmentInBytesOption { |
40 private static final String[] FILTERED_VM_OPTIONS | |
41 = Utils.getFilteredTestJavaOpts( | |
42 "UnlockExperimentalVMOptions", | |
43 "SurvivorAlignmentInBytes", | |
44 "ObjectAlignmentInBytes"); | |
45 | |
46 public static void main(String args[]) throws Throwable { | 40 public static void main(String args[]) throws Throwable { |
47 String optionName = "SurvivorAlignmentInBytes"; | 41 String optionName = "SurvivorAlignmentInBytes"; |
42 String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions"; | |
48 String optionIsExperimental | 43 String optionIsExperimental |
49 = CommandLineOptionTest.getExperimentalOptionErrorMessage( | 44 = CommandLineOptionTest.getExperimentalOptionErrorMessage( |
50 optionName); | 45 optionName); |
51 String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater" | 46 String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater" |
52 + " than ObjectAlignmentInBytes.*"; | 47 + " than ObjectAlignmentInBytes.*"; |
56 // Verify that without -XX:+UnlockExperimentalVMOptions usage of | 51 // Verify that without -XX:+UnlockExperimentalVMOptions usage of |
57 // SurvivorAlignmentInBytes option will cause JVM startup failure | 52 // SurvivorAlignmentInBytes option will cause JVM startup failure |
58 // with the warning message saying that that option is experimental. | 53 // with the warning message saying that that option is experimental. |
59 CommandLineOptionTest.verifyJVMStartup( | 54 CommandLineOptionTest.verifyJVMStartup( |
60 new String[]{optionIsExperimental}, null, ExitCode.FAIL, false, | 55 new String[]{optionIsExperimental}, null, ExitCode.FAIL, false, |
61 TestSurvivorAlignmentInBytesOption.prepareOptions( | 56 "-XX:-UnlockExperimentalVMOptions", |
62 "-XX:-UnlockExperimentalVMOptions", | 57 CommandLineOptionTest.prepareBooleanFlag( |
63 CommandLineOptionTest.prepareNumericFlag( | 58 unlockExperimentalVMOpts, false), |
64 optionName, 64))); | 59 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
65 | 60 |
66 // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM | 61 // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM |
67 // usage of SurvivorAlignmentInBytes option won't cause JVM startup | 62 // usage of SurvivorAlignmentInBytes option won't cause JVM startup |
68 // failure. | 63 // failure. |
69 CommandLineOptionTest.verifyJVMStartup( | 64 CommandLineOptionTest.verifyJVMStartup( |
70 null, new String[]{optionIsExperimental}, ExitCode.OK, false, | 65 null, new String[]{optionIsExperimental}, ExitCode.OK, false, |
71 TestSurvivorAlignmentInBytesOption.prepareOptions( | 66 CommandLineOptionTest.prepareBooleanFlag( |
72 CommandLineOptionTest.prepareNumericFlag( | 67 unlockExperimentalVMOpts, true), |
73 optionName, 64))); | 68 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
74 | 69 |
75 // Verify that if specified SurvivorAlignmentInBytes is lower then | 70 // Verify that if specified SurvivorAlignmentInBytes is lower then |
76 // ObjectAlignmentInBytes, then the JVM startup will fail with | 71 // ObjectAlignmentInBytes, then the JVM startup will fail with |
77 // appropriate error message. | 72 // appropriate error message. |
78 CommandLineOptionTest.verifyJVMStartup( | 73 CommandLineOptionTest.verifyJVMStartup( |
79 new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false, | 74 new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false, |
80 TestSurvivorAlignmentInBytesOption.prepareOptions( | 75 CommandLineOptionTest.prepareBooleanFlag( |
81 CommandLineOptionTest.prepareNumericFlag( | 76 unlockExperimentalVMOpts, true), |
82 optionName, 2))); | 77 CommandLineOptionTest.prepareNumericFlag(optionName, 2)); |
83 | 78 |
84 // Verify that if specified SurvivorAlignmentInBytes value is not | 79 // Verify that if specified SurvivorAlignmentInBytes value is not |
85 // a power of 2 then the JVM startup will fail with appropriate error | 80 // a power of 2 then the JVM startup will fail with appropriate error |
86 // message. | 81 // message. |
87 CommandLineOptionTest.verifyJVMStartup( | 82 CommandLineOptionTest.verifyJVMStartup( |
88 new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false, | 83 new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false, |
89 TestSurvivorAlignmentInBytesOption.prepareOptions( | 84 CommandLineOptionTest.prepareBooleanFlag( |
90 CommandLineOptionTest.prepareNumericFlag( | 85 unlockExperimentalVMOpts, true), |
91 optionName, 127))); | 86 CommandLineOptionTest.prepareNumericFlag(optionName, 127)); |
92 | 87 |
93 // Verify that if SurvivorAlignmentInBytes has correct value, then | 88 // Verify that if SurvivorAlignmentInBytes has correct value, then |
94 // the JVM will be started without errors. | 89 // the JVM will be started without errors. |
95 CommandLineOptionTest.verifyJVMStartup( | 90 CommandLineOptionTest.verifyJVMStartup( |
96 null, new String[]{".*SurvivorAlignmentInBytes.*"}, | 91 null, new String[]{".*SurvivorAlignmentInBytes.*"}, |
97 ExitCode.OK, false, | 92 ExitCode.OK, false, |
98 TestSurvivorAlignmentInBytesOption.prepareOptions( | 93 CommandLineOptionTest.prepareBooleanFlag( |
99 CommandLineOptionTest.prepareNumericFlag( | 94 unlockExperimentalVMOpts, true), |
100 optionName, 128))); | 95 CommandLineOptionTest.prepareNumericFlag(optionName, 128)); |
101 | 96 |
102 // Verify that we can setup different SurvivorAlignmentInBytes values. | 97 // Verify that we can setup different SurvivorAlignmentInBytes values. |
103 for (int alignment = 32; alignment <= 128; alignment *= 2) { | 98 for (int alignment = 32; alignment <= 128; alignment *= 2) { |
104 CommandLineOptionTest.verifyOptionValue(optionName, | 99 CommandLineOptionTest.verifyOptionValue(optionName, |
105 Integer.toString(alignment), false, | 100 Integer.toString(alignment), |
106 TestSurvivorAlignmentInBytesOption.prepareOptions( | 101 CommandLineOptionTest.prepareBooleanFlag( |
107 CommandLineOptionTest.prepareNumericFlag( | 102 unlockExperimentalVMOpts, true), |
108 optionName, alignment))); | 103 CommandLineOptionTest.prepareNumericFlag( |
104 optionName, alignment)); | |
109 } | 105 } |
110 } | 106 } |
111 | |
112 private static String[] prepareOptions(String... options) { | |
113 List<String> finalOptions = new LinkedList<>(); | |
114 Collections.addAll(finalOptions, | |
115 TestSurvivorAlignmentInBytesOption.FILTERED_VM_OPTIONS); | |
116 finalOptions.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); | |
117 Collections.addAll(finalOptions, options); | |
118 return finalOptions.toArray(new String[finalOptions.size()]); | |
119 } | |
120 } | 107 } |