TestCodeHeapSizeOptions.java revision 8359:ed6389f70257
1/*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
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 */
23package codeheapsize;
24
25import jdk.test.lib.Platform;
26import common.CodeCacheCLITestBase;
27import common.CodeCacheCLITestCase;
28import sun.hotspot.code.BlobType;
29import java.util.EnumSet;
30/**
31 * @test
32 * @bug 8015774
33 * @summary Verify processing of options related to code heaps sizing.
34 * @library /testlibrary .. /../../test/lib
35 * @modules java.base/sun.misc
36 *          java.compiler
37 *          java.management
38 *          jdk.jvmstat/sun.jvmstat.monitor
39 * @build TestCodeHeapSizeOptions jdk.test.lib.* codeheapsize.*
40 *        common.*
41 * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions
42 */
43public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase {
44    private static final CodeCacheCLITestCase JVM_STARTUP
45            = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
46                            options -> options.segmented,
47                            EnumSet.noneOf(BlobType.class)),
48                    new JVMStartupRunner());
49
50    private static final CodeCacheCLITestCase CODE_CACHE_FREE_SPACE
51            = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
52                            options -> options.segmented
53                                    && Platform.isDebugBuild(),
54                            EnumSet.noneOf(BlobType.class)),
55                    new CodeCacheFreeSpaceRunner());
56
57    private static final GenericCodeHeapSizeRunner GENERIC_RUNNER
58            = new GenericCodeHeapSizeRunner();
59
60    private TestCodeHeapSizeOptions() {
61        super(CodeCacheCLITestBase.OPTIONS_SET,
62                new CodeCacheCLITestCase(CodeCacheCLITestCase
63                        .CommonDescriptions.INT_MODE.description,
64                        GENERIC_RUNNER),
65                new CodeCacheCLITestCase(CodeCacheCLITestCase
66                        .CommonDescriptions.NON_TIERED.description,
67                        GENERIC_RUNNER),
68                new CodeCacheCLITestCase(CodeCacheCLITestCase
69                        .CommonDescriptions.TIERED_LEVEL_0.description,
70                        GENERIC_RUNNER),
71                new CodeCacheCLITestCase(CodeCacheCLITestCase
72                        .CommonDescriptions.TIERED_LEVEL_1.description,
73                        GENERIC_RUNNER),
74                new CodeCacheCLITestCase(CodeCacheCLITestCase
75                        .CommonDescriptions.TIERED_LEVEL_4.description,
76                        GENERIC_RUNNER),
77                JVM_STARTUP,
78                CODE_CACHE_FREE_SPACE);
79    }
80
81    public static void main(String args[]) throws Throwable {
82        new TestCodeHeapSizeOptions().runTestCases();
83    }
84}
85