diff options
author | Martin Storsjö <martin@martin.st> | 2021-06-10 15:19:26 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-06-10 15:19:26 +0300 |
commit | ea9c5afaf490778f8aef2042dfd21341654d153c (patch) | |
tree | 80500b6d4ade9b3ea26e332e3aa04224ed025ca3 /tests | |
parent | 5c5860ab125123d89294e6134c924df5f2630575 (diff) |
checkasm: Validate the benchmark call configurations even if not benchmarking
This should help catch issues like the one fixed in
185194be2f4daf907c76ad8fdd763a701d3d4005, by making sure that we
call the benchmarked function at least once with the given parameters,
even if not benchmarking. Otherwise the benchmark codepath is
essentially dead untested code until somebody works on that piece
of code.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkasm/checkasm.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 0871130..0d6307d 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -282,9 +282,9 @@ void checkasm_stack_clobber(uint64_t clobber, ...); #ifdef readtime #define bench_new(...)\ do {\ + func_type *tfunc = func_new;\ + checkasm_set_signal_handler_state(1);\ if (checkasm_bench_func()) {\ - checkasm_set_signal_handler_state(1);\ - func_type *tfunc = func_new;\ uint64_t tsum = 0;\ int tcount = 0;\ for (int ti = 0; ti < BENCH_RUNS; ti++) {\ @@ -299,9 +299,11 @@ void checkasm_stack_clobber(uint64_t clobber, ...); tcount++;\ }\ }\ - checkasm_set_signal_handler_state(0);\ checkasm_update_bench(tcount, tsum);\ + } else {\ + tfunc(__VA_ARGS__);\ }\ + checkasm_set_signal_handler_state(0);\ } while (0) #else #define bench_new(...) do {} while (0) |