diff options
author | Christian Brauner <brauner@kernel.org> | 2025-04-14 14:08:02 +0300 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-05-02 15:28:18 +0300 |
commit | e1b477c21300a928a7765a03cb96ca36c4dcf5ed (patch) | |
tree | 3f7487d1536ae37c150a398b82aaa16485bd7f93 | |
parent | 923ea4d4482be9475c31f1bc3691d7d74368348c (diff) | |
parent | c6e888d02d51d1e9f9abf1587e6a5618375cac9f (diff) | |
download | linux-e1b477c21300a928a7765a03cb96ca36c4dcf5ed.tar.xz |
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>
-rw-r--r-- | tools/testing/selftests/coredump/stackdump_test.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/testing/selftests/coredump/stackdump_test.c b/tools/testing/selftests/coredump/stackdump_test.c index 137b2364a082..fe3c728cd6be 100644 --- a/tools/testing/selftests/coredump/stackdump_test.c +++ b/tools/testing/selftests/coredump/stackdump_test.c @@ -89,14 +89,14 @@ fail: 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); |