Mercurial > hg > graal-jvmci-8
annotate test/gc/TestVerifySubSet.java @ 23926:340e1a736ef7 jdk8u102-b12
Merge
author | asaha |
---|---|
date | Mon, 13 Jun 2016 13:12:13 -0700 |
parents | 6acf14e730dd |
children |
rev | line source |
---|---|
23814
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
1 /* |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
4 * |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
8 * |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
13 * accompanied this code). |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
14 * |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
18 * |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
21 * questions. |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
22 */ |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
23 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
24 /* @test TestVerifySubSet.java |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
25 * @key gc |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
26 * @bug 8072725 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
27 * @summary Test VerifySubSet option |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
28 * @library /testlibrary |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
29 */ |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
30 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
31 import com.oracle.java.testlibrary.OutputAnalyzer; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
32 import com.oracle.java.testlibrary.ProcessTools; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
33 import java.util.ArrayList; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
34 import java.util.Collections; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
35 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
36 class RunSystemGC { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
37 public static void main(String args[]) throws Exception { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
38 System.gc(); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
39 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
40 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
41 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
42 public class TestVerifySubSet { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
43 private static String[] getTestJavaOpts() { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
44 String testVmOptsStr = System.getProperty("test.java.opts"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
45 if (!testVmOptsStr.isEmpty()) { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
46 return testVmOptsStr.split(" "); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
47 } else { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
48 return new String[] {}; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
49 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
50 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
51 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
52 private static OutputAnalyzer runTest(String subset) throws Exception { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
53 ArrayList<String> vmOpts = new ArrayList(); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
54 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
55 Collections.addAll(vmOpts, getTestJavaOpts()); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
56 Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions", |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
57 "-XX:+VerifyBeforeGC", |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
58 "-XX:+VerifyAfterGC", |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
59 "-XX:VerifySubSet="+subset, |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
60 RunSystemGC.class.getName()}); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
61 ProcessBuilder pb = |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
62 ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
63 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
64 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
65 System.out.println("Output:\n" + output.getOutput()); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
66 return output; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
67 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
68 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
69 public static void main(String args[]) throws Exception { |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
70 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
71 OutputAnalyzer output; |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
72 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
73 output = runTest("heap, threads, codecache, metaspace"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
74 output.shouldContain("Heap"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
75 output.shouldContain("Threads"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
76 output.shouldContain("CodeCache"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
77 output.shouldContain("MetaspaceAux"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
78 output.shouldNotContain("SymbolTable"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
79 output.shouldNotContain("StringTable"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
80 output.shouldNotContain("SystemDictionary"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
81 output.shouldNotContain("CodeCache Oops"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
82 output.shouldHaveExitValue(0); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
83 |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
84 output = runTest("hello, threads, codecache, metaspace"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
85 output.shouldContain("memory sub-system is unknown, please correct it"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
86 output.shouldNotContain("Threads"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
87 output.shouldNotContain("CodeCache"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
88 output.shouldNotContain("MetaspaceAux"); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
89 output.shouldHaveExitValue(1); |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
90 } |
6acf14e730dd
8072725: Provide more granular levels for GC verification
poonam
parents:
diff
changeset
|
91 } |