From 30841742e735e70b3946d16711089960084e894c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 9 Feb 2013 06:17:45 +0100 Subject: Bug 681: Add Elf Parsing for other OS than Linux, if ARM and !ANDROID using /proc/self/exe (Linux) or a found java/jvm native lib. - PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib) - NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration! - TestElfReader01: Add test for finding java/jvm native lib and parse it --- .../com/jogamp/common/os/TestElfReader01.java | 56 +++++++++++++++++----- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'src/junit/com') diff --git a/src/junit/com/jogamp/common/os/TestElfReader01.java b/src/junit/com/jogamp/common/os/TestElfReader01.java index 1f42067..3993fc4 100644 --- a/src/junit/com/jogamp/common/os/TestElfReader01.java +++ b/src/junit/com/jogamp/common/os/TestElfReader01.java @@ -6,6 +6,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.RandomAccessFile; +import java.util.List; import jogamp.common.os.elf.ElfHeader; import jogamp.common.os.elf.Section; @@ -21,28 +22,61 @@ public class TestElfReader01 extends JunitTracer { public static String GNU_LINUX_SELF_EXE = "/proc/self/exe"; public static String ARM_HF_EXE = "tst-exe-armhf"; public static String ARM_SF_EXE = "tst-exe-arm"; + + private static boolean checkFileReadAccess(File file) { + try { + return file.isFile() && file.canRead(); + } catch (Throwable t) { } + return false; + } + static File findJVMLib(String libName) { + ClassLoader cl = TestElfReader01.class.getClassLoader(); + final List possibleLibPaths = NativeLibrary.enumerateLibraryPaths(libName, libName, libName, true, cl); + for(int i=0; i