Skip to content

Commit 6f5bf9f

Browse files
covanambrauner
authored andcommitted
selftests: coredump: Fix test failure for slow machines
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: 15858da ("selftests: coredump: Add stackdump test") Signed-off-by: Nam Cao <[email protected]> Link: https://lore.kernel.org/ee657f3fc8e19657cf7aaa366552d6347728f371.1744383419.git.namcao@linutronix.de Signed-off-by: Christian Brauner <[email protected]>
1 parent e194d20 commit 6f5bf9f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/testing/selftests/coredump/stackdump_test.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ TEST_F(coredump, stackdump)
9696
char *test_dir, *line;
9797
size_t line_length;
9898
char buf[PATH_MAX];
99-
int ret, i;
99+
int ret, i, status;
100100
FILE *file;
101101
pid_t pid;
102102

@@ -129,6 +129,10 @@ TEST_F(coredump, stackdump)
129129
/*
130130
* Step 3: Wait for the stackdump script to write the stack pointers to the stackdump file
131131
*/
132+
waitpid(pid, &status, 0);
133+
ASSERT_TRUE(WIFSIGNALED(status));
134+
ASSERT_TRUE(WCOREDUMP(status));
135+
132136
for (i = 0; i < 10; ++i) {
133137
file = fopen(STACKDUMP_FILE, "r");
134138
if (file)

0 commit comments

Comments
 (0)