aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/checkasm.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2025-03-22 00:47:01 +0200
committerMartin Storsjö <martin@martin.st>2025-04-01 18:34:48 +0300
commit37c664a2533b2c53beda450899c1a06ac37637ec (patch)
treeb87ac51edc554f9cfecf93bb9c98840be2bec853 /tests/checkasm/checkasm.c
parent4db571e5164c10c3745c098227495c376e66e025 (diff)
downloadffmpeg-37c664a2533b2c53beda450899c1a06ac37637ec.tar.gz
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>
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r--tests/checkasm/checkasm.c9
1 files changed, 5 insertions, 4 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--) { \