summaryrefslogtreecommitdiffstats
path: root/NativeCode.mk
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2013-01-28 12:31:22 -0800
committerKenny Root <kroot@google.com>2013-01-28 14:35:16 -0800
commit6914efca8fe737a753d234d7e91222da6a8cdabe (patch)
treea07d9087afea0436428c728684f2c9526d6210a2 /NativeCode.mk
parent778d993a4af1077e38e3d9f8afc07c47594f9714 (diff)
downloadlibcore-6914efca8fe737a753d234d7e91222da6a8cdabe.zip
libcore-6914efca8fe737a753d234d7e91222da6a8cdabe.tar.gz
libcore-6914efca8fe737a753d234d7e91222da6a8cdabe.tar.bz2
NativeCrypto: add test base for OpenSSL ENGINEs
This sets up some of the testing infrastructure to allow us to test all the ENGINE-related test paths in the NativeCrypto code. Change-Id: I21f3dbebbaa90327d48a99020ae3a3e90624cc75
Diffstat (limited to 'NativeCode.mk')
-rw-r--r--NativeCode.mk66
1 files changed, 66 insertions, 0 deletions
diff --git a/NativeCode.mk b/NativeCode.mk
index 1aab901..8878c96 100644
--- a/NativeCode.mk
+++ b/NativeCode.mk
@@ -51,6 +51,30 @@ endef
# we aren't quite defining a new rule yet, to make sure that the
# sub.mk files don't see anything stray from the last rule that was
# set up.
+
+# Set up the test library first
+ifeq ($(LIBCORE_SKIP_TESTS),)
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(core_magic_local_target)
+core_src_files :=
+
+# Include the sub.mk files.
+$(foreach dir, \
+ luni/src/test/native, \
+ $(eval $(call include-core-native-dir,$(dir))))
+
+# This is for the test library, so rename the variable.
+test_src_files := $(core_src_files)
+core_src_files :=
+
+# Extract out the allowed LOCAL_* variables. Note: $(sort) also
+# removes duplicates.
+test_c_includes := $(sort libcore/include $(LOCAL_C_INCLUDES) $(JNI_H_INCLUDE))
+test_shared_libraries := $(sort $(LOCAL_SHARED_LIBRARIES))
+test_static_libraries := $(sort $(LOCAL_STATIC_LIBRARIES))
+endif # LIBCORE_SKIP_TESTS
+
+
include $(CLEAR_VARS)
LOCAL_MODULE := $(core_magic_local_target)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk
@@ -96,6 +120,32 @@ LOCAL_SHARED_LIBRARIES += libstlport
include $(BUILD_SHARED_LIBRARY)
+
+# Test library
+ifeq ($(LIBCORE_SKIP_TESTS),)
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS += -Wall -Wextra -Werror
+LOCAL_CFLAGS += $(core_cflags)
+LOCAL_CPPFLAGS += $(core_cppflags)
+ifeq ($(TARGET_ARCH),arm)
+# Ignore "note: the mangling of 'va_list' has changed in GCC 4.4"
+LOCAL_CFLAGS += -Wno-psabi
+endif
+
+# Define the rules.
+LOCAL_SRC_FILES := $(test_src_files)
+LOCAL_C_INCLUDES := $(test_c_includes)
+LOCAL_SHARED_LIBRARIES := $(test_shared_libraries)
+LOCAL_STATIC_LIBRARIES := $(test_static_libraries)
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := libjavacore-test
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk
+
+include $(BUILD_SHARED_LIBRARY)
+endif # LIBCORE_SKIP_TESTS
+
+
#
# Build for the host.
#
@@ -114,4 +164,20 @@ ifeq ($(WITH_HOST_DALVIK),true)
LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libexpat libicuuc libicui18n libssl libcrypto libz-host
LOCAL_STATIC_LIBRARIES := $(core_static_libraries)
include $(BUILD_HOST_SHARED_LIBRARY)
+
+ ifeq ($(LIBCORE_SKIP_TESTS),)
+ include $(CLEAR_VARS)
+ # Define the rules.
+ LOCAL_SRC_FILES := $(test_src_files)
+ LOCAL_CFLAGS += $(core_cflags)
+ LOCAL_C_INCLUDES := $(test_c_includes)
+ LOCAL_CPPFLAGS += $(core_cppflags)
+ LOCAL_LDLIBS += -ldl -lpthread
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE := libjavacore-test
+ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk
+ LOCAL_SHARED_LIBRARIES := $(test_shared_libraries)
+ LOCAL_STATIC_LIBRARIES := $(test_static_libraries)
+ include $(BUILD_HOST_SHARED_LIBRARY)
+ endif # LIBCORE_SKIP_TESTS
endif