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.cli.CommandLineOptionTest; 26 import common.CodeCacheCLITestCase; 27 import common.CodeCacheOptions; 28 import sun.hotspot.code.BlobType; 29 30 /** 31 * Test case runner aimed to verify that all four options related to code cache 32 * sizing have correct values. 33 */ 34 public class GenericCodeHeapSizeRunner implements CodeCacheCLITestCase.Runner { 35 @Override 36 public void run(CodeCacheCLITestCase.Description testCaseDescription, 37 CodeCacheOptions options) throws Throwable { 38 CodeCacheOptions expectedValues 39 = options.mapOptions(testCaseDescription.involvedCodeHeaps); 40 41 CommandLineOptionTest.verifyOptionValueForSameVM( 42 BlobType.All.sizeOptionName, 43 Long.toString(expectedValues.reserved), 44 String.format("%s should have value %d.", 45 BlobType.All.sizeOptionName, expectedValues.reserved), 46 testCaseDescription.getTestOptions(options)); 47 48 CommandLineOptionTest.verifyOptionValueForSameVM( 49 BlobType.NonNMethod.sizeOptionName, 50 Long.toString(expectedValues.nonNmethods), 51 String.format("%s should have value %d.", 52 BlobType.NonNMethod.sizeOptionName, 53 expectedValues.nonNmethods), 54 testCaseDescription.getTestOptions(options)); 55 56 CommandLineOptionTest.verifyOptionValueForSameVM( 57 BlobType.MethodNonProfiled.sizeOptionName, 58 Long.toString(expectedValues.nonProfiled), 59 String.format("%s should have value %d.", 60 BlobType.MethodNonProfiled.sizeOptionName, 61 expectedValues.nonProfiled), 62 testCaseDescription.getTestOptions(options)); 63 64 CommandLineOptionTest.verifyOptionValueForSameVM( 65 BlobType.MethodProfiled.sizeOptionName, 66 Long.toString(expectedValues.profiled), 67 String.format("%s should have value %d.", 68 BlobType.MethodProfiled.sizeOptionName, 69 expectedValues.profiled), 70 testCaseDescription.getTestOptions(options)); 71 } 72 }