build: Make sure asserts are enabled for tests
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 3 Dec 2013 15:09:57 +0000 (15:09 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 3 Dec 2013 16:08:03 +0000 (17:08 +0100)
Tests depend on assertions being enabled since they can, and do,
contain actual test steps. They are also mandatory for ensuring
sane test case behaviour.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
lib/check-ndebug.h [new file with mode: 0644]
tests/Android.mk
tests/Makefile.am

diff --git a/lib/check-ndebug.h b/lib/check-ndebug.h
new file mode 100644 (file)
index 0000000..68a6ec4
--- /dev/null
@@ -0,0 +1,3 @@
+#ifdef NDEBUG
+#error "Testsuite needs its asserts!"
+#endif
index 1bd3d21..ec64acd 100644 (file)
@@ -40,7 +40,7 @@ define add_test
        $(LIBPCIACCESS_PATH)/include
 
     LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
-    LOCAL_CFLAGS += -DANDROID
+    LOCAL_CFLAGS += -DANDROID -UNDEBUG -include "check-ndebug.h"
     LOCAL_CFLAGS += -std=c99
     # FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
     LOCAL_CFLAGS += -Wno-error=return-type
index 8e293f7..b8cddd5 100644 (file)
@@ -23,6 +23,7 @@ CLEANFILES = $(EXTRA_PROGRAMS)
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
        -I$(srcdir)/.. \
        -I$(srcdir)/../lib \
+       -include "check-ndebug.h" \
        -DIGT_DATADIR=\""$(abs_srcdir)"\" \
        $(NULL)