aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/checkasm.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2023-07-12 22:48:53 +0300
committerRémi Denis-Courmont <remi@remlab.net>2023-11-23 19:04:07 +0200
commit7212466e735aa187d82f51dadbce957fe3da77f0 (patch)
tree1b33d3ea67fd8493389ec244824520029323767c /tests/checkasm/checkasm.c
parent286d6742218ba0235c32876b50bf593cb1986353 (diff)
downloadffmpeg-7212466e735aa187d82f51dadbce957fe3da77f0.tar.gz
checkasm/riscv: report an error upon SIGILL
Terminating the whole checkasm process is not very helpful. This will report if an illegal instruction occurs while executing a tested function. This is a common occurrence whilst developping RISC-V assembler, due to the compatibility between vector configuration and instruction done at run-time.
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r--tests/checkasm/checkasm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index c67cf58922..a15e801caf 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -27,6 +27,7 @@
# define _GNU_SOURCE // for syscall (performance monitoring API), strsignal()
#endif
+#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -734,6 +735,14 @@ int main(int argc, char *argv[])
if (have_vfp(av_get_cpu_flags()) || have_neon(av_get_cpu_flags()))
checkasm_checked_call = checkasm_checked_call_vfp;
#endif
+#if ARCH_RISCV
+ struct sigaction act = {
+ .sa_handler = checkasm_handle_signal,
+ .sa_flags = 0,
+ };
+
+ sigaction(SIGILL, &act, NULL);
+#endif
if (!tests[0].func || !cpus[0].flag) {
fprintf(stderr, "checkasm: no tests to perform\n");