1 /*
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
143 0,
144 1,
145 0
146 };
147
148 private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
149 ProcessBuilder pb;
150 OutputAnalyzer out;
151
152 pb = ProcessTools.createJavaProcessBuilder(arguments);
153 out = new OutputAnalyzer(pb.start());
154
155 try {
156 out.shouldHaveExitValue(exit);
157 for (String expected_output : expected_outputs) {
158 out.shouldContain(expected_output);
159 }
160 } catch (RuntimeException e) {
161 // Check if tiered compilation is available in this JVM
162 // Version. Throw exception only if it is available.
163 if (!(tiered && out.getOutput().contains("TieredCompilation is disabled in this release."))) {
164 throw new RuntimeException(e);
165 }
166 }
167 }
168
169 public static void main(String[] args) throws Exception {
170 if (NON_TIERED_ARGUMENTS.length != NON_TIERED_EXPECTED_OUTPUTS.length || NON_TIERED_ARGUMENTS.length != NON_TIERED_EXIT.length) {
171 throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in non-tiered mode of operation do not match.");
172 }
173
174 if (TIERED_ARGUMENTS.length != TIERED_EXPECTED_OUTPUTS.length || TIERED_ARGUMENTS.length != TIERED_EXIT.length) {
175 throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in tiered mode of operation do not match.");
176 }
177
178 for (int i = 0; i < NON_TIERED_ARGUMENTS.length; i++) {
179 verifyValidOption(NON_TIERED_ARGUMENTS[i], NON_TIERED_EXPECTED_OUTPUTS[i], NON_TIERED_EXIT[i], false);
180 }
181
182 for (int i = 0; i < TIERED_ARGUMENTS.length; i++) {
183 verifyValidOption(TIERED_ARGUMENTS[i], TIERED_EXPECTED_OUTPUTS[i], TIERED_EXIT[i], true);
|
1 /*
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
143 0,
144 1,
145 0
146 };
147
148 private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
149 ProcessBuilder pb;
150 OutputAnalyzer out;
151
152 pb = ProcessTools.createJavaProcessBuilder(arguments);
153 out = new OutputAnalyzer(pb.start());
154
155 try {
156 out.shouldHaveExitValue(exit);
157 for (String expected_output : expected_outputs) {
158 out.shouldContain(expected_output);
159 }
160 } catch (RuntimeException e) {
161 // Check if tiered compilation is available in this JVM
162 // Version. Throw exception only if it is available.
163 if (!(tiered && out.getOutput().contains("-XX:+TieredCompilation not supported in this VM"))) {
164 throw new RuntimeException(e);
165 }
166 }
167 }
168
169 public static void main(String[] args) throws Exception {
170 if (NON_TIERED_ARGUMENTS.length != NON_TIERED_EXPECTED_OUTPUTS.length || NON_TIERED_ARGUMENTS.length != NON_TIERED_EXIT.length) {
171 throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in non-tiered mode of operation do not match.");
172 }
173
174 if (TIERED_ARGUMENTS.length != TIERED_EXPECTED_OUTPUTS.length || TIERED_ARGUMENTS.length != TIERED_EXIT.length) {
175 throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in tiered mode of operation do not match.");
176 }
177
178 for (int i = 0; i < NON_TIERED_ARGUMENTS.length; i++) {
179 verifyValidOption(NON_TIERED_ARGUMENTS[i], NON_TIERED_EXPECTED_OUTPUTS[i], NON_TIERED_EXIT[i], false);
180 }
181
182 for (int i = 0; i < TIERED_ARGUMENTS.length; i++) {
183 verifyValidOption(TIERED_ARGUMENTS[i], TIERED_EXPECTED_OUTPUTS[i], TIERED_EXIT[i], true);
|