diff --git a/CMakeLists.txt b/CMakeLists.txt index d3c65a7..09923a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,9 +51,14 @@ endif() # Setup coveralls -option(CTESTS "Turn on the samples and test" OFF) option(COVERALLS "Turn on coveralls support" OFF) option(COVERALLS_UPLOAD "Upload the generated coveralls json" ON) +option(DEV_BUILD "Compile in developer mode" OFF) +option(CTESTS "Turn on the samples and test" ${DEV_BUILD}) + +if (DEV_BUILD) + set(ENABLE_VALGRIND_ERRORS 1) +endif () if (COVERALLS) include(Coveralls) diff --git a/src/config.h.in b/src/config.h.in index 5928b0b..fef0a5c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -3,6 +3,7 @@ #cmakedefine ENABLE_NLS @ENABLE_NLS@ #cmakedefine HAVE_PCRE @HAVE_PCRE@ +#cmakedefine ENABLE_VALGRIND_ERRORS @ENABLE_VALGRIND_ERRORS@ # define LOCALEDIR "${LOCALEDIR}" # define PACKAGE "${PROJECT_NAME}" diff --git a/src/core/runner.c b/src/core/runner.c index f0ae80b..92fdb5f 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -158,6 +158,10 @@ struct criterion_test_set *criterion_init(void) { void run_test_child(struct criterion_test *test, struct criterion_suite *suite) { +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_ENABLE_ERROR_REPORTING; +#endif + if (suite->data && suite->data->timeout != 0 && test->data->timeout == 0) setup_timeout((uint64_t) (suite->data->timeout * 1e9)); else if (test->data->timeout != 0) @@ -335,6 +339,9 @@ void disable_unmatching(struct criterion_test_set *set) { struct criterion_test_set *criterion_initialize(void) { init_i18n(); +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_DISABLE_ERROR_REPORTING; +#endif if (RUNNING_ON_VALGRIND) { criterion_options.no_early_exit = 1; criterion_options.jobs = 1; @@ -348,6 +355,10 @@ struct criterion_test_set *criterion_initialize(void) { void criterion_finalize(struct criterion_test_set *set) { sfree(set); + +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_ENABLE_ERROR_REPORTING; +#endif } static void run_tests_async(struct criterion_test_set *set,