anoll@7307: /* anoll@7307: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. anoll@7307: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. anoll@7307: * anoll@7307: * This code is free software; you can redistribute it and/or modify it anoll@7307: * under the terms of the GNU General Public License version 2 only, as anoll@7307: * published by the Free Software Foundation. anoll@7307: * anoll@7307: * This code is distributed in the hope that it will be useful, but WITHOUT anoll@7307: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or anoll@7307: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License anoll@7307: * version 2 for more details (a copy is included in the LICENSE file that anoll@7307: * accompanied this code). anoll@7307: * anoll@7307: * You should have received a copy of the GNU General Public License version anoll@7307: * 2 along with this work; if not, write to the Free Software Foundation, anoll@7307: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. anoll@7307: * anoll@7307: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA anoll@7307: * or visit www.oracle.com if you need additional information or have any anoll@7307: * questions. anoll@7307: */ anoll@7307: anoll@7307: /* anoll@7307: * @test anoll@7307: * @bug 8034775 anoll@7307: * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=) anoll@7307: * @library /testlibrary anoll@7307: */ anoll@7307: import com.oracle.java.testlibrary.*; anoll@7307: anoll@7307: public class NumCompilerThreadsCheck { anoll@7310: anoll@7307: public static void main(String[] args) throws Exception { anoll@7307: ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1"); anoll@7307: OutputAnalyzer out = new OutputAnalyzer(pb.start()); anoll@7307: anoll@7307: String expectedOutput = "CICompilerCount of -1 is invalid"; anoll@7307: out.shouldContain(expectedOutput); anoll@7310: anoll@7310: if (isZeroVm()) { anoll@7310: String expectedLowWaterMarkText = "must be at least 0"; anoll@7310: out.shouldContain(expectedLowWaterMarkText); anoll@7310: } anoll@7310: } anoll@7310: anoll@7310: private static boolean isZeroVm() { anoll@7310: String vmName = System.getProperty("java.vm.name"); anoll@7310: if (vmName == null) { anoll@7310: throw new RuntimeException("No VM name"); anoll@7310: } anoll@7310: if (vmName.toLowerCase().contains("zero")) { anoll@7310: return true; anoll@7310: } anoll@7310: return false; anoll@7307: } anoll@7307: }