Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/oracle/TestCompileCommand.java
41152 views
1
/*
2
* Copyright (c) 2015, 2021, 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
*/
23
24
/*
25
* @test TestCompileCommand
26
* @bug 8069389
27
* @summary Regression tests of -XX:CompileCommand
28
* @library /test/lib
29
* @modules java.base/jdk.internal.misc
30
* java.management
31
* @requires vm.flagless
32
* @run driver compiler.oracle.TestCompileCommand
33
*/
34
35
package compiler.oracle;
36
37
import jdk.test.lib.process.OutputAnalyzer;
38
import jdk.test.lib.process.ProcessTools;
39
40
public class TestCompileCommand {
41
42
private static final String[][] ARGUMENTS = {
43
{
44
"-XX:CompileCommand=print,*01234567890123456789012345678901234567890123456789.*0123456789012345678901234567890123456789",
45
"-version"
46
}
47
};
48
49
private static final String[][] OUTPUTS = {
50
{
51
"print *01234567890123456789012345678901234567890123456789.*0123456789012345678901234567890123456789"
52
}
53
};
54
55
private static void verifyValidOption(String[] arguments, String[] expected_outputs) throws Exception {
56
ProcessBuilder pb;
57
OutputAnalyzer out;
58
59
pb = ProcessTools.createJavaProcessBuilder(arguments);
60
out = new OutputAnalyzer(pb.start());
61
62
for (String expected_output : expected_outputs) {
63
out.shouldContain(expected_output);
64
}
65
66
out.shouldNotContain("CompileCommand: An error occurred during parsing");
67
out.shouldHaveExitValue(0);
68
}
69
70
public static void main(String[] args) throws Exception {
71
72
if (ARGUMENTS.length != OUTPUTS.length) {
73
throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs for type (1) options does not match.");
74
}
75
76
// Check if type (1) options are parsed correctly
77
for (int i = 0; i < ARGUMENTS.length; i++) {
78
verifyValidOption(ARGUMENTS[i], OUTPUTS[i]);
79
}
80
}
81
}
82
83