mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-11 00:42:56 -04:00
Merge patch series "selftests: coredump: Some bug fixes"
Nam Cao <namcao@linutronix.de> 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/cover.1744383419.git.namcao@linutronix.de: 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/cover.1744383419.git.namcao@linutronix.de Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
@@ -89,14 +89,14 @@ FIXTURE_TEARDOWN(coredump)
|
||||
fprintf(stderr, "Failed to cleanup stackdump test: %s\n", reason);
|
||||
}
|
||||
|
||||
TEST_F(coredump, stackdump)
|
||||
TEST_F_TIMEOUT(coredump, stackdump, 120)
|
||||
{
|
||||
struct sigaction action = {};
|
||||
unsigned long long stack;
|
||||
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)
|
||||
@@ -138,10 +142,12 @@ TEST_F(coredump, stackdump)
|
||||
ASSERT_NE(file, NULL);
|
||||
|
||||
/* Step 4: Make sure all stack pointer values are non-zero */
|
||||
line = NULL;
|
||||
for (i = 0; -1 != getline(&line, &line_length, file); ++i) {
|
||||
stack = strtoull(line, NULL, 10);
|
||||
ASSERT_NE(stack, 0);
|
||||
}
|
||||
free(line);
|
||||
|
||||
ASSERT_EQ(i, 1 + NUM_THREAD_SPAWN);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user