-
Enhancement
-
Resolution: Fixed
-
P4
-
21
-
b10
Some of the nsk/jdi invokemethod tests were converted to support testing with virtual threads. This was done by using the JDIThreadFactory.newThread(Runnable) API, which will create a virtual thread when the test is run with -Dmain.wrapper=Virtual. However, for some reason a bunch of the tests were skipped. These tests should also be converted. Here's an example of how the conversion needs to be done:
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
index 2dae569f1fc..0a9bbf7d780 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
@@ -34,8 +34,8 @@ import nsk.share.jdi.*;
*/
public class invokemethod010t {
static Log log;
- private invokemethod010Thr thrs[] =
- new invokemethod010Thr[invokemethod010.THRDS_NUM-1];
+ private invokemethod010Thr thrs010[] = new invokemethod010Thr[invokemethod010.THRDS_NUM-1];
+ private Thread thrs[] = new Thread[invokemethod010.THRDS_NUM-1];
private IOPipe pipe;
public static void main(String args[]) {
@@ -87,8 +87,8 @@ public class invokemethod010t {
Object readyObj = new Object();
for (int i=0; i < invokemethod010.THRDS_NUM-1; i++) {
- thrs[i] = new invokemethod010Thr(readyObj,
- invokemethod010.DEBUGGEE_THRDS[i+1]);
+ thrs010[i] = new invokemethod010Thr(readyObj, invokemethod010.DEBUGGEE_THRDS[i+1]);
+ thrs[i] = JDIThreadFactory.newThread(thrs010[i]);
thrs[i].setDaemon(true);
log.display("Debuggee: starting thread #"
+ i + " \"" + thrs[i].getName() + "\" ...");
@@ -111,7 +111,7 @@ public class invokemethod010t {
private void killThreads(int waitTime) {
for (int i=0; i < invokemethod010.THRDS_NUM-1 ; i++) {
- thrs[i].doExit = true;
+ thrs010[i].doExit = true;
try {
thrs[i].join(waitTime);
log.display("Debuggee: thread #"
@@ -127,7 +127,7 @@ public class invokemethod010t {
* This is an auxiliary thread class used to check the flag
* ObjectReference.INVOKE_SINGLE_THREADED in the debugger.
*/
- class invokemethod010Thr extends Thread {
+ class invokemethod010Thr extends NamedTask {
volatile boolean doExit = false;
private Object readyObj;
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
index 2dae569f1fc..0a9bbf7d780 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java
@@ -34,8 +34,8 @@ import nsk.share.jdi.*;
*/
public class invokemethod010t {
static Log log;
- private invokemethod010Thr thrs[] =
- new invokemethod010Thr[invokemethod010.THRDS_NUM-1];
+ private invokemethod010Thr thrs010[] = new invokemethod010Thr[invokemethod010.THRDS_NUM-1];
+ private Thread thrs[] = new Thread[invokemethod010.THRDS_NUM-1];
private IOPipe pipe;
public static void main(String args[]) {
@@ -87,8 +87,8 @@ public class invokemethod010t {
Object readyObj = new Object();
for (int i=0; i < invokemethod010.THRDS_NUM-1; i++) {
- thrs[i] = new invokemethod010Thr(readyObj,
- invokemethod010.DEBUGGEE_THRDS[i+1]);
+ thrs010[i] = new invokemethod010Thr(readyObj, invokemethod010.DEBUGGEE_THRDS[i+1]);
+ thrs[i] = JDIThreadFactory.newThread(thrs010[i]);
thrs[i].setDaemon(true);
log.display("Debuggee: starting thread #"
+ i + " \"" + thrs[i].getName() + "\" ...");
@@ -111,7 +111,7 @@ public class invokemethod010t {
private void killThreads(int waitTime) {
for (int i=0; i < invokemethod010.THRDS_NUM-1 ; i++) {
- thrs[i].doExit = true;
+ thrs010[i].doExit = true;
try {
thrs[i].join(waitTime);
log.display("Debuggee: thread #"
@@ -127,7 +127,7 @@ public class invokemethod010t {
* This is an auxiliary thread class used to check the flag
* ObjectReference.INVOKE_SINGLE_THREADED in the debugger.
*/
- class invokemethod010Thr extends Thread {
+ class invokemethod010Thr extends NamedTask {
volatile boolean doExit = false;
private Object readyObj;