summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukesh Agrawal <quiche@google.com>2016-11-15 00:03:34 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-15 00:03:34 +0000
commitf6a4a2a23bf0e5f12bbb5cb0e233b166f79bbb1b (patch)
treef2fbd84d8df2166624cad315511d69687d85a219
parent766aa0b7e8d3ffe5e2f2258f5cc78e9f4c1efe81 (diff)
parent9736842836e9a101bf1416feebacf4621971f98e (diff)
downloadwifilogd-f6a4a2a23bf0e5f12bbb5cb0e233b166f79bbb1b.tar.gz
Merge "add host unit tests" am: 613f0dfb7e
am: 9736842836 Change-Id: If787779260cf5b3fbd7d5e5fa72ae5b9067b31ee
-rw-r--r--Android.mk53
-rwxr-xr-xruntests.sh4
2 files changed, 39 insertions, 18 deletions
diff --git a/Android.mk b/Android.mk
index ed5ec0a..371fa69 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,6 +19,23 @@ wifilogd_gtest_cpp_flags := -Wno-undef -Wno-missing-noreturn \
-Wno-shift-sign-overflow -Wno-used-but-marked-unused -Wno-deprecated \
-Wno-weak-vtables -Wno-sign-conversion -Wno-global-constructors \
-Wno-covered-switch-default
+wifilogd_src_files := \
+ command_processor.cpp \
+ memory_reader.cpp \
+ message_buffer.cpp \
+ os.cpp \
+ raw_os.cpp
+wifilogd_test_src_files := \
+ tests/byte_buffer_unittest.cpp \
+ tests/command_processor_unittest.cpp \
+ tests/local_utils_unittest.cpp \
+ tests/main.cpp \
+ tests/memory_reader_unittest.cpp \
+ tests/message_buffer_unittest.cpp \
+ tests/mock_os.cpp \
+ tests/mock_raw_os.cpp \
+ tests/os_unittest.cpp \
+ tests/protocol_unittest.cpp
wifilogd_parent_dir := $(LOCAL_PATH)/../
wifilogd_includes := \
@@ -31,12 +48,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libwifilogd
LOCAL_CPPFLAGS := $(wifilogd_cpp_flags)
LOCAL_C_INCLUDES := $(wifilogd_includes)
-LOCAL_SRC_FILES := \
- command_processor.cpp \
- memory_reader.cpp \
- message_buffer.cpp \
- os.cpp \
- raw_os.cpp
+LOCAL_SRC_FILES := $(wifilogd_src_files)
LOCAL_SHARED_LIBRARIES := \
libbase \
liblog
@@ -49,17 +61,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := wifilogd_unit_test
LOCAL_CPPFLAGS := $(wifilogd_cpp_flags) $(wifilogd_gtest_cpp_flags)
LOCAL_C_INCLUDES := $(wifilogd_includes)
-LOCAL_SRC_FILES := \
- tests/byte_buffer_unittest.cpp \
- tests/command_processor_unittest.cpp \
- tests/local_utils_unittest.cpp \
- tests/main.cpp \
- tests/memory_reader_unittest.cpp \
- tests/message_buffer_unittest.cpp \
- tests/mock_os.cpp \
- tests/mock_raw_os.cpp \
- tests/os_unittest.cpp \
- tests/protocol_unittest.cpp
+LOCAL_SRC_FILES := $(wifilogd_test_src_files)
LOCAL_STATIC_LIBRARIES := \
libgmock \
libgtest \
@@ -68,3 +70,20 @@ LOCAL_SHARED_LIBRARIES := \
libbase \
liblog
include $(BUILD_NATIVE_TEST)
+
+###
+### wifilogd host unit tests.
+###
+include $(CLEAR_VARS)
+LOCAL_MODULE := wifilogd_host_unit_test
+LOCAL_CPPFLAGS := $(wifilogd_cpp_flags) $(wifilogd_gtest_cpp_flags)
+LOCAL_C_INCLUDES := $(wifilogd_includes)
+LOCAL_SRC_FILES := $(wifilogd_src_files) $(wifilogd_test_src_files)
+LOCAL_STATIC_LIBRARIES := \
+ libgmock \
+ libgtest
+LOCAL_SHARED_LIBRARIES := \
+ libbase \
+ liblog
+LOCAL_LDLIBS := -lrt
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/runtests.sh b/runtests.sh
index 9d6701a..1551a44 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -30,10 +30,12 @@ make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk \
set -x # print commands
+$ANDROID_HOST_OUT/nativetest/wifilogd_host_unit_test/wifilogd_host_unit_test
+$ANDROID_HOST_OUT/nativetest64/wifilogd_host_unit_test/wifilogd_host_unit_test
+
adb root
adb wait-for-device
adb remount
adb sync
-
adb shell /data/nativetest/wifilogd_unit_test/wifilogd_unit_test
adb shell /data/nativetest64/wifilogd_unit_test/wifilogd_unit_test