[FFmpeg-devel] [PATCH 1/4] checkasm: Make checkasm_fail_func return whether we should print verbosely
Martin Storsjö
martin at martin.st
Wed Mar 26 12:30:12 EET 2025
This makes it easier to implement custom error printouts in tests.
This is a port of dav1d's commit
13a7d78655f8747c2cd01e8a48d44dcc7f60a8e5 into ffmpeg's checkasm.
---
tests/checkasm/checkasm.c | 9 +++++----
tests/checkasm/checkasm.h | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 14742081ca..c6d641c52b 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -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--) { \
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 75c81317ba..852d6fca64 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.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);
--
2.39.5 (Apple Git-154)
More information about the ffmpeg-devel
mailing list