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 common.CodeCacheCLITestBase;
  26 import common.CodeCacheCLITestCase;
  27 import sun.hotspot.code.BlobType;
  28 import java.util.EnumSet;
  29 /**
  30  * @test
  31  * @summary Verify processing of options related to code heaps sizing.
  32  * @library /testlibrary /testlibrary/whitebox ..
  33  * @build TestCodeHeapSizeOptions com.oracle.java.testlibrary.* codeheapsize.*
  34  *        common.*
  35  * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions
  36  */
  37 public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase {
  38     private static final CodeCacheCLITestCase JVM_STARTUP
  39             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
  40                             options -> options.segmented,
  41                             EnumSet.noneOf(BlobType.class)),
  42                     new JVMStartupRunner());
  43 
  44     private static final CodeCacheCLITestCase CODE_CACHE_FREE_SPACE
  45             = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description(
  46                             options -> options.segmented,
  47                             EnumSet.noneOf(BlobType.class)),
  48                     new CodeCacheFreeSpaceRunner());
  49 
  50     private static final GenericCodeHeapSizeRunner GENERIC_RUNNER
  51             = new GenericCodeHeapSizeRunner();
  52 
  53     private TestCodeHeapSizeOptions() {
  54         super(CodeCacheCLITestBase.OPTIONS_SET,
  55                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  56                         .CommonDescriptions.INT_MODE.description,
  57                         GENERIC_RUNNER),
  58                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  59                         .CommonDescriptions.NON_TIERED.description,
  60                         GENERIC_RUNNER),
  61                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  62                         .CommonDescriptions.TIERED_LEVEL_0.description,
  63                         GENERIC_RUNNER),
  64                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  65                         .CommonDescriptions.TIERED_LEVEL_1.description,
  66                         GENERIC_RUNNER),
  67                 new CodeCacheCLITestCase(CodeCacheCLITestCase
  68                         .CommonDescriptions.TIERED_LEVEL_4.description,
  69                         GENERIC_RUNNER),
  70                 JVM_STARTUP,
  71                 CODE_CACHE_FREE_SPACE);
  72     }
  73 
  74     public static void main(String args[]) throws Throwable {
  75         new TestCodeHeapSizeOptions().runTestCases();
  76     }
  77 }