Commits

Anonymous committed 70ca5e5

Add library test makefile solutions.

Change-Id: Ibc8df9b0e2342683158936bf011425780df8f02a

  • Participants
  • Parent commits a77456b

Comments (0)

Files changed (9)

File core/config.mk

 BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
 BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
 BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
+
+BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk
+BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk
+BUILD_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/static_test_lib.mk
+BUILD_HOST_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/host_static_test_lib.mk
+
 BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
 BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
 BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk

File core/host_native_test.mk

 ## Common flags for host native tests are added.
 ################################################
 
-LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
-LOCAL_C_INCLUDES +=  \
-    external/gtest/include
-
-LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
-LOCAL_SHARED_LIBRARIES +=
-
-LOCAL_LDFLAGS += -lpthread
+include $(BUILD_SYSTEM)/host_test_internal.mk
 
 include $(BUILD_HOST_EXECUTABLE)

File core/host_shared_test_lib.mk

+##################################################
+## A thin wrapper around BUILD_HOST_SHARED_LIBRARY
+## Common flags for host native tests are added.
+##################################################
+
+include $(BUILD_SYSTEM)/host_test_internal.mk
+
+include $(BUILD_HOST_SHARED_LIBRARY)

File core/host_static_test_lib.mk

+##################################################
+## A thin wrapper around BUILD_HOST_STATIC_LIBRARY
+## Common flags for host native tests are added.
+##################################################
+
+include $(BUILD_SYSTEM)/host_test_internal.mk
+
+include $(BUILD_HOST_STATIC_LIBRARY)

File core/host_test_internal.mk

+#####################################################
+## Shared definitions for all host test compilations.
+#####################################################
+
+LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
+LOCAL_C_INCLUDES +=  external/gtest/include
+
+LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
+LOCAL_SHARED_LIBRARIES +=
+
+LOCAL_LDLIBS += -lpthread

File core/native_test.mk

 ## Common flags for native tests are added.
 ###########################################
 
-LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING
-
-LOCAL_C_INCLUDES += external/gtest/include
-LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
-
-ifndef LOCAL_SDK_VERSION
-LOCAL_C_INCLUDES += bionic \
-                    bionic/libstdc++/include \
-                    external/stlport/stlport
-LOCAL_SHARED_LIBRARIES += libstlport
-endif
-
-ifndef LOCAL_MODULE_PATH
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-endif
+include $(BUILD_SYSTEM)/target_test_internal.mk
 
 include $(BUILD_EXECUTABLE)

File core/shared_test_lib.mk

+#############################################
+## A thin wrapper around BUILD_SHARED_LIBRARY
+## Common flags for native tests are added.
+#############################################
+
+include $(BUILD_SYSTEM)/target_test_internal.mk
+
+include $(BUILD_SHARED_LIBRARY)

File core/static_test_lib.mk

+#############################################
+## A thin wrapper around BUILD_STATIC_LIBRARY
+## Common flags for native tests are added.
+#############################################
+
+include $(BUILD_SYSTEM)/target_test_internal.mk
+
+include $(BUILD_STATIC_LIBRARY)

File core/target_test_internal.mk

+#######################################################
+## Shared definitions for all target test compilations.
+#######################################################
+
+LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING
+
+LOCAL_C_INCLUDES += external/gtest/include
+LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
+
+ifndef LOCAL_SDK_VERSION
+LOCAL_C_INCLUDES += bionic \
+                    bionic/libstdc++/include \
+                    external/stlport/stlport
+LOCAL_SHARED_LIBRARIES += libstlport
+endif
+
+ifndef LOCAL_MODULE_PATH
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+endif