selftests/powerpc: Add support for skipping tests
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 10 Jun 2014 12:23:09 +0000 (22:23 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Jun 2014 07:03:54 +0000 (17:03 +1000)
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
tools/testing/selftests/powerpc/harness.c
tools/testing/selftests/powerpc/subunit.h
tools/testing/selftests/powerpc/utils.h

index 532ddff8a669ad5614fcd25639aaea7645033524..8ebc58a09311da9a591a7c8efd1fb2025049c2fe 100644 (file)
@@ -105,7 +105,10 @@ int test_harness(int (test_function)(void), char *name)
 
        rc = run_test(test_function, name);
 
-       test_finish(name, rc);
+       if (rc == MAGIC_SKIP_RETURN_VALUE)
+               test_skip(name);
+       else
+               test_finish(name, rc);
 
        return rc;
 }
index 98a22920792d812b931fe7c5e7b86af58ba4ccec..9c6c4e901ab617671c669315bcc62280362b9104 100644 (file)
@@ -26,6 +26,11 @@ static inline void test_error(char *name)
        printf("error: %s\n", name);
 }
 
+static inline void test_skip(char *name)
+{
+       printf("skip: %s\n", name);
+}
+
 static inline void test_success(char *name)
 {
        printf("success: %s\n", name);
index 0de064406dabf5d7589f9cc094f133e12b1798a1..a93777ae06846a4df47e5fbb5241af92cb6d6928 100644 (file)
@@ -31,6 +31,18 @@ do {                                                         \
        }                                                       \
 } while (0)
 
+/* The test harness uses this, yes it's gross */
+#define MAGIC_SKIP_RETURN_VALUE        99
+
+#define SKIP_IF(x)                                             \
+do {                                                           \
+       if ((x)) {                                              \
+               fprintf(stderr,                                 \
+               "[SKIP] Test skipped on line %d\n", __LINE__);  \
+               return MAGIC_SKIP_RETURN_VALUE;                 \
+       }                                                       \
+} while (0)
+
 #define _str(s) #s
 #define str(s) _str(s)