1 /*
   2  * Copyright (c) 2014, 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  */
  23 package codeheapsize;
  24 
  25 import com.oracle.java.testlibrary.Platform;
  26 import common.CodeCacheCLITestBase;
  27 import common.CodeCacheCLITestCase;
  28 import sun.hotspot.code.BlobType;
  29 import 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  * @build TestCodeHeapSizeOptions com.oracle.java.testlibrary.* codeheapsize.*
  36  *        common.*
  37  * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions
  38  */
  39 public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase {
  40     private static final CodeCacheCLITestCase JVM_STARTUP
  41             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
  42                             options -> options.segmented,
  43                             EnumSet.noneOf(BlobType.class)),
  44                     new JVMStartupRunner());
  45 
  46     private static final CodeCacheCLITestCase CODE_CACHE_FREE_SPACE
  47             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
  48                             options -> options.segmented
  49                                     && Platform.isDebugBuild(),
  50                             EnumSet.noneOf(BlobType.class)),
  51                     new CodeCacheFreeSpaceRunner());
  52 
  53     private static final GenericCodeHeapSizeRunner GENERIC_RUNNER
  54             = new GenericCodeHeapSizeRunner();
  55 
  56     private TestCodeHeapSizeOptions() {
  57         super(CodeCacheCLITestBase.OPTIONS_SET,
  58                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  59                         .CommonDescriptions.INT_MODE.description,
  60                         GENERIC_RUNNER),
  61                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  62                         .CommonDescriptions.NON_TIERED.description,
  63                         GENERIC_RUNNER),
  64                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  65                         .CommonDescriptions.TIERED_LEVEL_0.description,
  66                         GENERIC_RUNNER),
  67                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  68                         .CommonDescriptions.TIERED_LEVEL_1.description,
  69                         GENERIC_RUNNER),
  70                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  71                         .CommonDescriptions.TIERED_LEVEL_4.description,
  72                         GENERIC_RUNNER),
  73                 JVM_STARTUP,
  74                 CODE_CACHE_FREE_SPACE);
  75     }
  76 
  77     public static void main(String args[]) throws Throwable {
  78         new TestCodeHeapSizeOptions().runTestCases();
  79     }
  80 }