]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix the --disable-asserts-in-tests configure option
authorSebastian Hahn <sebastian@torproject.org>
Fri, 5 Feb 2016 13:40:07 +0000 (14:40 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Fri, 5 Feb 2016 13:40:07 +0000 (14:40 +0100)
Makefile.am
configure.ac
src/test/test_rendcache.c

index fc9f7b27ba75dd62d31e22ae1244ad1826c76fff..1333f368ad9735eeac4147f18e3e183fba68f4dd 100644 (file)
@@ -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=
index d92f1e66a23796a2bee34ced17d9c743a2584f72..25d63c9ce680b70c2b8974098d057d48a74fc9a0 100644 (file)
@@ -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";
index 77796994b421604e3b26cbafad2b1439de42e672..7e04799db2dae2fdf2a82ca4c896284040c051ae 100644 (file)
@@ -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);