Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable NativeLibraryTest#testAvoidDumplicateLoads #1502

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions test/com/sun/jna/NativeLibraryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}

Expand Down