Merge branch 'tor-github/pr/1047'

This commit is contained in:
David Goulet
2019-05-28 14:59:07 -04:00
5 changed files with 41 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
o Minor features (testing):
- When running tests in coverage mode, take additional care to make
our coverage deterministic, so that we can accurately track changes in
code coverage. Closes ticket 30519.
+3
View File
@@ -25,6 +25,9 @@ else
fi
if test "$run" = 1; then
# same seed as in travis.yml
TOR_TEST_RNG_SEED="636f766572616765"
export TOR_TEST_RNG_SEED
while true; do
make reset-gcov
CD=coverage-raw/coverage-$(date +%s)
+6
View File
@@ -194,6 +194,11 @@ void tor_log_get_logfile_names(struct smartlist_t *out);
extern int log_global_min_severity_;
#ifdef TOR_COVERAGE
/* For coverage builds, we try to avoid our log_debug optimization, since it
* can have weird effects on internal macro coverage. */
#define debug_logging_enabled() (1)
#else
static inline bool debug_logging_enabled(void);
/**
* Return true iff debug logging is enabled for at least one domain.
@@ -202,6 +207,7 @@ static inline bool debug_logging_enabled(void)
{
return PREDICT_UNLIKELY(log_global_min_severity_ == LOG_DEBUG);
}
#endif
void log_fn_(int severity, log_domain_mask_t domain,
const char *funcname, const char *format, ...)
+21
View File
@@ -20,6 +20,27 @@
#include <sys/time.h>
#endif
#ifdef TOR_COVERAGE
/* For coverage builds, we use a slower definition of these macros without
* branches, to make coverage consistent. */
#undef timeradd
#undef timersub
#define timeradd(tv1,tv2,tvout) \
do { \
(tvout)->tv_sec = (tv1)->tv_sec + (tv2)->tv_sec; \
(tvout)->tv_usec = (tv1)->tv_usec + (tv2)->tv_usec; \
(tvout)->tv_sec += (tvout)->tv_usec / 1000000; \
(tvout)->tv_usec %= 1000000; \
} while (0)
#define timersub(tv1,tv2,tvout) \
do { \
(tvout)->tv_sec = (tv1)->tv_sec - (tv2)->tv_sec - 1; \
(tvout)->tv_usec = (tv1)->tv_usec - (tv2)->tv_usec + 1000000; \
(tvout)->tv_sec += (tvout)->tv_usec / 1000000; \
(tvout)->tv_usec %= 1000000; \
} while (0)
#endif
#ifndef timeradd
/** Replacement for timeradd on platforms that do not have it: sets tvout to
* the sum of tv1 and tv2. */
+7
View File
@@ -32,8 +32,15 @@ endif
if USEPYTHON
TESTSCRIPTS += src/test/test_ntor.sh src/test/test_hs_ntor.sh src/test/test_bt.sh
if COVERAGE_ENABLED
# ...
else
# Only do this when coverage is not on, since it invokes lots of code
# in a kind of unpredictable way.
TESTSCRIPTS += src/test/test_rebind.sh
endif
endif
TESTS += src/test/test src/test/test-slow src/test/test-memwipe \
src/test/test_workqueue \