hotspot/test/gc/TestVerifySilently.java
author sspitsyn
Wed, 03 May 2017 02:32:02 +0000
changeset 46426 02a1fc064144
parent 40886 98cb935dc074
permissions -rw-r--r--
Merge
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.
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38084
diff changeset
    28
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35061
diff changeset
    29
 * @modules java.base/jdk.internal.misc
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    30
 */
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    31
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38084
diff changeset
    32
import jdk.test.lib.process.ProcessTools;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38084
diff changeset
    33
import jdk.test.lib.process.OutputAnalyzer;
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    34
import java.util.ArrayList;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    35
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
    36
import jdk.test.lib.Utils;
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    37
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    38
class RunSystemGC {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    39
  public static void main(String args[]) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    40
    System.gc();
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    41
  }
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
public class TestVerifySilently {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    46
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    47
  private static OutputAnalyzer runTest(boolean verifySilently) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    48
    ArrayList<String> vmOpts = new ArrayList();
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    49
38084
21c37af5ba7e 8154759: [TESTBUG] GC tests should be changed to be able to execute with -Xlog:all=trace.
mchernov
parents: 36851
diff changeset
    50
    Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*"));
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    51
    Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    52
                                             "-XX:+VerifyDuringStartup",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    53
                                             "-XX:+VerifyBeforeGC",
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    54
                                             "-XX:+VerifyAfterGC",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    55
                                             (verifySilently ? "-Xlog:gc":"-Xlog:gc+verify=debug"),
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    56
                                             RunSystemGC.class.getName()});
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    57
    ProcessBuilder pb =
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    58
      ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    59
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    60
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    61
    System.out.println("Output:\n" + output.getOutput());
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    62
    return output;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    63
  }
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
  public static void main(String args[]) throws Exception {
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    67
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    68
    OutputAnalyzer output;
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    69
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    70
    output = runTest(false);
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    71
    output.shouldContain("Verifying");
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    72
    output.shouldHaveExitValue(0);
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    73
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    74
    output = runTest(true);
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    75
    output.shouldNotContain("Verifying");
22760
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    76
    output.shouldHaveExitValue(0);
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    77
  }
8469dee00b80 8032771: The flag VerifySilently misses a test case
tschatzl
parents:
diff changeset
    78
}