Mercurial > hg > graal-jvmci-8
annotate 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 |
rev | line source |
---|---|
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
1 /* |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
4 * |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
8 * |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
13 * accompanied this code). |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
14 * |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
18 * |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
21 * questions. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
22 */ |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
23 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
24 import com.oracle.java.testlibrary.ExitCode; |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest; |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
26 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
27 /** |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
28 * @test |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
29 * @bug 8031323 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
30 * @summary Verify SurvivorAlignmentInBytes option processing. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
31 * @library /testlibrary |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
32 * @requires vm.opt.SurvivorAlignmentInBytes == null |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
33 * & vm.opt.ObjectAlignmentInBytes == null |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
34 * & vm.opt.UnlockExperimentalVMOptions == null |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
35 * & (vm.opt.IgnoreUnrecognizedVMOptions == null |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
36 * | vm.opt.IgnoreUnrecognizedVMOptions == "false") |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
37 * @run main TestSurvivorAlignmentInBytesOption |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
38 */ |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
39 public class TestSurvivorAlignmentInBytesOption { |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
40 public static void main(String args[]) throws Throwable { |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
41 String optionName = "SurvivorAlignmentInBytes"; |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
42 String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions"; |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
43 String optionIsExperimental |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
44 = CommandLineOptionTest.getExperimentalOptionErrorMessage( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
45 optionName); |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
46 String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater" |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
47 + " than ObjectAlignmentInBytes.*"; |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
48 String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be " |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
49 + "power of 2.*"; |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
50 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
51 // Verify that without -XX:+UnlockExperimentalVMOptions usage of |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
52 // SurvivorAlignmentInBytes option will cause JVM startup failure |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
53 // with the warning message saying that that option is experimental. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
54 CommandLineOptionTest.verifyJVMStartup( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
55 new String[]{optionIsExperimental}, null, ExitCode.FAIL, false, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
56 "-XX:-UnlockExperimentalVMOptions", |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
57 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
58 unlockExperimentalVMOpts, false), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
59 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
60 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
61 // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
62 // usage of SurvivorAlignmentInBytes option won't cause JVM startup |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
63 // failure. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
64 CommandLineOptionTest.verifyJVMStartup( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
65 null, new String[]{optionIsExperimental}, ExitCode.OK, false, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
66 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
67 unlockExperimentalVMOpts, true), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
68 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
69 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
70 // Verify that if specified SurvivorAlignmentInBytes is lower then |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
71 // ObjectAlignmentInBytes, then the JVM startup will fail with |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
72 // appropriate error message. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
73 CommandLineOptionTest.verifyJVMStartup( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
74 new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
75 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
76 unlockExperimentalVMOpts, true), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
77 CommandLineOptionTest.prepareNumericFlag(optionName, 2)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
78 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
79 // Verify that if specified SurvivorAlignmentInBytes value is not |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
80 // a power of 2 then the JVM startup will fail with appropriate error |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
81 // message. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
82 CommandLineOptionTest.verifyJVMStartup( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
83 new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
84 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
85 unlockExperimentalVMOpts, true), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
86 CommandLineOptionTest.prepareNumericFlag(optionName, 127)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
87 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
88 // Verify that if SurvivorAlignmentInBytes has correct value, then |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
89 // the JVM will be started without errors. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
90 CommandLineOptionTest.verifyJVMStartup( |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
91 null, new String[]{".*SurvivorAlignmentInBytes.*"}, |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
92 ExitCode.OK, false, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
93 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
94 unlockExperimentalVMOpts, true), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
95 CommandLineOptionTest.prepareNumericFlag(optionName, 128)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
96 |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
97 // Verify that we can setup different SurvivorAlignmentInBytes values. |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
98 for (int alignment = 32; alignment <= 128; alignment *= 2) { |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
99 CommandLineOptionTest.verifyOptionValue(optionName, |
22802
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
100 Integer.toString(alignment), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
101 CommandLineOptionTest.prepareBooleanFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
102 unlockExperimentalVMOpts, true), |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
103 CommandLineOptionTest.prepareNumericFlag( |
0ef505d06e12
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
22801
diff
changeset
|
104 optionName, alignment)); |
22801
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
105 } |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
106 } |
860297c03bbc
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
107 } |