On Fri, 20 Mar 2026 22:32:41 GMT, Brent Christian <[email protected]> wrote:

> I've looked into it, and if `@requires` uses `""` instead of `null`, these 
> other run modes (`jtreg` and `make test`) will also skip the test (`"Test 
> results: no tests selected"`). (Thanks to @dholmes-ora for the idea.)
> 
> From the bug report:
> It's worth noting that only the method of running tests from the original bug 
> (`jib.sh  make -- run-test JTREG_TEST_THREAD_FACTORY=Virtual TEST=...`) 
> actually causes tests to be run with virtual threads;
> it sets the thread factory to virtual **_in the jtreg process_**.
> 
> This is not so for
> `jtreg ... -javaoptions:-Dtest.thread.factory=Virtual ...`
> or
> `make test ... JTREG="JAVA_OPTIONS=-Dtest.thread.factory=Virtual" ...`
> 
> One can confirm this with a small test such as:
> 
> 
> /**
>  * @test
>  * @run main/othervm VirtThreadCheck
>  */
> public class VirtThreadCheck {
>     public static void main(String[] args) {
>         Thread thisThread = Thread.currentThread();
>         System.out.println("main thread is: " + thisThread);
>         System.out.println("virtual? : " + thisThread.isVirtual());
>     }
> }

Hello Brent, if this addresses the issue, I think it's fine to go ahead with 
this.

Long term I think there should be a better way to express this "run/don't run 
this test when jtreg uses virtual thread to launch the main". I will look into 
that separately.

I just noticed that the copyright year on this file will need an update.

-------------

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30350#pullrequestreview-3990526924
PR Review: https://git.openjdk.org/jdk/pull/30350#pullrequestreview-3990533771

Reply via email to