public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: tvrtko.ursulin@linux.intel.com
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH] build: Make sure asserts are enabled for tests
Date: Tue,  3 Dec 2013 15:09:57 +0000	[thread overview]
Message-ID: <1386083397-27634-1-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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>
---
 lib/check-ndebug.h | 3 +++
 tests/Android.mk   | 2 +-
 tests/Makefile.am  | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 lib/check-ndebug.h

diff --git a/lib/check-ndebug.h b/lib/check-ndebug.h
new file mode 100644
index 0000000..68a6ec4
--- /dev/null
+++ b/lib/check-ndebug.h
@@ -0,0 +1,3 @@
+#ifdef NDEBUG
+#error "Testsuite needs its asserts!"
+#endif
diff --git a/tests/Android.mk b/tests/Android.mk
index 1bd3d21..ec64acd 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -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
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8e293f7..b8cddd5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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)
 
-- 
1.8.4.3

             reply	other threads:[~2013-12-03 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 15:09 tvrtko.ursulin [this message]
2013-12-03 16:23 ` [PATCH] build: Make sure asserts are enabled for tests Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386083397-27634-1-git-send-email-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox