[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fix the --disable-asserts-in-tests configure option
commit 55d6fd27cbe6f058a1f444f47f05c7b64891655e
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Fri Feb 5 14:40:07 2016 +0100
Fix the --disable-asserts-in-tests configure option
---
Makefile.am | 4 ++++
configure.ac | 6 ++++++
src/test/test_rendcache.c | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index fc9f7b2..1333f36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,7 +42,11 @@ EXTRA_DIST+= \
if COVERAGE_ENABLED
TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
+if DISABLE_ASSERTS_IN_UNIT_TESTS
+TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE -DDISABLE_ASSERTS_IN_UNIT_TESTS
+else
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE
+endif
TEST_NETWORK_FLAGS=--coverage --hs-multi-client 1
else
TEST_CFLAGS=
diff --git a/configure.ac b/configure.ac
index d92f1e6..25d63c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,8 +46,14 @@ AC_ARG_ENABLE(asserts-in-tests,
AC_ARG_ENABLE(system-torrc,
AS_HELP_STRING(--disable-system-torrc, [don't look for a system-wide torrc file]))
+if test x$enable_coverage != xyes -a x$enable_asserts_in_tests = xno ; then
+ AC_MSG_ERROR([Can't disable assertions outside of coverage build])
+fi
+
+
AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno)
AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes)
+AM_CONDITIONAL(DISABLE_ASSERTS_IN_UNIT_TESTS, test x$enable_asserts_in_tests = xno)
if test "$enable_static_tor" = "yes"; then
enable_static_libevent="yes";
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 7779699..7e04799 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -128,8 +128,8 @@ test_rend_cache_store_v2_desc_as_client(void *data)
// Test bad base32 failure
// This causes an assertion failure if we're running with assertions.
- // But when doing coverage, we can test it.
-#ifdef TOR_COVERAGE
+ // But when building without asserts, we can test it.
+#ifdef DISABLE_ASSERTS_IN_UNIT_TESTS
ret = rend_cache_store_v2_desc_as_client(desc_holder->desc_str,
"!xqunszqnaolrrfmtzgaki7mxelgvkj", mock_rend_query, NULL);
tt_int_op(ret, OP_EQ, RCS_BADDESC);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits