johnc@4855: /* johnc@4855: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. johnc@4855: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. johnc@4855: * johnc@4855: * This code is free software; you can redistribute it and/or modify it johnc@4855: * under the terms of the GNU General Public License version 2 only, as johnc@4855: * published by the Free Software Foundation. johnc@4855: * johnc@4855: * This code is distributed in the hope that it will be useful, but WITHOUT johnc@4855: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or johnc@4855: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License johnc@4855: * version 2 for more details (a copy is included in the LICENSE file that johnc@4855: * accompanied this code). johnc@4855: * johnc@4855: * You should have received a copy of the GNU General Public License version johnc@4855: * 2 along with this work; if not, write to the Free Software Foundation, johnc@4855: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. johnc@4855: * johnc@4855: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA johnc@4855: * or visit www.oracle.com if you need additional information or have any johnc@4855: * questions. johnc@4855: */ johnc@4855: johnc@4899: /* @test TestVerifyDuringStartup.java johnc@4855: * @key gc johnc@5021: * @bug 8010463 8011343 8011898 johnc@4899: * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 johnc@4855: * @library /testlibrary johnc@4855: */ johnc@4855: johnc@5021: import com.oracle.java.testlibrary.JDKToolFinder; johnc@4855: import com.oracle.java.testlibrary.OutputAnalyzer; johnc@4855: import com.oracle.java.testlibrary.ProcessTools; johnc@5021: import java.util.ArrayList; johnc@5021: import java.util.Collections; johnc@4855: johnc@4899: public class TestVerifyDuringStartup { johnc@4855: public static void main(String args[]) throws Exception { johnc@5021: ArrayList vmOpts = new ArrayList(); johnc@5021: johnc@5021: String testVmOptsStr = System.getProperty("test.java.opts"); johnc@5021: if (!testVmOptsStr.isEmpty()) { johnc@5021: String[] testVmOpts = testVmOptsStr.split(" "); johnc@5021: Collections.addAll(vmOpts, testVmOpts); johnc@5021: } johnc@5021: Collections.addAll(vmOpts, new String[] {"-XX:-UseTLAB", johnc@5021: "-XX:+UnlockDiagnosticVMOptions", johnc@5021: "-XX:+VerifyDuringStartup", johnc@5021: "-version"}); johnc@5021: ctornqvi@5728: System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java")); johnc@5021: for (int i = 0; i < vmOpts.size(); i += 1) { johnc@5021: System.out.print(" " + vmOpts.get(i)); johnc@5021: } johnc@5021: System.out.println(); johnc@5021: johnc@4855: ProcessBuilder pb = johnc@5021: ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); johnc@4855: OutputAnalyzer output = new OutputAnalyzer(pb.start()); johnc@5021: johnc@5021: System.out.println("Output:\n" + output.getOutput()); johnc@5021: johnc@4855: output.shouldContain("[Verifying"); johnc@4855: output.shouldHaveExitValue(0); johnc@4855: } johnc@4855: }