mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-20 12:22:14 +02:00
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.
This commit is contained in:
parent
5da517e689
commit
af116081f9
@ -41,6 +41,8 @@ AC_ARG_ENABLE(unittests,
|
|||||||
AS_HELP_STRING(--disable-unittests, [don't build unit tests for Tor. Risky!]))
|
AS_HELP_STRING(--disable-unittests, [don't build unit tests for Tor. Risky!]))
|
||||||
AC_ARG_ENABLE(coverage,
|
AC_ARG_ENABLE(coverage,
|
||||||
AS_HELP_STRING(--enable-coverage, [enable coverage support in the unit-test build]))
|
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,
|
AC_ARG_ENABLE(system-torrc,
|
||||||
AS_HELP_STRING(--disable-system-torrc, [don't look for a system-wide torrc file]))
|
AS_HELP_STRING(--disable-system-torrc, [don't look for a system-wide torrc file]))
|
||||||
|
|
||||||
|
@ -45,9 +45,10 @@
|
|||||||
#error "Sorry; we don't support building with NDEBUG."
|
#error "Sorry; we don't support building with NDEBUG."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Don't use assertions during coverage. It leads to tons of unreached
|
/* Sometimes we don't want to use assertions during branch coverage tests; it
|
||||||
* branches which in reality are only assertions we didn't hit. */
|
* leads to tons of unreached branches which in reality are only assertions we
|
||||||
#ifdef TOR_COVERAGE
|
* didn't hit. */
|
||||||
|
#if defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)
|
||||||
#define tor_assert(a) STMT_BEGIN \
|
#define tor_assert(a) STMT_BEGIN \
|
||||||
(void)(a); \
|
(void)(a); \
|
||||||
STMT_END
|
STMT_END
|
||||||
|
Loading…
Reference in New Issue
Block a user