Merge "Skip JNI Tests for None CPU ABI" into honeycomb-mr1
diff --git a/tests/tests/jni/src/android/jni/cts/InstanceNonce.java b/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
index a5bb01d..e1a7dea 100644
--- a/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
+++ b/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
@@ -22,7 +22,9 @@
  */
 public class InstanceNonce {
     static {
-        System.loadLibrary("jnitest");
+        if (!JniTestCase.isCpuAbiNone()) {
+            System.loadLibrary("jnitest");
+        }
     }
 
     /**
diff --git a/tests/tests/jni/src/android/jni/cts/JniCTest.java b/tests/tests/jni/src/android/jni/cts/JniCTest.java
index 950b534..eb14504 100644
--- a/tests/tests/jni/src/android/jni/cts/JniCTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniCTest.java
@@ -16,16 +16,17 @@
 
 package android.jni.cts;
 
-import junit.framework.TestCase;
 
 /**
  * Basic tests of calling the C functions that make up the JNI. This
  * class merely calls into native code and reports back if there was
  * a problem.
  */
-public class JniCTest extends TestCase {
+public class JniCTest extends JniTestCase {
     static {
-        System.loadLibrary("jnitest");
+        if (!JniTestCase.isCpuAbiNone()) {
+            System.loadLibrary("jnitest");
+        }
     }
 
     /**
diff --git a/tests/tests/jni/src/android/jni/cts/JniCppTest.java b/tests/tests/jni/src/android/jni/cts/JniCppTest.java
index ad4f377..6993b29 100644
--- a/tests/tests/jni/src/android/jni/cts/JniCppTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniCppTest.java
@@ -16,16 +16,17 @@
 
 package android.jni.cts;
 
-import junit.framework.TestCase;
 
 /**
  * Basic tests of calling the C++ functions that make up the JNI. This
  * class merely calls into native code and reports back if there was
  * a problem.
  */
-public class JniCppTest extends TestCase {
+public class JniCppTest extends JniTestCase {
     static {
-        System.loadLibrary("jnitest");
+        if (!JniTestCase.isCpuAbiNone()) {
+            System.loadLibrary("jnitest");
+        }
     }
 
     /**
diff --git a/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java b/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
index a66e072..7c16a3a 100644
--- a/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
@@ -16,14 +16,13 @@
 
 package android.jni.cts;
 
-import junit.framework.TestCase;
 
 /**
  * Basic native instance method tests. The "nonce" class being tested
  * by this class is a class defined in this package that declares the
  * bulk of its methods as native.
  */
-public class JniInstanceTest extends TestCase {
+public class JniInstanceTest extends JniTestCase {
     /** instance to use for all the tests */
     private InstanceNonce target;
 
@@ -165,7 +164,7 @@
     public void test_takeShort() {
         assertTrue(target.takeShort((short) 19991));
     }
-    
+
     /**
      * Test a simple value-taking method call, that returns whether it
      * got the expected value.
diff --git a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
index ff4411d..3036c71 100644
--- a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
@@ -16,14 +16,14 @@
 
 package android.jni.cts;
 
-import junit.framework.TestCase;
 
 /**
  * Basic static method tests. The "nonce" class being tested by this
  * class is a class defined in this package that declares the bulk of
  * its methods as native.
  */
-public class JniStaticTest extends TestCase {
+public class JniStaticTest extends JniTestCase {
+
     /**
      * Test a simple no-op and void-returning method call.
      */
@@ -166,7 +166,7 @@
     public void test_takeShort() {
         assertTrue(StaticNonce.takeShort((short) 19991));
     }
-    
+
     /**
      * Test a simple value-taking method call, that returns whether it
      * got the expected value.
diff --git a/tests/tests/jni/src/android/jni/cts/JniTestCase.java b/tests/tests/jni/src/android/jni/cts/JniTestCase.java
new file mode 100644
index 0000000..a137ff7
--- /dev/null
+++ b/tests/tests/jni/src/android/jni/cts/JniTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 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 android.jni.cts;
+
+import android.os.Build;
+
+import junit.framework.TestCase;
+
+class JniTestCase extends TestCase {
+
+    static boolean isCpuAbiNone() {
+        return "none".equalsIgnoreCase(Build.CPU_ABI);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        // Skip the JNI tests if ABI is none...
+        if (!isCpuAbiNone()) {
+            super.runTest();
+        }
+    }
+}
diff --git a/tests/tests/jni/src/android/jni/cts/StaticNonce.java b/tests/tests/jni/src/android/jni/cts/StaticNonce.java
index f9b3310..c84e899 100644
--- a/tests/tests/jni/src/android/jni/cts/StaticNonce.java
+++ b/tests/tests/jni/src/android/jni/cts/StaticNonce.java
@@ -22,7 +22,9 @@
  */
 public class StaticNonce {
     static {
-        System.loadLibrary("jnitest");
+        if (!JniTestCase.isCpuAbiNone()) {
+            System.loadLibrary("jnitest");
+        }
     }
 
     /**