From patchwork Tue May 26 14:19:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Morton X-Patchwork-Id: 6482031 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3AC3CC0020 for ; Tue, 26 May 2015 14:20:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FD9D20624 for ; Tue, 26 May 2015 14:20:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B538B20621 for ; Tue, 26 May 2015 14:20:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B20536E305; Tue, 26 May 2015 07:20:03 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 448C46E305 for ; Tue, 26 May 2015 07:20:02 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 26 May 2015 07:19:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,498,1427785200"; d="scan'208";a="731833639" Received: from djmorton-linux.isw.intel.com ([10.102.226.153]) by fmsmga002.fm.intel.com with ESMTP; 26 May 2015 07:19:22 -0700 From: Derek Morton To: intel-gfx@lists.freedesktop.org Date: Tue, 26 May 2015 15:19:17 +0100 Message-Id: <1432649957-6722-1-git-send-email-derek.j.morton@intel.com> X-Mailer: git-send-email 1.9.1 Cc: thomas.wood@intel.com Subject: [Intel-gfx] [PATCH i-g-t] lib: Enable building unit tests on android X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- lib/Android.mk | 4 +++- lib/tests/Android.mk | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 lib/tests/Android.mk diff --git a/lib/Android.mk b/lib/Android.mk index 1a7cf33..badec1e 100644 --- a/lib/Android.mk +++ b/lib/Android.mk @@ -25,7 +25,7 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM LOCAL_CFLAGS += -DANDROID -DHAVE_LINUX_KD_H -LOCAL_CFLAGS += -std=gnu99 +LOCAL_CFLAGS += -std=gnu99 -UNDEBUG LOCAL_MODULE:= libintel_gpu_tools LOCAL_SHARED_LIBRARIES := libpciaccess \ @@ -48,3 +48,5 @@ LOCAL_SRC_FILES := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES)) include $(BUILD_STATIC_LIBRARY) +include $(call first-makefiles-under, $(LOCAL_PATH)) + diff --git a/lib/tests/Android.mk b/lib/tests/Android.mk new file mode 100644 index 0000000..7ad0300 --- /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)))) +