Path: blob/master/test/hotspot/jtreg/compiler/ciReplay/TestVMNoCompLevel.java
41152 views
/*1* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 801167526* @library / /test/lib27* @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level28* @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true29* @modules java.base/jdk.internal.misc30* @build sun.hotspot.WhiteBox31* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox32* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI33* compiler.ciReplay.TestVMNoCompLevel34*/3536package compiler.ciReplay;3738import java.io.IOException;39import java.nio.file.Files;40import java.nio.file.Paths;41import java.nio.file.Path;42import java.nio.file.StandardOpenOption;43import java.util.List;4445public class TestVMNoCompLevel extends CiReplayBase {46public static void main(String args[]) {47new TestVMNoCompLevel().runTest(false);48}4950@Override51public void testAction() {52try {53Path replayFilePath = Paths.get(REPLAY_FILE_NAME);54List<String> replayContent = Files.readAllLines(replayFilePath);55for (int i = 0; i < replayContent.size(); i++) {56String line = replayContent.get(i);57if (line.startsWith("compile ")) {58replayContent.set(i, line.substring(0, line.lastIndexOf(" ")));59}60}61Files.write(replayFilePath, replayContent, StandardOpenOption.TRUNCATE_EXISTING);62} catch (IOException ioe) {63throw new Error("Failed to read/write replay data: " + ioe, ioe);64}65if (CLIENT_VM_AVAILABLE) {66if (SERVER_VM_AVAILABLE) {67negativeTest(CLIENT_VM_OPTION);68} else {69positiveTest(CLIENT_VM_OPTION);70}71}72if (SERVER_VM_AVAILABLE) {73positiveTest(TIERED_DISABLED_VM_OPTION, SERVER_VM_OPTION);74positiveTest(TIERED_ENABLED_VM_OPTION, SERVER_VM_OPTION);75}76}77}78798081