From: Nam Cao <namcao@linutronix.de>
To: Christian Brauner <brauner@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>,
John Ogness <john.ogness@linutronix.de>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Nam Cao <namcao@linutronix.de>
Subject: [PATCH v2 2/3] selftests: coredump: Fix test failure for slow machines
Date: Fri, 11 Apr 2025 17:09:42 +0200 [thread overview]
Message-ID: <ee657f3fc8e19657cf7aaa366552d6347728f371.1744383419.git.namcao@linutronix.de> (raw)
In-Reply-To: <cover.1744383419.git.namcao@linutronix.de>
The test waits for coredump to finish by busy-waiting for the stack_values
file to be created. The maximum wait time is 10 seconds.
This doesn't work for slow machine (qemu-system-riscv64), because coredump
takes longer.
Fix it by waiting for the crashing child process to finish first.
Fixes: 15858da53542 ("selftests: coredump: Add stackdump test")
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
tools/testing/selftests/coredump/stackdump_test.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/coredump/stackdump_test.c b/tools/testing/selftests/coredump/stackdump_test.c
index c23cf95c3f6d..9da10fb5e597 100644
--- a/tools/testing/selftests/coredump/stackdump_test.c
+++ b/tools/testing/selftests/coredump/stackdump_test.c
@@ -96,7 +96,7 @@ TEST_F(coredump, stackdump)
char *test_dir, *line;
size_t line_length;
char buf[PATH_MAX];
- int ret, i;
+ int ret, i, status;
FILE *file;
pid_t pid;
@@ -129,6 +129,10 @@ TEST_F(coredump, stackdump)
/*
* Step 3: Wait for the stackdump script to write the stack pointers to the stackdump file
*/
+ waitpid(pid, &status, 0);
+ ASSERT_TRUE(WIFSIGNALED(status));
+ ASSERT_TRUE(WCOREDUMP(status));
+
for (i = 0; i < 10; ++i) {
file = fopen(STACKDUMP_FILE, "r");
if (file)
--
2.39.5
next prev parent reply other threads:[~2025-04-11 15:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 15:09 [PATCH v2 0/3] selftests: coredump: Some bug fixes Nam Cao
2025-04-11 15:09 ` [PATCH v2 1/3] selftests: coredump: Properly initialize pointer Nam Cao
2025-04-11 15:27 ` ALOK TIWARI
2025-04-11 15:09 ` Nam Cao [this message]
2025-04-11 15:09 ` [PATCH v2 3/3] selftests: coredump: Raise timeout to 2 minutes Nam Cao
2025-04-14 11:08 ` [PATCH v2 0/3] selftests: coredump: Some bug fixes Christian Brauner
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=ee657f3fc8e19657cf7aaa366552d6347728f371.1744383419.git.namcao@linutronix.de \
--to=namcao@linutronix.de \
--cc=brauner@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®