diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties
deleted file mode 100644
index 8b51b2a9115..00000000000
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2018, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java
index a729aa4d28f..09d54318b60 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -37,7 +37,7 @@
* Test scenario:
* - during initialization (from function Agent_OnAttach) agent starts auxiliary thread waiting on
* raw monitor and enables GarbageCollectionStart and GarbageCollectionFinish events
- * - target application provokes garbage collection (calls System.gc())
+ * - target application provokes garbage collection (calls WhiteBox.getWhiteBox().fullGC())
* - agent receives event GarbageCollectionStart
* - agent receives event GarbageCollectionFinish event and notifies waiting auxiliary thread
* - notified auxiliary thread notifies target application that agent finished its work
@@ -48,11 +48,13 @@
* /test/lib
* @build nsk.share.aod.AODTestRunner
* nsk.jvmti.AttachOnDemand.attach020.attach020Target
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm/native
* nsk.share.aod.AODTestRunner
* -jdk ${test.jdk}
* -target nsk.jvmti.AttachOnDemand.attach020.attach020Target
- * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
+ * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* -na attach020Agent00
*/
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java
index a20cf935bae..3a52a539b82 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -22,14 +22,14 @@
*/
package nsk.jvmti.AttachOnDemand.attach020;
-import nsk.share.ClassUnloader;
import nsk.share.aod.TargetApplicationWaitingAgents;
+import jdk.test.whitebox.WhiteBox;
public class attach020Target extends TargetApplicationWaitingAgents {
protected void targetApplicationActions() {
log.display("Provoking garbage collection");
- ClassUnloader.eatMemory();
+ WhiteBox.getWhiteBox().fullGC();
}
public static void main(String[] args) {
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties
deleted file mode 100644
index 8b51b2a9115..00000000000
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2018, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java
index 5cf7b39729b..3d8dc2f4e85 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -44,11 +44,13 @@
* /test/lib
* @build nsk.share.aod.AODTestRunner
* nsk.jvmti.AttachOnDemand.attach021.attach021Target
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm/native
* nsk.share.aod.AODTestRunner
* -jdk ${test.jdk}
* -target nsk.jvmti.AttachOnDemand.attach021.attach021Target
- * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
+ * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* -na attach021Agent00
*/
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java
index d287616af69..adb2c194189 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -22,8 +22,8 @@
*/
package nsk.jvmti.AttachOnDemand.attach021;
-import nsk.share.ClassUnloader;
import nsk.share.aod.TargetApplicationWaitingAgents;
+import jdk.test.whitebox.WhiteBox;
public class attach021Target extends TargetApplicationWaitingAgents {
@@ -51,7 +51,7 @@ protected void targetApplicationActions() throws Throwable {
try {
if (createTaggedObject()) {
log.display("Provoking GC");
- ClassUnloader.eatMemory();
+ WhiteBox.getWhiteBox().fullGC();
}
} finally {
shutdownAgent();
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties
deleted file mode 100644
index 8b51b2a9115..00000000000
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2018, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java
index 49b47585749..5875f7a0f50 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -47,11 +47,13 @@
* /test/lib
* @build nsk.share.aod.AODTestRunner
* nsk.jvmti.AttachOnDemand.attach022.attach022Target
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm/native
* nsk.share.aod.AODTestRunner
* -jdk ${test.jdk}
* -target nsk.jvmti.AttachOnDemand.attach022.attach022Target
- * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
+ * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* -na attach022Agent00
*/
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java
index eb80c0c2a4c..3324855e622 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -22,8 +22,8 @@
*/
package nsk.jvmti.AttachOnDemand.attach022;
-import nsk.share.ClassUnloader;
import nsk.share.aod.TargetApplicationWaitingAgents;
+import jdk.test.whitebox.WhiteBox;
class ClassForAllocationEventsTest {
@@ -47,7 +47,7 @@ protected void targetApplicationActions() throws Throwable {
}
log.display("Provoking GC");
- ClassUnloader.eatMemory();
+ WhiteBox.getWhiteBox().fullGC();
} finally {
if (!shutdownAgent(TEST_ALLOCATION_NUMBER)) {
setStatusFailed("Error happened during agent work, see error messages for details");
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java
index 433ee607d7c..3e25000a2fb 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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 @@
import java.math.*;
import nsk.share.*;
+import jdk.test.whitebox.WhiteBox;
/**
* This test exercises the JVMTI event GarbageCollectionFinish.
@@ -63,7 +64,7 @@ public static int run(String argv[], PrintStream out) {
private int runThis(String argv[], PrintStream out) {
try {
for (int i=0; iGarbageCollectionStart.
@@ -63,13 +64,7 @@ public static int run(String argv[], PrintStream out) {
}
private int runThis(String argv[], PrintStream out) {
- try {
- for (int i=0; iGarbageCollectionStart.
@@ -61,13 +62,7 @@ public static int run(String argv[], PrintStream out) {
}
private int runThis(String argv[], PrintStream out) {
- try {
- for (int i=0; i