[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Make the no-assertions-during-coverage check into a configure option
commit af116081f9d30d0830dc3c099c9c87f37b07d1f0
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Feb 4 12:51:52 2016 -0500
Make the no-assertions-during-coverage check into a configure option
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 | 2 ++
src/common/util.h | 7 ++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1a78f41..d92f1e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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]))
diff --git a/src/common/util.h b/src/common/util.h
index 165bc0d..d05ffa7 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -45,9 +45,10 @@
#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
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits