Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Ellerman and committed by
Benjamin Herrenschmidt
aa83f3d8 f5fc8229

+12 -4
+1 -1
tools/testing/selftests/powerpc/tm/Makefile
··· 2 2 3 3 all: $(PROGS) 4 4 5 - $(PROGS): 5 + $(PROGS): ../harness.c 6 6 7 7 run_tests: all 8 8 @-for PROG in $(PROGS); do \
+11 -3
tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
··· 28 28 #include <assert.h> 29 29 #include <asm/tm.h> 30 30 31 + #include "utils.h" 32 + 31 33 #define TBEGIN ".long 0x7C00051D ;" 32 34 #define TEND ".long 0x7C00055D ;" 33 35 #define TCHECK ".long 0x7C00059C ;" ··· 38 36 #define SPRN_TEXASR 0x82 39 37 #define SPRN_DSCR 0x03 40 38 41 - int main(void) { 39 + int test_body(void) 40 + { 42 41 uint64_t rv, dscr1 = 1, dscr2, texasr; 43 42 44 43 printf("Check DSCR TM context switch: "); ··· 84 81 } 85 82 if (dscr2 != dscr1) { 86 83 printf(" FAIL\n"); 87 - exit(EXIT_FAILURE); 84 + return 1; 88 85 } else { 89 86 printf(" OK\n"); 90 - exit(EXIT_SUCCESS); 87 + return 0; 91 88 } 92 89 } 90 + } 91 + 92 + int main(void) 93 + { 94 + return test_harness(test_body, "tm_resched_dscr"); 93 95 }