diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 11:20:20 -0700 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2022-10-15 12:48:38 +0800 |
commit | 81a2acdc6d3aa06b1b5111739c0f9f94593d7779 (patch) | |
tree | e9173f48238a0ddb532ca6d6fa90f235c36d4f77 /check | |
parent | bd19653e345f9d7a30a2a95a2b70314386979038 (diff) |
check: detect and preserve all coredumps made by a test
If someone sets kernel.core_uses_pid (or kernel.core_pattern), any
coredumps generated by fstests might have names that are longer than
just "core". Since the pid isn't all that useful by itself, let's
record the coredumps by hash when we save them, so that we don't waste
space storing identical crash dumps.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'check')
-rwxr-xr-x | check | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -913,11 +913,19 @@ function run_section() sts=$? fi - if [ -f core ]; then - _dump_err_cont "[dumped core]" - mv core $RESULT_BASE/$seqnum.core + # If someone sets kernel.core_pattern or kernel.core_uses_pid, + # coredumps generated by fstests might have a longer name than + # just "core". Use globbing to find the most common patterns, + # assuming there are no other coredump capture packages set up. + local cores=0 + for i in core core.*; do + test -f "$i" || continue + if ((cores++ == 0)); then + _dump_err_cont "[dumped core]" + fi + (_adjust_oom_score 250; _save_coredump "$i") tc_status="fail" - fi + done if [ -f $seqres.notrun ]; then $timestamp && _timestamp @@ -950,6 +958,16 @@ function run_section() # of the check script itself. (_adjust_oom_score 250; _check_filesystems) || tc_status="fail" _check_dmesg || tc_status="fail" + + # Save any coredumps from the post-test fs checks + for i in core core.*; do + test -f "$i" || continue + if ((cores++ == 0)); then + _dump_err_cont "[dumped core]" + fi + (_adjust_oom_score 250; _save_coredump "$i") + tc_status="fail" + done fi # Reload the module after each test to check for leaks or |