selftests/powerpc: Skip tm-signal-sigreturn-nt if TM not available
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 4 Nov 2019 23:15:56 +0000 (10:15 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 5 Nov 2019 00:26:20 +0000 (11:26 +1100)
On systems where TM (Transactional Memory) is disabled the
tm-signal-sigreturn-nt test causes a SIGILL:

  test: tm_signal_sigreturn_nt
  tags: git_version:7c202575ef63
  !! child died by signal 4
  failure: tm_signal_sigreturn_nt

We should skip the test if TM is not available.

Fixes: 34642d70ac7e ("selftests/powerpc: Add checks for transactional sigreturn")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191104233524.24348-1-mpe@ellerman.id.au
tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c

index 56fbf9f..07c3881 100644 (file)
  */
 
 #define _GNU_SOURCE
+#include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
 
 #include "utils.h"
+#include "tm.h"
 
 void trap_signal_handler(int signo, siginfo_t *si, void *uc)
 {
@@ -29,6 +31,8 @@ int tm_signal_sigreturn_nt(void)
 {
        struct sigaction trap_sa;
 
+       SKIP_IF(!have_htm());
+
        trap_sa.sa_flags = SA_SIGINFO;
        trap_sa.sa_sigaction = trap_signal_handler;