David pointed out the flaw in this test a long time ago, but
no one followed through to fix the test. When the test thread
runs to completion, there is no way to get the thread info
for the comparisons being made in checkInfo().
The test already calls checkInfo before starting the thread
and again in the test thread run method. The change below
will make the thrinfo001a and thrinfo001b tests perform the
same checking. It will avoid the race condition when thrinfo001b
finishes quickly.
Issue: https://bugs.openjdk.java.net/browse/JDK-8019927
diff --git
a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001.java
b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001.java
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001.java
@@ -69,11 +69,9 @@
t_b.setDaemon(true);
checkInfo(t_b, t_b.getThreadGroup(), 2);
t_b.start();
- checkInfo(t_b, t_b.getThreadGroup(), 2);
try {
t_b.join();
} catch (InterruptedException e) {}
- checkInfo(t_b, t_b.getThreadGroup(), 2);
return getRes();
}
}