diff options
-rw-r--r-- | luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java | 7 | ||||
-rw-r--r-- | luni/src/test/java/org/apache/harmony/luni/tests/java/lang/TestLibrary.java | 50 | ||||
-rwxr-xr-x | luni/src/test/resources/libTestLibrary.so | bin | 5409 -> 0 bytes |
3 files changed, 3 insertions, 54 deletions
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java index 08412d2..9bad94f 100644 --- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java +++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java @@ -1081,10 +1081,9 @@ public class SystemTest extends junit.framework.TestCase { method = "load", args = {java.lang.String.class} ) - @AndroidOnly("No x86 version of this library") public void test_load() { try { - new TestLibrary().checkString(); + Runtime.getRuntime().load("nonExistentLibrary"); fail("UnsatisfiedLinkError was not thrown."); } catch(UnsatisfiedLinkError e) { //expected @@ -1118,7 +1117,7 @@ public class SystemTest extends junit.framework.TestCase { SecurityManager oldSm = System.getSecurityManager(); System.setSecurityManager(sm); try { - System.load("libTestLibrary.so"); + System.load("/nonExistentLibrary.so"); fail("SecurityException should be thrown."); } catch (SecurityException e) { // expected @@ -1162,7 +1161,7 @@ public class SystemTest extends junit.framework.TestCase { SecurityManager oldSm = System.getSecurityManager(); System.setSecurityManager(sm); try { - System.loadLibrary("libTestLibrary.so"); + System.loadLibrary("nonExistentLibrary.so"); fail("SecurityException should be thrown."); } catch (SecurityException e) { // expected diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/TestLibrary.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/TestLibrary.java deleted file mode 100644 index 2748223..0000000 --- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/TestLibrary.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.luni.tests.java.lang; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -class TestLibrary { - private native String printName(); - - boolean checkString() { - if(printName().equals("TestLibrary")) - return true; - return false; - } - - TestLibrary() { - InputStream in = TestLibrary.class.getResourceAsStream("/libTestLibrary.so"); - try { - File tmp = File.createTempFile("libTestLibrary", "so"); - tmp.deleteOnExit(); - FileOutputStream out = new FileOutputStream(tmp); - while (in.available() > 0) { - out.write(in.read()); // slow - } - in.close(); - out.close(); - Runtime.getRuntime().load(tmp.getAbsolutePath()); - } catch (FileNotFoundException e) { - } catch (IOException e) { - } - } -} diff --git a/luni/src/test/resources/libTestLibrary.so b/luni/src/test/resources/libTestLibrary.so Binary files differdeleted file mode 100755 index 81acfd5..0000000 --- a/luni/src/test/resources/libTestLibrary.so +++ /dev/null |