btrfs-progs: tests: dump dmesg if a mount fails

[BUG]
There is a random failure for misc/028 in github CI, but unable to
reproduce locally.

[EXTRA DUMP]
The failure is at mount time, which is mostly out of our control (kernel
is provided by the CI image), but at least we can do extra kernel dump
if a mount fails.

This dump is done inside run_check() where if we detects there is a
"mount" word inside the command string.

The detection is not the best, it may detect other commands that
contains the word "mount", but it should be good enough to detect real
mount failure.

Pull-request: #815
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2024-06-13 10:30:24 +09:30 committed by David Sterba
parent 6daf3de34b
commit 6df00a69e4
1 changed files with 7 additions and 1 deletions

View File

@ -220,7 +220,13 @@ run_check()
echo "====== RUN CHECK ${cmd_array[@]}" >> "$RESULTS" 2>&1 echo "====== RUN CHECK ${cmd_array[@]}" >> "$RESULTS" 2>&1
if [[ $TEST_LOG =~ tty ]]; then echo "CMD: ${cmd_array[@]}" > /dev/tty; fi if [[ $TEST_LOG =~ tty ]]; then echo "CMD: ${cmd_array[@]}" > /dev/tty; fi
"${cmd_array[@]}" >> "$RESULTS" 2>&1 || _fail "failed: ${cmd_array[@]}" "${cmd_array[@]}" >> "$RESULTS" 2>&1
if [ "$?" -ne 0 ]; then
if echo "${cmd_array[@]}" | grep -q mount; then
dmesg | tail -n 15 >> "$RESULTS"
fi
_fail "failed: ${cmd_array[@]}"
fi
} }
# same as run_check but the stderr+stdout output is duplicated on stdout and # same as run_check but the stderr+stdout output is duplicated on stdout and