All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: <linuxppc-dev@lists.ozlabs.org>
Subject: [PATCH 11/13] selftests/powerpc/ptrace: Make child errors more obvious
Date: Tue, 28 Jun 2022 00:02:37 +1000	[thread overview]
Message-ID: <20220627140239.2464900-11-mpe@ellerman.id.au> (raw)
In-Reply-To: <20220627140239.2464900-1-mpe@ellerman.id.au>

Use the FAIL_IF() macro so that errors in the child report a line
number, rather than just silently exiting.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c b/tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c
index 4e7a7eb01e3a..b574ea26395c 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c
@@ -19,7 +19,7 @@ double c = FPR_3;
 extern void gpr_child_loop(int *read_flag, int *write_flag,
 			   unsigned long *gpr_buf, double *fpr_buf);
 
-void gpr(void)
+static int child(void)
 {
 	unsigned long gpr_buf[32];
 	double fpr_buf[32];
@@ -38,13 +38,10 @@ void gpr(void)
 
 	shmdt((void *)cptr);
 
-	if (validate_gpr(gpr_buf, GPR_3))
-		exit(1);
+	FAIL_IF(validate_gpr(gpr_buf, GPR_3));
+	FAIL_IF(validate_fpr_double(fpr_buf, c));
 
-	if (validate_fpr_double(fpr_buf, c))
-		exit(1);
-
-	exit(0);
+	return 0;
 }
 
 int trace_gpr(pid_t child)
@@ -76,7 +73,7 @@ int ptrace_gpr(void)
 		return TEST_FAIL;
 	}
 	if (pid == 0)
-		gpr();
+		exit(child());
 
 	if (pid) {
 		pptr = (int *)shmat(shm_id, NULL, 0);
-- 
2.35.3


  parent reply	other threads:[~2022-06-27 14:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 14:02 [PATCH 01/13] selftests/powerpc: Ensure 16-byte stack pointer alignment Michael Ellerman
2022-06-27 14:02 ` [PATCH 02/13] selftests/powerpc/ptrace: Set LOCAL_HDRS Michael Ellerman
2022-06-27 14:02 ` [PATCH 03/13] selftests/powerpc/ptrace: Split CFLAGS better Michael Ellerman
2022-06-27 14:02 ` [PATCH 04/13] selftests/powerpc: Don't save CR by default in asm helpers Michael Ellerman
2022-06-27 14:02 ` [PATCH 05/13] selftests/powerpc: Don't save TOC " Michael Ellerman
2022-06-27 14:02 ` [PATCH 06/13] selftests/powerpc: Add 32-bit support to " Michael Ellerman
2022-06-27 14:02 ` [PATCH 07/13] selftests/powerpc/ptrace: Drop unused load_fpr_single_precision() Michael Ellerman
2022-06-27 14:02 ` [PATCH 08/13] selftests/powerpc/ptrace: Convert to load/store doubles Michael Ellerman
2022-06-27 14:02 ` [PATCH 09/13] selftests/powerpc/ptrace: Build the ptrace-gpr test as 32-bit when possible Michael Ellerman
2022-06-27 14:02 ` [PATCH 10/13] selftests/powerpc/ptrace: Do more of ptrace-gpr in asm Michael Ellerman
2022-06-27 14:02 ` Michael Ellerman [this message]
2022-06-27 14:02 ` [PATCH 12/13] selftests/powerpc/ptrace: Use more interesting values Michael Ellerman
2022-06-27 14:02 ` [PATCH 13/13] selftests/powerpc/ptrace: Add peek/poke of FPRs Michael Ellerman
2022-07-29 13:02 ` [PATCH 01/13] selftests/powerpc: Ensure 16-byte stack pointer alignment Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220627140239.2464900-11-mpe@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.