author | jiangli |
Fri, 02 Nov 2018 19:30:31 -0400 | |
changeset 52397 | 1322829d1501 |
parent 50525 | 767cdb97f103 |
child 53523 | 4c5184c56dc2 |
permissions | -rw-r--r-- |
22760 | 1 |
/* |
38084
21c37af5ba7e
8154759: [TESTBUG] GC tests should be changed to be able to execute with -Xlog:all=trace.
mchernov
parents:
36851
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
22760 | 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 |
/* @test TestVerifySilently.java |
|
25 |
* @key gc |
|
26 |
* @bug 8032771 |
|
27 |
* @summary Test silent verification. |
|
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
47216
diff
changeset
|
28 |
* @requires vm.gc != "Z" |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38084
diff
changeset
|
29 |
* @library /test/lib |
36851 | 30 |
* @modules java.base/jdk.internal.misc |
22760 | 31 |
*/ |
32 |
||
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38084
diff
changeset
|
33 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38084
diff
changeset
|
34 |
import jdk.test.lib.process.OutputAnalyzer; |
22760 | 35 |
import java.util.ArrayList; |
36 |
import java.util.Collections; |
|
38084
21c37af5ba7e
8154759: [TESTBUG] GC tests should be changed to be able to execute with -Xlog:all=trace.
mchernov
parents:
36851
diff
changeset
|
37 |
import jdk.test.lib.Utils; |
22760 | 38 |
|
39 |
class RunSystemGC { |
|
40 |
public static void main(String args[]) throws Exception { |
|
41 |
System.gc(); |
|
42 |
} |
|
43 |
} |
|
44 |
||
45 |
||
46 |
public class TestVerifySilently { |
|
47 |
||
48 |
private static OutputAnalyzer runTest(boolean verifySilently) throws Exception { |
|
49 |
ArrayList<String> vmOpts = new ArrayList(); |
|
50 |
||
38084
21c37af5ba7e
8154759: [TESTBUG] GC tests should be changed to be able to execute with -Xlog:all=trace.
mchernov
parents:
36851
diff
changeset
|
51 |
Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*")); |
22760 | 52 |
Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions", |
53 |
"-XX:+VerifyDuringStartup", |
|
54 |
"-XX:+VerifyBeforeGC", |
|
55 |
"-XX:+VerifyAfterGC", |
|
35061 | 56 |
(verifySilently ? "-Xlog:gc":"-Xlog:gc+verify=debug"), |
22760 | 57 |
RunSystemGC.class.getName()}); |
58 |
ProcessBuilder pb = |
|
59 |
ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); |
|
60 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
|
61 |
||
62 |
System.out.println("Output:\n" + output.getOutput()); |
|
63 |
return output; |
|
64 |
} |
|
65 |
||
66 |
||
67 |
public static void main(String args[]) throws Exception { |
|
68 |
||
69 |
OutputAnalyzer output; |
|
70 |
||
71 |
output = runTest(false); |
|
35061 | 72 |
output.shouldContain("Verifying"); |
22760 | 73 |
output.shouldHaveExitValue(0); |
74 |
||
75 |
output = runTest(true); |
|
35061 | 76 |
output.shouldNotContain("Verifying"); |
22760 | 77 |
output.shouldHaveExitValue(0); |
78 |
} |
|
79 |
} |