aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/include/utils.h
diff options
context:
space:
mode:
authorSandipan Das <sandipan@linux.ibm.com>2020-07-27 09:30:38 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2020-07-29 21:02:10 +1000
commite3333c599482245d08002725cc1b353e4963fa26 (patch)
tree16a6c8a4ba0d1912edd2dbc479fdd92ea41dbb23 /tools/testing/selftests/powerpc/include/utils.h
parentselftests/powerpc: Harden test for execute-disabled pkeys (diff)
downloadlinux-dev-e3333c599482245d08002725cc1b353e4963fa26.tar.xz
linux-dev-e3333c599482245d08002725cc1b353e4963fa26.zip
selftests/powerpc: Add helper to exit on failure
This adds a helper similar to FAIL_IF() which lets a program exit with code 1 (to indicate failure) when the given condition is true. Signed-off-by: Sandipan Das <sandipan@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/dac282d5c2e96e7816dc522e4e20d56d7c79c898.1595821792.git.sandipan@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/include/utils.h')
-rw-r--r--tools/testing/selftests/powerpc/include/utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
index 7f259f36e23b..69d16875802d 100644
--- a/tools/testing/selftests/powerpc/include/utils.h
+++ b/tools/testing/selftests/powerpc/include/utils.h
@@ -72,6 +72,15 @@ do { \
} \
} while (0)
+#define FAIL_IF_EXIT(x) \
+do { \
+ if ((x)) { \
+ fprintf(stderr, \
+ "[FAIL] Test FAILED on line %d\n", __LINE__); \
+ _exit(1); \
+ } \
+} while (0)
+
/* The test harness uses this, yes it's gross */
#define MAGIC_SKIP_RETURN_VALUE 99