From 8cb122119409fb13b4b9b2e74851207734d5c198 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 5 Nov 2024 15:48:23 +0000 Subject: [PATCH] 8343532: Test test/hotspot/jtreg/runtime/cds/appcds/jigsaw/addmods/AddmodsOption.java fails on Linux ppc64le after JDK-8319343 Reviewed-by: mdoerr, lucy --- .../appcds/jigsaw/addmods/AddmodsOption.java | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/addmods/AddmodsOption.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/addmods/AddmodsOption.java index 4bc779899ac..114dd6b9f3a 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/addmods/AddmodsOption.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/addmods/AddmodsOption.java @@ -28,12 +28,19 @@ * @requires vm.cds.write.archived.java.heap * @requires vm.flagless * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds - * @run driver AddmodsOption + * @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 AddmodsOption */ import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.whitebox.WhiteBox; public class AddmodsOption { + + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static final boolean isJVMCISupported = (WB.getBooleanVMFlag("EnableJVMCI") != null); + public static void main(String[] args) throws Exception { final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main"; final String incubatorModule = "jdk.incubator.vector"; @@ -42,7 +49,7 @@ public class AddmodsOption { final String allSystem = "ALL-SYSTEM"; final String allModulePath = "ALL-MODULE-PATH"; final String loggingOption = "-Xlog:cds=debug,cds+module=debug,cds+heap=info,module=trace"; - final String versionPattern = "java.[0-9][0-9][-].*"; + final String versionPattern = "java.[0-9][0-9].*"; final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled"; final String warningIncubator = "WARNING: Using incubator modules: jdk.incubator.vector"; String archiveName = TestCommon.getNewArchiveName("addmods-option"); @@ -136,31 +143,33 @@ public class AddmodsOption { .shouldContain("subgraph jdk.internal.module.ArchivedBootLayer is not recorde") .shouldHaveExitValue(0); - // dump an archive with JVMCI option which indirectly adds the - // jdk.internal.vm.ci module using the --add-modules option - archiveName = TestCommon.getNewArchiveName("jvmci-module"); - TestCommon.setCurrentArchiveName(archiveName); - oa = TestCommon.dumpBaseArchive( - archiveName, - loggingOption, - "-XX:+UnlockExperimentalVMOptions", - "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", - "-version"); - oa.shouldHaveExitValue(0); + if (isJVMCISupported) { + // dump an archive with JVMCI option which indirectly adds the + // jdk.internal.vm.ci module using the --add-modules option + archiveName = TestCommon.getNewArchiveName("jvmci-module"); + TestCommon.setCurrentArchiveName(archiveName); + oa = TestCommon.dumpBaseArchive( + archiveName, + loggingOption, + "-XX:+UnlockExperimentalVMOptions", + "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", + "-version"); + oa.shouldHaveExitValue(0); - // run with the JVMCI option - oa = TestCommon.execCommon( - loggingOption, - "-XX:+UnlockExperimentalVMOptions", - "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", - "-version"); - try { - oa.shouldHaveExitValue(0) - .shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.internal.vm.ci"); - } catch (RuntimeException re) { - // JVMCI compile may not be available - oa.shouldHaveExitValue(1) - .shouldContain("Cannot use JVMCI compiler: No JVMCI compiler found"); + // run with the JVMCI option + oa = TestCommon.execCommon( + loggingOption, + "-XX:+UnlockExperimentalVMOptions", + "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", + "-version"); + try { + oa.shouldHaveExitValue(0) + .shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.internal.vm.ci"); + } catch (RuntimeException re) { + // JVMCI compile may not be available + oa.shouldHaveExitValue(1) + .shouldContain("Cannot use JVMCI compiler: No JVMCI compiler found"); + } } // dump an archive with multiple modules in -add-modules