Merge "Support multi-ABI in tests."
This commit is contained in:
committed by
Android (Google) Code Review
commit
18bac4c2da
@@ -35,7 +35,6 @@ include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
LOCAL_MODULE := DexLoggerNativeTestLibrary
|
||||
LOCAL_MULTILIB := first
|
||||
LOCAL_SRC_FILES := src/cpp/com_android_dcl_Jni.cpp
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(JNI_H_INCLUDE)
|
||||
@@ -44,8 +43,6 @@ LOCAL_NDK_STL_VARIANT := c++_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
dexloggertest_so := $(LOCAL_BUILT_MODULE)
|
||||
|
||||
# And a standalone native executable that we can exec.
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -73,11 +70,15 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android-support-test \
|
||||
truth-prebuilt \
|
||||
|
||||
# Include both versions of the .so if we have 2 arch
|
||||
LOCAL_MULTILIB := both
|
||||
LOCAL_JNI_SHARED_LIBRARIES := \
|
||||
DexLoggerNativeTestLibrary \
|
||||
|
||||
# This gets us the javalib.jar built by DexLoggerTestLibrary above as well as the various
|
||||
# native binaries.
|
||||
LOCAL_JAVA_RESOURCE_FILES := \
|
||||
$(dexloggertest_jar) \
|
||||
$(dexloggertest_so) \
|
||||
$(dexloggertest_executable)
|
||||
$(dexloggertest_executable) \
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertWithMessage;
|
||||
|
||||
import android.app.UiAutomation;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.SystemClock;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
@@ -147,7 +148,7 @@ public final class DexLoggerIntegrationTests {
|
||||
String expectedNameHash =
|
||||
"996223BAD4B4FE75C57A3DEC61DB9C0B38E0A7AD479FC95F33494F4BC55A0F0E";
|
||||
String expectedContentHash =
|
||||
copyAndHashResource("/DexLoggerNativeTestLibrary.so", privateCopyFile);
|
||||
copyAndHashResource(libraryPath("DexLoggerNativeTestLibrary.so"), privateCopyFile);
|
||||
|
||||
System.load(privateCopyFile.toString());
|
||||
|
||||
@@ -170,7 +171,7 @@ public final class DexLoggerIntegrationTests {
|
||||
String expectedNameHash =
|
||||
"8C39990C560B4F36F83E208E279F678746FE23A790E4C50F92686584EA2041CA";
|
||||
String expectedContentHash =
|
||||
copyAndHashResource("/DexLoggerNativeTestLibrary.so", privateCopyFile);
|
||||
copyAndHashResource(libraryPath("DexLoggerNativeTestLibrary.so"), privateCopyFile);
|
||||
|
||||
System.load(privateCopyFile.toString());
|
||||
|
||||
@@ -307,6 +308,12 @@ public final class DexLoggerIntegrationTests {
|
||||
return new File(sContext.getDir("dcl", Context.MODE_PRIVATE), name);
|
||||
}
|
||||
|
||||
private String libraryPath(final String libraryName) {
|
||||
// This may be deprecated. but it tells us the ABI of this process which is exactly what we
|
||||
// want.
|
||||
return "/lib/" + Build.CPU_ABI + "/" + libraryName;
|
||||
}
|
||||
|
||||
private static String copyAndHashResource(String resourcePath, File copyTo) throws Exception {
|
||||
MessageDigest hasher = MessageDigest.getInstance("SHA-256");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user