public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] build: Make sure asserts are enabled for tests
@ 2013-12-03 15:09 tvrtko.ursulin
  2013-12-03 16:23 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: tvrtko.ursulin @ 2013-12-03 15:09 UTC (permalink / raw)
  To: Intel-gfx

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] build: Make sure asserts are enabled for tests
  2013-12-03 15:09 [PATCH] build: Make sure asserts are enabled for tests tvrtko.ursulin
@ 2013-12-03 16:23 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2013-12-03 16:23 UTC (permalink / raw)
  To: tvrtko.ursulin; +Cc: Intel-gfx

On Tue, Dec 03, 2013 at 03:09:57PM +0000, tvrtko.ursulin@linux.intel.com wrote:
> 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>

Merged, thanks for the patch.
-Daniel

> ---
>  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
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-03 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 15:09 [PATCH] build: Make sure asserts are enabled for tests tvrtko.ursulin
2013-12-03 16:23 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox