diff --git a/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java b/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java index 8285c87da6..6b6a81a0d3 100644 --- a/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java +++ b/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java @@ -24,6 +24,7 @@ package com.sun.jna.platform.unix; import com.sun.jna.Native; +import com.sun.jna.Platform; import java.sql.Date; import java.util.Map; @@ -64,6 +65,10 @@ public void testSetenv() { @Test public void testGetLoadAvg() { + if (Platform.isAIX()) { + System.out.println("Skip testGetLoadAvg - getloadavg is not implemented on AIX"); + return; + } double[] loadavg = new double[3]; int retval = LibC.INSTANCE.getloadavg(loadavg, 3); assertEquals(retval, 3); @@ -79,10 +84,10 @@ public void testGethostnameGetdomainname() { LibC.INSTANCE.gethostname(buffer, buffer.length); String hostname = Native.toString(buffer); System.out.println("Hostname: " + hostname); - assertTrue(hostname.length() > 0); + assertNotNull(hostname); LibC.INSTANCE.getdomainname(buffer, buffer.length); String domainname = Native.toString(buffer); System.out.println("Domainname: " + domainname); - assertTrue(domainname.length() > 0); + assertNotNull(domainname); } } diff --git a/test/com/sun/jna/DirectTest.java b/test/com/sun/jna/DirectTest.java index 3175121aad..3e2f4b563f 100644 --- a/test/com/sun/jna/DirectTest.java +++ b/test/com/sun/jna/DirectTest.java @@ -137,6 +137,11 @@ protected Class findClass(String name) throws ClassNotFoundException { } public void testRegisterMethods() throws Exception { + if (Platform.isAIX()) { + // https://stackoverflow.com/questions/8961441/java-system-loadlibrarym-fails-on-aix-6-1 + System.out.println("Skip " + getName() + " - libm can't be dynamically linked on AIX"); + return; + } assertEquals("Math library call failed", 1., MathLibrary.cos(0), .01); assertTrue("Library not registered", Native.registered(MathLibrary.class)); diff --git a/test/com/sun/jna/JNALoadTest.java b/test/com/sun/jna/JNALoadTest.java index 68974b7d14..466b5baf5f 100644 --- a/test/com/sun/jna/JNALoadTest.java +++ b/test/com/sun/jna/JNALoadTest.java @@ -79,6 +79,9 @@ protected void assertJarExists() { protected void assertLibraryExists() { String osPrefix = Platform.getNativeLibraryResourcePrefix(); String name = System.mapLibraryName("jnidispatch").replace(".dylib", ".jnilib"); + if(Platform.isAIX()) { + name = name.replaceAll(".so$", ".a"); + } File lib = new File(CLASSES + "/com/sun/jna/" + osPrefix + "/" + name); if (!lib.exists()) { throw new Error("Expected JNA library at " + lib + " is missing");