Skip to content

Commit

Permalink
selftests/powerpc: Add support for skipping tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Michael Ellerman authored and Benjamin Herrenschmidt committed Jun 11, 2014
1 parent de506f7 commit 33b4819
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/testing/selftests/powerpc/harness.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
5 changes: 5 additions & 0 deletions tools/testing/selftests/powerpc/subunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions tools/testing/selftests/powerpc/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 33b4819

Please sign in to comment.