From 6708f02e74a0704abee05877fd1d8936b5e0c232 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 11 Jul 2025 10:53:01 +0200 Subject: [PATCH 1/3] 8361950: Update to use jtreg 8 --- make/conf/github-actions.conf | 2 +- make/conf/jib-profiles.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf index d2b6cd2312883..438e4b3ce8d02 100644 --- a/make/conf/github-actions.conf +++ b/make/conf/github-actions.conf @@ -26,7 +26,7 @@ # Versions and download locations for dependencies used by GitHub Actions (GHA) GTEST_VERSION=1.14.0 -JTREG_VERSION=7.5.2+1 +JTREG_VERSION=8+2 LINUX_X64_BOOT_JDK_EXT=tar.gz LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk24/1f9ff9062db4449d8ca828c504ffae90/36/GPL/openjdk-24_linux-x64_bin.tar.gz diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index d4877604a90bd..7ed72005ced1e 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1174,9 +1174,9 @@ var getJibProfilesDependencies = function (input, common) { jtreg: { server: "jpg", product: "jtreg", - version: "7.5.2", - build_number: "1", - file: "bundles/jtreg-7.5.2+1.zip", + version: "8", + build_number: "2", + file: "bundles/jtreg-8+2.zip", environment_name: "JT_HOME", environment_path: input.get("jtreg", "home_path") + "/bin", configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"), From bf7b033b6f36c8e7334b016ee9211fecdd7b5755 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 11 Jul 2025 10:57:29 +0200 Subject: [PATCH 2/3] 8361950: Set required version to 8+2 --- make/autoconf/lib-tests.m4 | 2 +- test/docs/TEST.ROOT | 2 +- test/hotspot/jtreg/TEST.ROOT | 2 +- test/jaxp/TEST.ROOT | 2 +- test/jdk/TEST.ROOT | 2 +- test/langtools/TEST.ROOT | 2 +- test/lib-test/TEST.ROOT | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/make/autoconf/lib-tests.m4 b/make/autoconf/lib-tests.m4 index 9eb5ee5a046f9..23f3d443a6c72 100644 --- a/make/autoconf/lib-tests.m4 +++ b/make/autoconf/lib-tests.m4 @@ -28,7 +28,7 @@ ################################################################################ # Minimum supported versions -JTREG_MINIMUM_VERSION=7.5.2 +JTREG_MINIMUM_VERSION=8 GTEST_MINIMUM_VERSION=1.14.0 ################################################################################ diff --git a/test/docs/TEST.ROOT b/test/docs/TEST.ROOT index 5ca9b1f144f15..bcbfd717dc0a0 100644 --- a/test/docs/TEST.ROOT +++ b/test/docs/TEST.ROOT @@ -38,7 +38,7 @@ groups=TEST.groups # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Use new module options useNewOptions=true diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 1857978ebc04c..548cd18fe0cb9 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -103,7 +103,7 @@ requires.properties= \ jdk.static # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../../ notation to reach them diff --git a/test/jaxp/TEST.ROOT b/test/jaxp/TEST.ROOT index 6398c399f0a5f..bafa67a700e61 100644 --- a/test/jaxp/TEST.ROOT +++ b/test/jaxp/TEST.ROOT @@ -23,7 +23,7 @@ modules=java.xml groups=TEST.groups # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index 0fa78bebc3f0a..9d12d384399b8 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -121,7 +121,7 @@ requires.properties= \ jdk.static # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/langtools/TEST.ROOT b/test/langtools/TEST.ROOT index e3bd3b74bcf5d..1aaaa7dffe1f6 100644 --- a/test/langtools/TEST.ROOT +++ b/test/langtools/TEST.ROOT @@ -15,7 +15,7 @@ keys=intermittent randomness needs-src needs-src-jdk_javadoc groups=TEST.groups # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Use new module options useNewOptions=true diff --git a/test/lib-test/TEST.ROOT b/test/lib-test/TEST.ROOT index 162e6e15ec2db..5710e2e9528bc 100644 --- a/test/lib-test/TEST.ROOT +++ b/test/lib-test/TEST.ROOT @@ -29,7 +29,7 @@ keys=randomness # Minimum jtreg version -requiredVersion=7.5.2+1 +requiredVersion=8+2 # Allow querying of various System properties in @requires clauses requires.extraPropDefns = ../jtreg-ext/requires/VMProps.java From b5112c32ddd4bfd8121d09ae8a47ff45d3e19e69 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Mon, 11 Aug 2025 13:29:26 +0200 Subject: [PATCH 3/3] Update to use correct library directories See also: https://openjdk.org/jtreg/faq.html#how-do-i-find-the-path-for-the-testng-or-junit-jar-files --- .../ResourceExhausted/resexhausted003.java | 23 +++++-------------- .../spi-calendar-provider/TestSPISigned.java | 10 ++++---- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java index 8cc997fa4ab75..f1d18211f3d3a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java @@ -25,9 +25,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.PrintStream; +import java.net.URI; +import java.nio.file.Path; +import java.security.CodeSource; import java.security.ProtectionDomain; -import java.util.regex.Pattern; -import java.util.regex.Matcher; import nsk.share.Consts; import nsk.share.test.Stresser; @@ -80,24 +81,12 @@ static byte[] fileBytes(String fileName) { public static int run(String args[], PrintStream out) { - String testclasspath = System.getProperty("test.class.path"); - String [] testpaths = testclasspath.split(System.getProperty("path.separator")); - String classesDir = ""; - - Pattern pattern = Pattern.compile("^(.*)classes(.*)vmTestbase(.*)$"); - for (int i = 0 ; i < testpaths.length; i++) { - if (pattern.matcher(testpaths[i]).matches()) { - classesDir = testpaths[i]; - } - } - if (classesDir.equals("")) { - System.err.println("TEST BUG: Classes directory not found in test,class.path."); - return Consts.TEST_FAILED; - } Stresser stress = new Stresser(args); String className = Helper.class.getName(); - byte[] bloatBytes = fileBytes(classesDir + File.separator + className.replace('.', '/') + ".class"); + CodeSource classCodeSource = Helper.class.getProtectionDomain().getCodeSource(); + Path classFilePath = Path.of(URI.create(classCodeSource.getLocation().toString())); + byte[] bloatBytes = fileBytes(classFilePath.resolve(className.replace('.', '/') + ".class").toString()); int count = 0; Helper.resetExhaustedEvent(); diff --git a/test/jdk/java/security/SignedJar/spi-calendar-provider/TestSPISigned.java b/test/jdk/java/security/SignedJar/spi-calendar-provider/TestSPISigned.java index 83c2d85f6e444..c0f84f1fa9b2b 100644 --- a/test/jdk/java/security/SignedJar/spi-calendar-provider/TestSPISigned.java +++ b/test/jdk/java/security/SignedJar/spi-calendar-provider/TestSPISigned.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Red Hat, Inc. + * Copyright (c) 2022, 2025, Red Hat, Inc. * 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,7 @@ import java.util.Locale; import java.util.List; import java.util.ArrayList; +import java.net.URI; import java.nio.file.Paths; import java.nio.file.Path; import java.nio.file.Files; @@ -54,12 +55,9 @@ */ public class TestSPISigned { - private static final String TEST_CLASSES = System.getProperty("test.classes", "."); private static final String TEST_SRC = System.getProperty("test.src", "."); private static final Path META_INF_DIR = Paths.get(TEST_SRC, "provider", "meta"); - private static final Path PROVIDER_PARENT = Paths.get(TEST_CLASSES, ".."); - private static final Path PROVIDER_DIR = PROVIDER_PARENT.resolve("provider"); private static final Path MODS_DIR = Paths.get("mods"); private static final Path UNSIGNED_JAR = MODS_DIR.resolve("unsigned-with-locale.jar"); private static final Path SIGNED_JAR = MODS_DIR.resolve("signed-with-locale.jar"); @@ -81,7 +79,9 @@ public static void main(String[] args) throws Throwable { // Set up signed jar with custom calendar data provider // // 1. Create jar with custom CalendarDataProvider - JarUtils.createJarFile(UNSIGNED_JAR, PROVIDER_DIR); + var codeSource = baz.CalendarDataProviderImpl.class.getProtectionDomain().getCodeSource(); + var providerDir = Path.of(URI.create(codeSource.getLocation().toString())); + JarUtils.createJarFile(UNSIGNED_JAR, providerDir); JarUtils.updateJarFile(UNSIGNED_JAR, META_INF_DIR); // create signer's keypair SecurityTools.keytool("-genkeypair -keyalg RSA -keystore ks " +