Skip to content

Commit da23377

Browse files
rgithubliPaul Hohensee
authored andcommitted
8353953: com/sun/jdi tests should be fixed to not always require includevirtualthreads=y
Backport-of: d1d81dd01ca6f3fc1e4710e6055c5a3185f43d9a
1 parent 6bbe3e9 commit da23377

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

test/jdk/com/sun/jdi/EventQueueDisconnectTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@ public class EventQueueDisconnectTest {
6262
public static void main(String args[]) throws Exception {
6363
VMConnection connection = new VMConnection(
6464
"com.sun.jdi.CommandLineLaunch:",
65-
VirtualMachine.TRACE_NONE);
65+
VirtualMachine.TRACE_NONE, false);
6666
connection.setConnectorArg("main", "EventQueueDisconnectTarg");
6767
String debuggeeVMOptions = VMConnection.getDebuggeeVMOptions();
6868
if (!debuggeeVMOptions.equals("")) {

test/jdk/com/sun/jdi/RedefineNestmateAttr/TestNestmateAttr.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -213,6 +213,7 @@ public class TestNestmateAttr extends TestScaffold {
213213

214214
TestNestmateAttr (String[] args) {
215215
super(args);
216+
enableIncludeVirtualthreads(); // need to run debug agent with includevirtualthreads=y
216217
}
217218

218219
public static void main(String[] args) throws Throwable {

test/jdk/com/sun/jdi/TestScaffold.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,9 @@ abstract public class TestScaffold extends TargetAdapter {
4242
private boolean redefineAsynchronously = false;
4343
private ReferenceType mainStartClass = null;
4444

45+
// Set true by tests that need the debug agent to be run with includevirtualthreads=y.
46+
private boolean includeVThreads = false;
47+
4548
ThreadReference mainThread;
4649
/**
4750
* We create a VMDeathRequest, SUSPEND_ALL, to sync the BE and FE.
@@ -84,6 +87,10 @@ public void mySleep(int millis) {
8487
}
8588
}
8689

90+
void enableIncludeVirtualthreads() {
91+
includeVThreads = true;
92+
}
93+
8794
boolean getExceptionCaught() {
8895
return exceptionCaught;
8996
}
@@ -588,7 +595,8 @@ public void connect(String args[]) {
588595

589596
argInfo.targetVMArgs = VMConnection.getDebuggeeVMOptions() + " " + argInfo.targetVMArgs;
590597
connection = new VMConnection(argInfo.connectorSpec,
591-
argInfo.traceFlags);
598+
argInfo.traceFlags,
599+
includeVThreads);
592600

593601
addListener(new TargetAdapter() {
594602
public void eventSetComplete(EventSet set) {

test/jdk/com/sun/jdi/VMConnection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -123,9 +123,9 @@ private Map parseConnectorArgs(Connector connector, String argString) {
123123
return arguments;
124124
}
125125

126-
VMConnection(String connectSpec, int traceFlags) {
126+
VMConnection(String connectSpec, int traceFlags, boolean includeVThreads) {
127127
String nameString;
128-
String argString = "includevirtualthreads=y";
128+
String argString = "includevirtualthreads=" + (includeVThreads ? 'y' : 'n');
129129
int index = connectSpec.indexOf(':');
130130
if (index == -1) {
131131
nameString = connectSpec;

0 commit comments

Comments
 (0)