21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* @test TestVerifyDuringStartup.java |
24 /* @test TestVerifyDuringStartup.java |
25 * @key gc |
25 * @key gc |
26 * @bug 8010463 |
26 * @bug 8010463 8011343 8011898 |
27 * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 |
27 * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 |
28 * @library /testlibrary |
28 * @library /testlibrary |
29 */ |
29 */ |
30 |
30 |
|
31 import com.oracle.java.testlibrary.JDKToolFinder; |
31 import com.oracle.java.testlibrary.OutputAnalyzer; |
32 import com.oracle.java.testlibrary.OutputAnalyzer; |
32 import com.oracle.java.testlibrary.ProcessTools; |
33 import com.oracle.java.testlibrary.ProcessTools; |
|
34 import java.util.ArrayList; |
|
35 import java.util.Collections; |
33 |
36 |
34 public class TestVerifyDuringStartup { |
37 public class TestVerifyDuringStartup { |
35 public static void main(String args[]) throws Exception { |
38 public static void main(String args[]) throws Exception { |
|
39 ArrayList<String> vmOpts = new ArrayList(); |
|
40 |
|
41 String testVmOptsStr = System.getProperty("test.java.opts"); |
|
42 if (!testVmOptsStr.isEmpty()) { |
|
43 String[] testVmOpts = testVmOptsStr.split(" "); |
|
44 Collections.addAll(vmOpts, testVmOpts); |
|
45 } |
|
46 Collections.addAll(vmOpts, new String[] {"-XX:-UseTLAB", |
|
47 "-XX:+UnlockDiagnosticVMOptions", |
|
48 "-XX:+VerifyDuringStartup", |
|
49 "-version"}); |
|
50 |
|
51 System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java")); |
|
52 for (int i = 0; i < vmOpts.size(); i += 1) { |
|
53 System.out.print(" " + vmOpts.get(i)); |
|
54 } |
|
55 System.out.println(); |
|
56 |
36 ProcessBuilder pb = |
57 ProcessBuilder pb = |
37 ProcessTools.createJavaProcessBuilder(System.getProperty("test.vm.opts"), |
58 ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); |
38 "-XX:-UseTLAB", |
|
39 "-XX:+UnlockDiagnosticVMOptions", |
|
40 "-XX:+VerifyDuringStartup", "-version"); |
|
41 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
59 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
|
60 |
|
61 System.out.println("Output:\n" + output.getOutput()); |
|
62 |
42 output.shouldContain("[Verifying"); |
63 output.shouldContain("[Verifying"); |
43 output.shouldHaveExitValue(0); |
64 output.shouldHaveExitValue(0); |
44 } |
65 } |
45 } |
66 } |