test/hotspot/jtreg/gc/TestVerifySilently.java
author jiangli
Fri, 02 Nov 2018 19:30:31 -0400
changeset 52397 1322829d1501
parent 50525 767cdb97f103
child 53523 4c5184c56dc2
permissions -rw-r--r--
8209564: runtime/appcds/CDSandJFR.java timeout on tier6 on sparc Summary: Set timeout 500 in CDSandJFR.java Reviewed-by: dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     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
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     4
 *
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     8
 *
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    14
 *
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    18
 *
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    21
 * questions.
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    22
 */
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    23
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    24
/* @test TestVerifySilently.java
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    25
 * @key gc
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    26
 * @bug 8032771
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    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
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35061
diff changeset
    30
 * @modules java.base/jdk.internal.misc
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    31
 */
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    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
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    35
import java.util.ArrayList;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    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
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    38
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    39
class RunSystemGC {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    40
  public static void main(String args[]) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    41
    System.gc();
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    42
  }
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    43
}
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    44
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    45
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    46
public class TestVerifySilently {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    47
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    48
  private static OutputAnalyzer runTest(boolean verifySilently) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    49
    ArrayList<String> vmOpts = new ArrayList();
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    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
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    52
    Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    53
                                             "-XX:+VerifyDuringStartup",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    54
                                             "-XX:+VerifyBeforeGC",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    55
                                             "-XX:+VerifyAfterGC",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    56
                                             (verifySilently ? "-Xlog:gc":"-Xlog:gc+verify=debug"),
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    57
                                             RunSystemGC.class.getName()});
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    58
    ProcessBuilder pb =
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    59
      ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    60
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    61
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    62
    System.out.println("Output:\n" + output.getOutput());
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    63
    return output;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    64
  }
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    65
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    66
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    67
  public static void main(String args[]) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    68
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    69
    OutputAnalyzer output;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    70
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    71
    output = runTest(false);
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    72
    output.shouldContain("Verifying");
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    73
    output.shouldHaveExitValue(0);
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    74
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    75
    output = runTest(true);
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    76
    output.shouldNotContain("Verifying");
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    77
    output.shouldHaveExitValue(0);
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    78
  }
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    79
}