aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-06-10 08:23:09 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-06-11 03:03:54 -0400
commit33b4819f3b93bbcb934e02cbc64ff3c5e9d0149b (patch)
tree4d8e4d8fd1196efbb29d9b208501d746d9565c7d /tools
parentde506f73dd40cc1f3ba3312bd454e06f2803335b (diff)
selftests/powerpc: Add support for skipping tests
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/powerpc/harness.c5
-rw-r--r--tools/testing/selftests/powerpc/subunit.h5
-rw-r--r--tools/testing/selftests/powerpc/utils.h12
3 files changed, 21 insertions, 1 deletions
diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c
index 532ddff8a669..8ebc58a09311 100644
--- a/tools/testing/selftests/powerpc/harness.c
+++ b/tools/testing/selftests/powerpc/harness.c
@@ -105,7 +105,10 @@ int test_harness(int (test_function)(void), char *name)
105 105
106 rc = run_test(test_function, name); 106 rc = run_test(test_function, name);
107 107
108 test_finish(name, rc); 108 if (rc == MAGIC_SKIP_RETURN_VALUE)
109 test_skip(name);
110 else
111 test_finish(name, rc);
109 112
110 return rc; 113 return rc;
111} 114}
diff --git a/tools/testing/selftests/powerpc/subunit.h b/tools/testing/selftests/powerpc/subunit.h
index 98a22920792d..9c6c4e901ab6 100644
--- a/tools/testing/selftests/powerpc/subunit.h
+++ b/tools/testing/selftests/powerpc/subunit.h
@@ -26,6 +26,11 @@ static inline void test_error(char *name)
26 printf("error: %s\n", name); 26 printf("error: %s\n", name);
27} 27}
28 28
29static inline void test_skip(char *name)
30{
31 printf("skip: %s\n", name);
32}
33
29static inline void test_success(char *name) 34static inline void test_success(char *name)
30{ 35{
31 printf("success: %s\n", name); 36 printf("success: %s\n", name);
diff --git a/tools/testing/selftests/powerpc/utils.h b/tools/testing/selftests/powerpc/utils.h
index 0de064406dab..a93777ae0684 100644
--- a/tools/testing/selftests/powerpc/utils.h
+++ b/tools/testing/selftests/powerpc/utils.h
@@ -31,6 +31,18 @@ do { \
31 } \ 31 } \
32} while (0) 32} while (0)
33 33
34/* The test harness uses this, yes it's gross */
35#define MAGIC_SKIP_RETURN_VALUE 99
36
37#define SKIP_IF(x) \
38do { \
39 if ((x)) { \
40 fprintf(stderr, \
41 "[SKIP] Test skipped on line %d\n", __LINE__); \
42 return MAGIC_SKIP_RETURN_VALUE; \
43 } \
44} while (0)
45
34#define _str(s) #s 46#define _str(s) #s
35#define str(s) _str(s) 47#define str(s) _str(s)
36 48