aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/checkasm.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2023-11-16 17:45:02 +0200
committerRémi Denis-Courmont <remi@remlab.net>2023-11-23 18:57:18 +0200
commit286d6742218ba0235c32876b50bf593cb1986353 (patch)
tree1b27c39c3d4febb16ad79e5b34d2c84d67e6d4de /tests/checkasm/checkasm.c
parent0fa421c8f19109aa26d902d2a33d2f46e57f378b (diff)
downloadffmpeg-286d6742218ba0235c32876b50bf593cb1986353.tar.gz
checkasm: add helper to report a fatal signal
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r--tests/checkasm/checkasm.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 708119e7c6..c67cf58922 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -23,10 +23,8 @@
#include "config.h"
#include "config_components.h"
-#if CONFIG_LINUX_PERF
-# ifndef _GNU_SOURCE
-# define _GNU_SOURCE // for syscall (performance monitoring API)
-# endif
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE // for syscall (performance monitoring API), strsignal()
#endif
#include <stdarg.h>
@@ -863,6 +861,15 @@ void checkasm_fail_func(const char *msg, ...)
}
}
+void checkasm_fail_signal(int signum)
+{
+#ifdef __GLIBC__
+ checkasm_fail_func("fatal signal %d: %s", signum, strsignal(signum));
+#else
+ checkasm_fail_func("fatal signal %d", signum);
+#endif
+}
+
/* Get the benchmark context of the current function */
CheckasmPerf *checkasm_get_perf_context(void)
{