diff mbox series

btrfs-progs: tests: fix the mount failure detection

Message ID 1990108ecf9965436246978a88474607d3814060.1718775020.git.wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs-progs: tests: fix the mount failure detection | expand

Commit Message

Qu Wenruo June 19, 2024, 5:30 a.m. UTC
[BUG]
After commit "btrfs-progs: tests: dump dmesg if a mount fails", test
case misc/041 would output the following error:

    [TEST/misc]   041-subvolume-delete-during-send
 cat: invalid option -- 'f'
 Try 'cat --help' for more information.
 failed: /home/adam/btrfs-progs/btrfs send -f stream19752.out /home/adam/btrfs-progs/tests/mnt/snap1

[CAUSE]
The send command would fail anyway, but the error message is from the
mount detection, which goes like this:

		if cat "${cmd_array[@]}" | grep -q mount; then

Obviously cat is not the correct animal to print cmd_array to
stdout.

[FIX]
I should go "echo" no matter how I enjoy petting a cat.

It's better to fold this into commit "btrfs-progs: tests: dump dmesg if a
mount fails".

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/common b/tests/common
index e9b973e4480b..e996b35af787 100644
--- a/tests/common
+++ b/tests/common
@@ -238,7 +238,7 @@  run_check()
 
 	"${cmd_array[@]}" >> "$RESULTS" 2>&1
 	if [ "$?" -ne 0 ]; then
-		if cat "${cmd_array[@]}" | grep -q mount; then
+		if echo "${cmd_array[@]}" | grep -q mount; then
 			dmesg | tail -n 15 >> "$RESULTS"
 		fi
 		_fail "failed: ${cmd_array[@]}"