From 6df00a69e4c03bc499cadcac7c358bf2978d1a14 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Thu, 13 Jun 2024 10:30:24 +0930 Subject: [PATCH] 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 Signed-off-by: David Sterba --- tests/common | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/common b/tests/common index 30a3201e..e70afdc9 100644 --- a/tests/common +++ b/tests/common @@ -220,7 +220,13 @@ run_check() echo "====== RUN CHECK ${cmd_array[@]}" >> "$RESULTS" 2>&1 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