Path: blob/master/test/hotspot/jtreg/compiler/ciReplay/TestVMNoCompLevel.java
64474 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 == true &29* (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 1 | vm.opt.TieredStopAtLevel == 4)30* @modules java.base/jdk.internal.misc31* @build sun.hotspot.WhiteBox32* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox33* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI34* compiler.ciReplay.TestVMNoCompLevel35*/3637package compiler.ciReplay;3839import java.io.IOException;40import java.nio.file.Files;41import java.nio.file.Paths;42import java.nio.file.Path;43import java.nio.file.StandardOpenOption;44import java.util.List;4546public class TestVMNoCompLevel extends CiReplayBase {47public static void main(String args[]) {48new TestVMNoCompLevel().runTest(false);49}5051@Override52public void testAction() {53try {54Path replayFilePath = Paths.get(REPLAY_FILE_NAME);55List<String> replayContent = Files.readAllLines(replayFilePath);56for (int i = 0; i < replayContent.size(); i++) {57String line = replayContent.get(i);58if (line.startsWith("compile ")) {59replayContent.set(i, line.substring(0, line.lastIndexOf(" ")));60}61}62Files.write(replayFilePath, replayContent, StandardOpenOption.TRUNCATE_EXISTING);63} catch (IOException ioe) {64throw new Error("Failed to read/write replay data: " + ioe, ioe);65}66if (CLIENT_VM_AVAILABLE) {67if (SERVER_VM_AVAILABLE) {68negativeTest(CLIENT_VM_OPTION);69} else {70positiveTest(CLIENT_VM_OPTION);71}72}73if (SERVER_VM_AVAILABLE) {74positiveTest(TIERED_DISABLED_VM_OPTION, SERVER_VM_OPTION);75positiveTest(TIERED_ENABLED_VM_OPTION, SERVER_VM_OPTION);76}77}78}79808182