Commit aa83f3d8 authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

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: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f5fc8229
...@@ -2,7 +2,7 @@ PROGS := tm-resched-dscr ...@@ -2,7 +2,7 @@ PROGS := tm-resched-dscr
all: $(PROGS) all: $(PROGS)
$(PROGS): $(PROGS): ../harness.c
run_tests: all run_tests: all
@-for PROG in $(PROGS); do \ @-for PROG in $(PROGS); do \
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <assert.h> #include <assert.h>
#include <asm/tm.h> #include <asm/tm.h>
#include "utils.h"
#define TBEGIN ".long 0x7C00051D ;" #define TBEGIN ".long 0x7C00051D ;"
#define TEND ".long 0x7C00055D ;" #define TEND ".long 0x7C00055D ;"
#define TCHECK ".long 0x7C00059C ;" #define TCHECK ".long 0x7C00059C ;"
...@@ -36,7 +38,8 @@ ...@@ -36,7 +38,8 @@
#define SPRN_TEXASR 0x82 #define SPRN_TEXASR 0x82
#define SPRN_DSCR 0x03 #define SPRN_DSCR 0x03
int main(void) { int test_body(void)
{
uint64_t rv, dscr1 = 1, dscr2, texasr; uint64_t rv, dscr1 = 1, dscr2, texasr;
printf("Check DSCR TM context switch: "); printf("Check DSCR TM context switch: ");
...@@ -81,10 +84,15 @@ int main(void) { ...@@ -81,10 +84,15 @@ int main(void) {
} }
if (dscr2 != dscr1) { if (dscr2 != dscr1) {
printf(" FAIL\n"); printf(" FAIL\n");
exit(EXIT_FAILURE); return 1;
} else { } else {
printf(" OK\n"); printf(" OK\n");
exit(EXIT_SUCCESS); return 0;
} }
} }
} }
int main(void)
{
return test_harness(test_body, "tm_resched_dscr");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment