]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make the no-assertions-during-coverage check into a configure option
authorNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:51:52 +0000 (12:51 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:51:52 +0000 (12:51 -0500)
Closes ticket 18242.

The rationale here is that I like having coverage on by default in my
own working directory, but I always want assertions turned on unless
I'm doing branch coverage specifically.

configure.ac
src/common/util.h

index 1a78f41a30ab6b23de6b672b064437edea307a66..d92f1e66a23796a2bee34ced17d9c743a2584f72 100644 (file)
@@ -41,6 +41,8 @@ AC_ARG_ENABLE(unittests,
    AS_HELP_STRING(--disable-unittests, [don't build unit tests for Tor. Risky!]))
 AC_ARG_ENABLE(coverage,
    AS_HELP_STRING(--enable-coverage, [enable coverage support in the unit-test build]))
+AC_ARG_ENABLE(asserts-in-tests,
+   AS_HELP_STRING(--disable-asserts-in-tests, [disable tor_assert() calls in the unit tests, for branch coverage]))
 AC_ARG_ENABLE(system-torrc,
    AS_HELP_STRING(--disable-system-torrc, [don't look for a system-wide torrc file]))
 
index 165bc0dcb3084debbaa56c4fef7b65f66086b64e..d05ffa7d10df205c58d1817b9da0cd8805e411cf 100644 (file)
 #error "Sorry; we don't support building with NDEBUG."
 #endif
 
-/* Don't use assertions during coverage. It leads to tons of unreached
- * branches which in reality are only assertions we didn't hit. */
-#ifdef TOR_COVERAGE
+/* Sometimes we don't want to use assertions during branch coverage tests; it
+ * leads to tons of unreached branches which in reality are only assertions we
+ * didn't hit. */
+#if defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)
 #define tor_assert(a) STMT_BEGIN                                        \
   (void)(a);                                                            \
   STMT_END