From c376516137168e44cacc5a36e02254f45fd75980 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Mon, 7 Apr 2025 17:51:52 -0700 Subject: [PATCH 1/4] Change LoadAgentDcmdTest.getLibInstrumentPath() to return "libinstrument.so" directly without locating the shared library if running on static JDK. --- .../jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java index 725bf086b3bee..58a8c744882fa 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java @@ -53,6 +53,12 @@ public class LoadAgentDcmdTest { public String getLibInstrumentPath() throws FileNotFoundException { + if (Platform.isStatic()) { + // libinstrument is statically linked with the launcher. Don't + // locate the libinstrument shared library on static JDK. + return "libinstrument.so"; + } + String jdkPath = System.getProperty("test.jdk"); if (jdkPath == null) { From 1e61a0dd085987e06afab9ac4d2efc309376d47b Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Mon, 7 Apr 2025 18:59:29 -0700 Subject: [PATCH 2/4] Replace "so" with Platform.sharedLibraryExt(). --- .../jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java index 58a8c744882fa..9efb900573db3 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java @@ -56,7 +56,7 @@ public String getLibInstrumentPath() throws FileNotFoundException { if (Platform.isStatic()) { // libinstrument is statically linked with the launcher. Don't // locate the libinstrument shared library on static JDK. - return "libinstrument.so"; + return "libinstrument." + Platform.sharedLibraryExt(); } String jdkPath = System.getProperty("test.jdk"); From 3b4ef50c7fd68564479e474ec9ecb1cd6a5930d1 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Tue, 8 Apr 2025 12:04:32 -0700 Subject: [PATCH 3/4] Skip LoadAgentDcmdTest on static JDK. --- .../jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java index 9efb900573db3..99b6d2c2a3265 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java @@ -40,6 +40,7 @@ * * @test * @bug 8147388 + * @requires !jdk.static * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler @@ -53,12 +54,6 @@ public class LoadAgentDcmdTest { public String getLibInstrumentPath() throws FileNotFoundException { - if (Platform.isStatic()) { - // libinstrument is statically linked with the launcher. Don't - // locate the libinstrument shared library on static JDK. - return "libinstrument." + Platform.sharedLibraryExt(); - } - String jdkPath = System.getProperty("test.jdk"); if (jdkPath == null) { From a0d3f627bcf87bbd87feeb3814d281655efbe086 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Wed, 9 Apr 2025 10:07:57 -0700 Subject: [PATCH 4/4] Address @AlanBateman's comment: - Updated copyright header --- .../jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java index 99b6d2c2a3265..39068a47e95c5 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/jvmti/LoadAgentDcmdTest.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