> H all,
>
> This PR add `/native` keyword in the test header for virtual thread tests.
> The `/native` keyword will make run the related tests by jtreg standalone
> more friendly.
>
> I runed all the tests without -nativepath argument and find the fail tests.
> This will find all the virtual thread tests which missing '/native' flag.
>
> 1. java/lang/management/ThreadMXBean/VirtualThreads.java#default
>
> VirtualThreads.java:223 call "invoker()" in
> test/lib/jdk/test/lib/thread/VThreadPinner.java file, which will call the
> native function "call".
> java/lang/management/ThreadMXBean/VirtualThreads.java#no-vmcontinuations run
> this test with VM option "-XX:-VMContinuations" and
> `assumeTrue(VThreadScheduler.supportsCustomScheduler(), "No support for
> custom schedulers");` will make junit skip the
> 'testGetThreadInfoCarrierThread' unit test, so
> 'VirtualThreads.java#no-vmcontinuations' do not need '/native' keywork.
>
> 2. java/lang/Thread/virtual/stress/PinALot.java
>
> PinALot.java:58 call "invoker()" in
> test/lib/jdk/test/lib/thread/VThreadPinner.java file, which will call the
> native function "call".
>
> 3. java/lang/Thread/virtual/SynchronizedNative.java
>
> Call System.loadLibrary("SynchronizedNative") at line 85.
>
> 4. Tests java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java,
> java/lang/Thread/virtual/ThreadAPI.java,
> java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java,
> java/lang/Thread/virtual/MonitorWaitNotify.java,
> java/lang/Thread/virtual/MonitorPinnedEvents.java,
> java/lang/Thread/virtual/MonitorEnterExit.java and other tests are similar to
> java/lang/Thread/virtual/stress/PinALot.java
>
>
> - Why we need the '/native' keywork?
>
> I usually run the tests through jtreg directively, rather than run the tests
> through make test. If I run the test which load the native shared library
> files and the test missing '/native' keyword but I forgot to pass the
> '-nativepath' argument to jtreg, or pass the incorrect '-nativepath' argument
> to jtreg, sometimes it will report timeouted after a long time, such as
> java/lang/Thread/virtual/JfrEvents.java. If we add the missing '/native'
> keywork, jtreg will report 'Error. Use -nativepath to specify the location of
> native code' right away. So add the missing '/native' keyword will make run
> the tests more friendly.
>
> Change has been verified locally, test-fix, no risk.
SendaoYan has updated the pull request incrementally with one additional commit
since the last revision:
add /native for test/jdk/java/lang/Thread/virtual/ThreadPollOnYield.java
test/jdk/java/lang/Thread/virtual/Starvation.java
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23550/files
- new: https://git.openjdk.org/jdk/pull/23550/files/7c030997..413ee6b1
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23550&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23550&range=01-02
Stats: 10 lines in 2 files changed: 5 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/23550.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23550/head:pull/23550
PR: https://git.openjdk.org/jdk/pull/23550