[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/2] linux-test (tests/tcg/multiarch/linux-test.c) add check
From: |
Taylor Simpson |
Subject: |
[PATCH v3 2/2] linux-test (tests/tcg/multiarch/linux-test.c) add check |
Date: |
Thu, 15 Jul 2021 16:22:36 -0500 |
Add a check that the SIGSEGV handler is called
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
tests/tcg/multiarch/linux-test.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index c8c6aed..e2d88f8 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -439,10 +439,14 @@ static void sig_alarm(int sig)
alarm_count++;
}
+/* Count the number of times handler is called */
+static int sig_segv_called;
+
static void sig_segv(int sig, siginfo_t *info, void *puc)
{
if (sig != SIGSEGV)
error("signal");
+ sig_segv_called++;
longjmp(jmp_env, 1);
}
@@ -492,6 +496,10 @@ static void test_signal(void)
*(volatile uint8_t *)0 = 0;
}
+ if (sig_segv_called == 0) {
+ error("SIGSEGV handler not called");
+ }
+
act.sa_handler = SIG_DFL;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
--
2.7.4