Commit 7b1513d0 authored by Michael Ellerman's avatar Michael Ellerman

selftests/powerpc/ptrace: Make child errors more obvious

Use the FAIL_IF() macro so that errors in the child report a line
number, rather than just silently exiting.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220627140239.2464900-11-mpe@ellerman.id.au
parent 611e3850
...@@ -19,7 +19,7 @@ double c = FPR_3; ...@@ -19,7 +19,7 @@ double c = FPR_3;
extern void gpr_child_loop(int *read_flag, int *write_flag, extern void gpr_child_loop(int *read_flag, int *write_flag,
unsigned long *gpr_buf, double *fpr_buf); unsigned long *gpr_buf, double *fpr_buf);
void gpr(void) static int child(void)
{ {
unsigned long gpr_buf[32]; unsigned long gpr_buf[32];
double fpr_buf[32]; double fpr_buf[32];
...@@ -38,13 +38,10 @@ void gpr(void) ...@@ -38,13 +38,10 @@ void gpr(void)
shmdt((void *)cptr); shmdt((void *)cptr);
if (validate_gpr(gpr_buf, GPR_3)) FAIL_IF(validate_gpr(gpr_buf, GPR_3));
exit(1); FAIL_IF(validate_fpr_double(fpr_buf, c));
if (validate_fpr_double(fpr_buf, c)) return 0;
exit(1);
exit(0);
} }
int trace_gpr(pid_t child) int trace_gpr(pid_t child)
...@@ -76,7 +73,7 @@ int ptrace_gpr(void) ...@@ -76,7 +73,7 @@ int ptrace_gpr(void)
return TEST_FAIL; return TEST_FAIL;
} }
if (pid == 0) if (pid == 0)
gpr(); exit(child());
if (pid) { if (pid) {
pptr = (int *)shmat(shm_id, NULL, 0); pptr = (int *)shmat(shm_id, NULL, 0);
......
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