summaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
authorDerek Morton <derek.j.morton@intel.com>2015-05-26 15:19:17 +0100
committerThomas Wood <thomas.wood@intel.com>2015-05-27 16:17:05 +0100
commit88c9a82318bae6bf97e55bf1a28018708aca2200 (patch)
treee5e2f585d91f68004e27338083907dbf2e3b7887 /lib/tests
parentf2a5896bdddc595489a61cb0e0051de8d43a2591 (diff)
lib: Enable building unit tests on android
Add a make file for android so the unit tests can be built. Enabled asserts for the library code so the unit test behaviour is correct. Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/Android.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/tests/Android.mk b/lib/tests/Android.mk
new file mode 100644
index 00000000..7ad03004
--- /dev/null
+++ b/lib/tests/Android.mk
@@ -0,0 +1,41 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+#================#
+# each igt test is a separate executable. define a function to build one of these tests
+define add_test
+ include $(CLEAR_VARS)
+
+ # specific to this test
+ LOCAL_SRC_FILES := $1.c
+ LOCAL_MODULE := $1
+
+ # common to all tests
+ LOCAL_CFLAGS += ${IGT_LOCAL_CFLAGS}
+ LOCAL_C_INCLUDES = ${IGT_LOCAL_C_INCLUDES}
+ LOCAL_STATIC_LIBRARIES := ${IGT_LOCAL_STATIC_LIBRARIES}
+ LOCAL_SHARED_LIBRARIES := ${IGT_LOCAL_SHARED_LIBRARIES}
+
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_PATH := $(ANDROID_PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)/intel/validation/core/igt
+
+ include $(BUILD_EXECUTABLE)
+endef
+
+# set local compilation flags for IGT tests
+IGT_LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM -DANDROID -UNDEBUG
+IGT_LOCAL_CFLAGS += -std=gnu99
+# FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
+IGT_LOCAL_CFLAGS += -Wno-error=return-type
+
+# set local includes
+IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
+IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
+
+# set local libraries
+IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
+IGT_LOCAL_SHARED_LIBRARIES := libpciaccess libdrm libdrm_intel
+
+$(foreach item,$(check_PROGRAMS),$(eval $(call add_test,$(item))))
+