From 5cf43c904dc7443a1b9f53981e041cc186a0b3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= Date: Wed, 1 Feb 2023 20:49:13 +0100 Subject: [PATCH] Disable NativeLibraryTest#testAvoidDumplicateLoads This test basicly tests whether unloading works. It relies on the runtime to unload the library when dlclose is called. This is not required by POSIX and dt time of writing macOS is known to be flaky in that regard. This test causes false test failures. --- test/com/sun/jna/NativeLibraryTest.java | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/com/sun/jna/NativeLibraryTest.java b/test/com/sun/jna/NativeLibraryTest.java index 57f89a26e2..46a15d7e90 100644 --- a/test/com/sun/jna/NativeLibraryTest.java +++ b/test/com/sun/jna/NativeLibraryTest.java @@ -82,16 +82,22 @@ public void testGCNativeLibrary() throws Exception { } public void testAvoidDuplicateLoads() throws Exception { - NativeLibrary.disposeAll(); - // Give the system a moment to unload the library; on OSX we - // occasionally get the same library handle back on subsequent dlopen - Thread.sleep(2); - - TestLibrary lib = Native.load("testlib", TestLibrary.class); - assertEquals("Library should be newly loaded after explicit dispose of all native libraries", - 1, lib.callCount()); - if (lib.callCount() <= 1) { - fail("Library should not be reloaded without dispose"); + // This test basicly tests whether unloading works. It relies on the + // runtime to unload the library when dlclose is called. This is not + // required by POSIX and dt time of writing macOS is known to be flaky + // in that regard. + // + // This test causes false test failures + if (!Platform.isMac()) { + NativeLibrary.disposeAll(); + Thread.sleep(2); + + TestLibrary lib = Native.load("testlib", TestLibrary.class); + assertEquals("Library should be newly loaded after explicit dispose of all native libraries", + 1, lib.callCount()); + if (lib.callCount() <= 1) { + fail("Library should not be reloaded without dispose"); + } } }