Skip to content

Commit e1b477c

Browse files
committed
Merge patch series "selftests: coredump: Some bug fixes"
Nam Cao <[email protected]> says: While trying the coredump test on qemu-system-riscv64, I observed test failures for various reasons. This series makes the test works on qemu-system-riscv64. * patches from https://lore.kernel.org/[email protected]: selftests: coredump: Raise timeout to 2 minutes selftests: coredump: Fix test failure for slow machines selftests: coredump: Properly initialize pointer Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
2 parents 923ea4d + c6e888d commit e1b477c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/testing/selftests/coredump/stackdump_test.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ FIXTURE_TEARDOWN(coredump)
8989
fprintf(stderr, "Failed to cleanup stackdump test: %s\n", reason);
9090
}
9191

92-
TEST_F(coredump, stackdump)
92+
TEST_F_TIMEOUT(coredump, stackdump, 120)
9393
{
9494
struct sigaction action = {};
9595
unsigned long long stack;
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)
@@ -138,10 +142,12 @@ TEST_F(coredump, stackdump)
138142
ASSERT_NE(file, NULL);
139143

140144
/* Step 4: Make sure all stack pointer values are non-zero */
145+
line = NULL;
141146
for (i = 0; -1 != getline(&line, &line_length, file); ++i) {
142147
stack = strtoull(line, NULL, 10);
143148
ASSERT_NE(stack, 0);
144149
}
150+
free(line);
145151

146152
ASSERT_EQ(i, 1 + NUM_THREAD_SPAWN);
147153

0 commit comments

Comments
 (0)