diff options
| author | Michael Ellerman <mpe@ellerman.id.au> | 2014-06-13 07:16:04 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-06-24 00:29:41 -0400 |
| commit | aa83f3d8979528d2e6e8ad0c155d8ecf4eaef2e2 (patch) | |
| tree | 265e22150b53599c18a2508aaf10c2eb4aa3a8e3 /tools/testing | |
| parent | f5fc82290c14b65511fea3db35f0bcbe6de746d3 (diff) | |
selftests/powerpc: Use the test harness for the TM DSCR test
This gives us standardised success/failure output and also handles
killing the test if it runs forever (2 minutes).
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/powerpc/tm/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 51267f4184a6..2cede239a074 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile | |||
| @@ -2,7 +2,7 @@ PROGS := tm-resched-dscr | |||
| 2 | 2 | ||
| 3 | all: $(PROGS) | 3 | all: $(PROGS) |
| 4 | 4 | ||
| 5 | $(PROGS): | 5 | $(PROGS): ../harness.c |
| 6 | 6 | ||
| 7 | run_tests: all | 7 | run_tests: all |
| 8 | @-for PROG in $(PROGS); do \ | 8 | @-for PROG in $(PROGS); do \ |
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c index ee98e3886af2..42d4c8caad81 100644 --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <assert.h> | 28 | #include <assert.h> |
| 29 | #include <asm/tm.h> | 29 | #include <asm/tm.h> |
| 30 | 30 | ||
| 31 | #include "utils.h" | ||
| 32 | |||
| 31 | #define TBEGIN ".long 0x7C00051D ;" | 33 | #define TBEGIN ".long 0x7C00051D ;" |
| 32 | #define TEND ".long 0x7C00055D ;" | 34 | #define TEND ".long 0x7C00055D ;" |
| 33 | #define TCHECK ".long 0x7C00059C ;" | 35 | #define TCHECK ".long 0x7C00059C ;" |
| @@ -36,7 +38,8 @@ | |||
| 36 | #define SPRN_TEXASR 0x82 | 38 | #define SPRN_TEXASR 0x82 |
| 37 | #define SPRN_DSCR 0x03 | 39 | #define SPRN_DSCR 0x03 |
| 38 | 40 | ||
| 39 | int main(void) { | 41 | int test_body(void) |
| 42 | { | ||
| 40 | uint64_t rv, dscr1 = 1, dscr2, texasr; | 43 | uint64_t rv, dscr1 = 1, dscr2, texasr; |
| 41 | 44 | ||
| 42 | printf("Check DSCR TM context switch: "); | 45 | printf("Check DSCR TM context switch: "); |
| @@ -81,10 +84,15 @@ int main(void) { | |||
| 81 | } | 84 | } |
| 82 | if (dscr2 != dscr1) { | 85 | if (dscr2 != dscr1) { |
| 83 | printf(" FAIL\n"); | 86 | printf(" FAIL\n"); |
| 84 | exit(EXIT_FAILURE); | 87 | return 1; |
| 85 | } else { | 88 | } else { |
| 86 | printf(" OK\n"); | 89 | printf(" OK\n"); |
| 87 | exit(EXIT_SUCCESS); | 90 | return 0; |
| 88 | } | 91 | } |
| 89 | } | 92 | } |
| 90 | } | 93 | } |
| 94 | |||
| 95 | int main(void) | ||
| 96 | { | ||
| 97 | return test_harness(test_body, "tm_resched_dscr"); | ||
| 98 | } | ||
