# HG changeset patch # User Matthias Grimmer # Date 1409123617 -7200 # Node ID c0376739e8351f2c117edf354256ff128ad1f81e # Parent 41f66e61b39a23e23539416e005d42692634ea69 NFI: adopt unittests to new NFI behaviour; add new unittest diff -r 41f66e61b39a -r c0376739e835 graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java --- a/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java Wed Aug 27 09:13:00 2014 +0200 +++ b/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java Wed Aug 27 09:13:37 2014 +0200 @@ -347,46 +347,50 @@ @Test public void test15() { assumeTrue(nfi.isDefaultLibrarySearchSupported()); - try { - nfi.getFunctionHandle("an invalid function name", int.class); + NativeFunctionHandle functionHandle = nfi.getFunctionHandle("an invalid function name", int.class); + if (functionHandle != null) { fail(); - } catch (UnsatisfiedLinkError e) { } } @Test public void test16() { NativeLibraryHandle javaLib = nfi.getLibraryHandle(getJavaLibPath()); - try { - - nfi.getFunctionHandle(javaLib, "an invalid function name", int.class); + NativeFunctionHandle functionHandle = nfi.getFunctionHandle(javaLib, "an invalid function name", int.class); + if (functionHandle != null) { fail(); - } catch (UnsatisfiedLinkError e) { } } @Test public void test17() { NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())}; - try { - nfi.getFunctionPointer(libs, "an invalid function name"); + NativeFunctionHandle functionHandle = nfi.getFunctionHandle(libs, "an invalid function name", int.class); + if (functionHandle != null) { fail(); - } catch (UnsatisfiedLinkError e) { } } @Test public void test18() { NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())}; - try { - nfi.getFunctionHandle(libs, "an invalid function name", int.class); + NativeFunctionHandle functionHandle = nfi.getFunctionHandle(libs, "an invalid function name", int.class); + if (functionHandle != null) { fail(); - } catch (UnsatisfiedLinkError e) { } } @Test public void test19() { + NativeLibraryHandle[] libs = {nfi.getLibraryHandle(getVMLibPath()), nfi.getLibraryHandle(getJavaLibPath())}; + NativeFunctionPointer functionPointer = nfi.getFunctionPointer(libs, "an invalid function name"); + if (functionPointer != null) { + fail(); + } + } + + @Test + public void test20() { try { nfi.getLibraryHandle("an invalid library name"); fail();