OSDN Git Service

More native bridge tests
authorCalin Juravle <calin@google.com>
Wed, 1 Oct 2014 17:57:29 +0000 (18:57 +0100)
committerCalin Juravle <calin@google.com>
Wed, 1 Oct 2014 20:17:50 +0000 (21:17 +0100)
Test for os.arch.

Bug: 17713104

(cherry picked from commit ba16b0796aafb6ad4c96c5e10b713d73edc0b857)

Change-Id: I45bde49c778f176cdfc779b211053a2747adb3fc

test/115-native-bridge/src/NativeBridgeMain.java

index a531f92..2405627 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 import java.lang.reflect.Method;
+import java.lang.System;
 
 // This is named Main as it is a copy of JniTest, so that we can re-use the native implementations
 // from libarttest.
@@ -29,6 +30,7 @@ class Main {
         testShortMethod();
         testBooleanMethod();
         testCharMethod();
+        testEnvironment();
     }
 
     public static native void testFindClassOnAttachedNativeThread();
@@ -147,6 +149,24 @@ class Main {
         }
       }
     }
+
+    private static void testEnvironment() {
+      String osArch = System.getProperty("os.arch");
+      if (!"os.arch".equals(osArch)) {
+        throw new AssertionError("unexpected value for os.arch: " + osArch);
+      }
+      // TODO: improve the build script to get these running as well.
+      // if (!"cpu_abi".equals(Build.CPU_ABI)) {
+      //   throw new AssertionError("unexpected value for cpu_abi");
+      // }
+      // if (!"cpu_abi2".equals(Build.CPU_ABI2)) {
+      //   throw new AssertionError("unexpected value for cpu_abi2");
+      // }
+      // String[] expectedSupportedAbis = {"supported1", "supported2", "supported3"};
+      // if (Arrays.equals(expectedSupportedAbis, Build.SUPPORTED_ABIS)) {
+      //   throw new AssertionError("unexpected value for supported_abis");
+      // }
+    }
 }
 
 public class NativeBridgeMain {