Skip to content
Snippets Groups Projects
Commit ea9c5afa authored by Martin Storsjö's avatar Martin Storsjö
Browse files

checkasm: Validate the benchmark call configurations even if not benchmarking

This should help catch issues like the one fixed in
185194be, 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.
parent 5c5860ab
No related branches found
No related tags found
No related merge requests found
Pipeline #105402 passed with stages
in 10 minutes and 27 seconds
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment