diff --git a/src/core/client.c b/src/core/client.c index 74011f6..682935c 100644 --- a/src/core/client.c +++ b/src/core/client.c @@ -107,6 +107,8 @@ void destroy_client_context(struct client_ctx *ctx) { if (rc < 0) cr_panic("finalizing the worker failed: %s\n", strerror(-rc)); } + sfree(ctx->tstats); + sfree(ctx->sstats); } void destroy_server_context(struct server_ctx *sctx) { @@ -157,7 +159,7 @@ struct client_ctx *add_external_client(struct server_ctx *sctx, char *id) { .category = "external", }, .gstats = sctx->gstats, - .sstats = sctx->extern_sstats, + .sstats = sref(sctx->extern_sstats), }; struct client_ctx *ctx = &kh_value(sctx->clients, k); diff --git a/src/core/runner.c b/src/core/runner.c index 2511c02..1feb226 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -329,16 +329,25 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) cri_proto_close(g_client_socket); cri_proto_close(sock); + int ok = stats->tests_failed == 0; sfree(stats); - return stats->tests_failed == 0; + return ok; } CR_API int criterion_run_all_tests(struct criterion_test_set *set) { +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_DISABLE_ERROR_REPORTING; +#endif + if (criterion_options.pattern) { disable_unmatching(set); } int res = criterion_run_all_tests_impl(set); + +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_ENABLE_ERROR_REPORTING; +#endif return criterion_options.always_succeed || res; } diff --git a/src/core/runner_coroutine.c b/src/core/runner_coroutine.c index 270b8da..0a264e2 100644 --- a/src/core/runner_coroutine.c +++ b/src/core/runner_coroutine.c @@ -215,6 +215,10 @@ static int run_test_child(void) #endif cri_proto_close(g_client_socket); + +#ifndef ENABLE_VALGRIND_ERRORS + VALGRIND_ENABLE_ERROR_REPORTING; +#endif return 0; } @@ -282,6 +286,8 @@ static bxf_instance *run_test(struct run_next_context *ctx, if (rc < 0) cr_panic("Could not spawn test instance: %s", strerror(-rc)); + bxf_context_term(inst_ctx); + *client = (struct client_ctx) { .test = ctx->test, .suite = &ctx->suite_set->suite,