You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
checkasm: Make checkasm_fail_func return whether we should print verbosely
This makes it easier to implement custom error printouts in tests. This is a port of dav1d's commit 13a7d78655f8747c2cd01e8a48d44dcc7f60a8e5 into ffmpeg's checkasm. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@ -1081,8 +1081,9 @@ int checkasm_bench_func(void)
|
||||
!wildstrcmp(state.current_func->name, state.bench_pattern);
|
||||
}
|
||||
|
||||
/* Indicate that the current test has failed */
|
||||
void checkasm_fail_func(const char *msg, ...)
|
||||
/* Indicate that the current test has failed, return whether verbose printing
|
||||
* is requested. */
|
||||
int checkasm_fail_func(const char *msg, ...)
|
||||
{
|
||||
if (state.current_func_ver && state.current_func_ver->cpu &&
|
||||
state.current_func_ver->ok)
|
||||
@ -1099,6 +1100,7 @@ void checkasm_fail_func(const char *msg, ...)
|
||||
state.current_func_ver->ok = 0;
|
||||
state.num_failed++;
|
||||
}
|
||||
return state.verbose;
|
||||
}
|
||||
|
||||
void checkasm_set_signal_handler_state(int enabled) {
|
||||
@ -1180,8 +1182,7 @@ int checkasm_check_##type(const char *file, int line, \
|
||||
break; \
|
||||
if (y == h) \
|
||||
return 0; \
|
||||
checkasm_fail_func("%s:%d", file, line); \
|
||||
if (!state.verbose) \
|
||||
if (!checkasm_fail_func("%s:%d", file, line)) \
|
||||
return 1; \
|
||||
fprintf(stderr, "%s:\n", name); \
|
||||
while (h--) { \
|
||||
|
@ -152,7 +152,7 @@ struct CheckasmPerf;
|
||||
|
||||
void *checkasm_check_func(void *func, const char *name, ...) av_printf_format(2, 3);
|
||||
int checkasm_bench_func(void);
|
||||
void checkasm_fail_func(const char *msg, ...) av_printf_format(1, 2);
|
||||
int checkasm_fail_func(const char *msg, ...) av_printf_format(1, 2);
|
||||
struct CheckasmPerf *checkasm_get_perf_context(void);
|
||||
void checkasm_report(const char *name, ...) av_printf_format(1, 2);
|
||||
void checkasm_set_signal_handler_state(int enabled);
|
||||
|
Reference in New Issue
Block a user