RFR: 8292362: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed on some platforms

Ao Qi aoqi at openjdk.org
Mon Aug 15 13:25:12 UTC 2022


On Mon, 15 Aug 2022 12:59:59 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Linker.nativeLinker is currently specified to throw UOE so you might find the following will avoid ports needing to change the test less often:
> 
> ```
> --- a/test/jdk/java/lang/Thread/jni/AttachCurrentThread/ImplicitAttach.java
> +++ b/test/jdk/java/lang/Thread/jni/AttachCurrentThread/ImplicitAttach.java
> @@ -45,7 +45,13 @@ public class ImplicitAttach {
>          }
>          latch = new CountDownLatch(threadCount);
>  
> -        Linker abi = Linker.nativeLinker();
> +        Linker abi;
> +        try {
> +            abi = Linker.nativeLinker();
> +        } catch (UnsupportedOperationException e) {
> +            System.out.println("Test skipped, no native linker on this platform");
> +            return;
> +        }
>  
>          // stub to invoke callback
>          MethodHandle callback = MethodHandles.lookup()
> ```

This worked. Thanks, @AlanBateman ! `java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1` passed:


Output and diagnostic info for process 9917 was saved into 'pid-9917-output.log'
Test skipped, no native linker on this platform


[2022-08-15T13:17:02.430832622Z] Waiting for completion for process 9917
[2022-08-15T13:17:02.430922220Z] Waiting for completion finished for process 9917
STDERR:

JavaTest Message: Test complete.


TEST RESULT: Passed. Execution successful

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

PR: https://git.openjdk.org/jdk/pull/9877


More information about the core-libs-dev mailing list