Skip to content

Commit 33b4819

Browse files
mpeozbenh
authored andcommitted
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>
1 parent de506f7 commit 33b4819

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎tools/testing/selftests/powerpc/harness.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ int test_harness(int (test_function)(void), char *name)
105105

106106
rc = run_test(test_function, name);
107107

108-
test_finish(name, rc);
108+
if (rc == MAGIC_SKIP_RETURN_VALUE)
109+
test_skip(name);
110+
else
111+
test_finish(name, rc);
109112

110113
return rc;
111114
}

‎tools/testing/selftests/powerpc/subunit.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ static inline void test_error(char *name)
2626
printf("error: %s\n", name);
2727
}
2828

29+
static inline void test_skip(char *name)
30+
{
31+
printf("skip: %s\n", name);
32+
}
33+
2934
static inline void test_success(char *name)
3035
{
3136
printf("success: %s\n", name);

‎tools/testing/selftests/powerpc/utils.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ do { \
3131
} \
3232
} while (0)
3333

34+
/* The test harness uses this, yes it's gross */
35+
#define MAGIC_SKIP_RETURN_VALUE 99
36+
37+
#define SKIP_IF(x) \
38+
do { \
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+
3446
#define _str(s) #s
3547
#define str(s) _str(s)
3648

0 commit comments

Comments
 (0)