From 9be434fa89fe7cb3e7ac1a94446447d897d44f5e Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Sat, 13 Dec 2025 11:54:49 -0800 Subject: [PATCH 1/2] 8343809: Add requires tag to mark tests that are incompatible with exploded image --- test/hotspot/jtreg/TEST.ROOT | 1 + .../runtime/getSysPackage/GetSysPkgTest.java | 3 ++- .../jtreg/runtime/modules/ModulesSymLink.java | 2 ++ .../modules/PatchModule/PatchModuleTraceCL.java | 3 ++- test/jtreg-ext/requires/VMProps.java | 15 +++++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index c298a74dc25f5..0fdbdae9bc5c4 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -101,6 +101,7 @@ requires.properties= \ container.support \ systemd.support \ jdk.containerized \ + jdk.explodedImage \ jlink.runtime.linkable \ jlink.packagedModules \ jdk.static diff --git a/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java b/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java index 0cd3e371d8b31..f0d29e83e0118 100644 --- a/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java +++ b/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -27,6 +27,7 @@ * @modules java.base/jdk.internal.loader * java.logging * @requires vm.flagless + * @requires !jdk.explodedImage * @library /test/lib * @run driver GetSysPkgTest */ diff --git a/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java b/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java index 18d618cf8bcc1..d552a6158f3ce 100644 --- a/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java +++ b/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Google Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,6 +28,7 @@ * @bug 8220095 * @requires os.family == "linux" | os.family == "mac" * @requires vm.flagless + * @requires !jdk.explodedImage * @requires !jdk.static * @library /test/lib * @modules java.management diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java index dd8b33402ac62..4750e95c828d8 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -27,6 +27,7 @@ * @summary Make sure -Xlog:class+load=info works properly with "modules" jimage, --patch-module, and with -Xbootclasspath/a * @requires vm.flagless + * @requires !jdk.explodedImage * @modules java.base/jdk.internal.misc * @library /test/lib * @compile PatchModuleMain.java diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index dbc7a91688525..c65f8eb48f09c 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -146,6 +146,7 @@ public Map call() { map.put("jdk.containerized", this::jdkContainerized); map.put("vm.flagless", this::isFlagless); map.put("jdk.foreign.linker", this::jdkForeignLinker); + map.put("jdk.explodedImage", this::explodedImage); map.put("jlink.packagedModules", this::packagedModules); map.put("jdk.static", this::isStatic); vmGC(map); // vm.gc.X = true/false @@ -751,6 +752,20 @@ private String jdkContainerized() { return "" + "true".equalsIgnoreCase(isEnabled); } + private String explodedImage() { + try { + Path jmodFile = Path.of(System.getProperty("java.home"), "jmods", "java.base.jmod"); + if (jmodFile.toFile().exists()) { + return Boolean.FALSE.toString(); + } else { + return Boolean.TRUE.toString(); + } + } catch (Throwable t) { + t.printStackTrace(); + return errorWithMessage("Error in explodedImage " + t); + } + } + private String packagedModules() { // Some jlink tests require packaged modules being present (jmods). // For a runtime linkable image build packaged modules aren't present From 591c1eb7f50b1bdf3dbd14ec1a7207d549dbd5e4 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Tue, 16 Dec 2025 08:46:13 -0800 Subject: [PATCH 2/2] simplified file check --- test/jtreg-ext/requires/VMProps.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index c65f8eb48f09c..70e619f3d3db3 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -755,7 +755,7 @@ private String jdkContainerized() { private String explodedImage() { try { Path jmodFile = Path.of(System.getProperty("java.home"), "jmods", "java.base.jmod"); - if (jmodFile.toFile().exists()) { + if (Files.exists(jmodFile)) { return Boolean.FALSE.toString(); } else { return Boolean.TRUE.toString();