test/hotspot/jtreg/gc/TestVerifySubSet.java
author jiangli
Fri, 02 Nov 2018 19:30:31 -0400
changeset 52397 1322829d1501
parent 49389 9ef2eee8ca7c
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:
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     1
/*
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     4
 *
15f2d488eeee 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
15f2d488eeee 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
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
     8
 *
15f2d488eeee 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
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15f2d488eeee 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
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    13
 * accompanied this code).
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    14
 *
15f2d488eeee 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
15f2d488eeee 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,
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    18
 *
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
15f2d488eeee 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
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    21
 * questions.
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    22
 */
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    23
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    24
/* @test TestVerifySubSet.java
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    25
 * @key gc
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    26
 * @bug 8072725
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    27
 * @summary Test VerifySubSet option
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38084
diff changeset
    28
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35509
diff changeset
    29
 * @modules java.base/jdk.internal.misc
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    30
 */
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
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;
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    34
import java.util.ArrayList;
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
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;
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    37
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    38
class RunSystemGC {
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    39
    public static void main(String args[]) throws Exception {
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    40
        System.gc();
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    41
    }
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    42
}
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    43
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    44
public class TestVerifySubSet {
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    45
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    46
    private static OutputAnalyzer runTest(String subset) throws Exception {
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    47
        ArrayList<String> vmOpts = new ArrayList();
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    48
38084
21c37af5ba7e 8154759: [TESTBUG] GC tests should be changed to be able to execute with -Xlog:all=trace.
mchernov
parents: 36851
diff changeset
    49
        Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*"));
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    50
        Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    51
                                                 "-XX:+VerifyBeforeGC",
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    52
                                                 "-XX:+VerifyAfterGC",
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    53
                                                 "-Xlog:gc+verify=debug",
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    54
                                                 "-XX:VerifySubSet="+subset,
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    55
                                                 RunSystemGC.class.getName()});
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    56
        ProcessBuilder pb =
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    57
            ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    58
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    59
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    60
        System.out.println("Output:\n" + output.getOutput());
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    61
        return output;
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    62
    }
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    63
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    64
    public static void main(String args[]) throws Exception {
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    65
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    66
        OutputAnalyzer output;
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    67
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    68
        output = runTest("heap, threads, codecache, metaspace");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    69
        output.shouldContain("Heap");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    70
        output.shouldContain("Threads");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    71
        output.shouldContain("CodeCache");
49389
9ef2eee8ca7c 8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents: 47216
diff changeset
    72
        output.shouldContain("MetaspaceUtils");
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    73
        output.shouldNotContain("SymbolTable");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    74
        output.shouldNotContain("StringTable");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    75
        output.shouldNotContain("SystemDictionary");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    76
        output.shouldNotContain("CodeCache Oops");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    77
        output.shouldHaveExitValue(0);
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    78
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    79
        output = runTest("hello, threads, codecache, metaspace");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    80
        output.shouldContain("memory sub-system is unknown, please correct it");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    81
        output.shouldNotContain("Threads");
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    82
        output.shouldNotContain("CodeCache");
49389
9ef2eee8ca7c 8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents: 47216
diff changeset
    83
        output.shouldNotContain("MetaspaceUtils");
35509
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    84
        output.shouldHaveExitValue(1);
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    85
    }
15f2d488eeee 8072725: Provide more granular levels for GC verification
poonam
parents:
diff changeset
    86
}