diff --git a/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java b/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java index dcb8dff8f7d..a974a09d615 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,9 @@ import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.util.CoreUtils; +import jdk.test.whitebox.WhiteBox; + +import jtreg.SkippedException; import java.io.BufferedReader; import java.io.File; @@ -126,6 +129,11 @@ public abstract class CiReplayBase { } public void runTest(boolean needCoreDump, String... args) { + // The CiReplay tests don't work properly when CDS is disabled + boolean cdsEnabled = WhiteBox.getWhiteBox().isSharingEnabled(); + if (!cdsEnabled) { + throw new SkippedException("CDS is not available for this JDK."); + } cleanup(); if (generateReplay(needCoreDump, args)) { testAction(); diff --git a/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java b/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java index 4cf4045aebc..e3ec7527123 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,9 @@ package compiler.ciReplay; import jdk.test.lib.Asserts; +import jdk.test.whitebox.WhiteBox; + +import jtreg.SkippedException; import java.io.IOException; import java.nio.file.Files; @@ -51,6 +54,11 @@ public abstract class InliningBase extends DumpReplayBase { } protected void runTest() { + // The CiReplay tests don't work properly when CDS is disabled + boolean cdsEnabled = WhiteBox.getWhiteBox().isSharingEnabled(); + if (!cdsEnabled) { + throw new SkippedException("CDS is not available for this JDK."); + } runTest(commandLineNormal.toArray(new String[0])); } diff --git a/test/hotspot/jtreg/compiler/ciReplay/TestInliningProtectionDomain.java b/test/hotspot/jtreg/compiler/ciReplay/TestInliningProtectionDomain.java index 31e05ba7ecf..339b6b59f4e 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/TestInliningProtectionDomain.java +++ b/test/hotspot/jtreg/compiler/ciReplay/TestInliningProtectionDomain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,10 @@ * @summary Testing that ciReplay inlining does not fail with unresolved signature classes. * @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.compMode != "Xcomp" & vm.debug == true & vm.compiler2.enabled * @modules java.base/jdk.internal.misc - * @run driver compiler.ciReplay.TestInliningProtectionDomain + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * compiler.ciReplay.TestInliningProtectionDomain */ package compiler.ciReplay;