Skip to contentSkip to conversation

btrfs-progs: tests: fix cli-tests/003-fi-resize-args

PATCH Applied Vladimir Panteleev 2 participants 2 messages Aug 17, 2019 – Aug 20, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: tests: fix cli-tests/003-fi-resize-args

grep's exit code was never checked (and -o errexit is not in effect), thus the test was ineffectual and regressed.

Add the missing exit code check, and update the error messages to make the test pass again.

---
 tests/cli-tests/003-fi-resize-args/test.sh | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
tests/cli-tests/003-fi-resize-args/test.sh +16 -8
index 4249c1ce..c9267035 100755
@@ -16,21 +16,29 @@ run_check_mount_test_dev
 # missing the one of the required arguments
 for sep in '' '--'; do
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 0 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep "$TEST_MNT" |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep -128M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep +128M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep 512M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:-128M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:512M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 	run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:+128M |
-		grep -q "btrfs filesystem resize: too few arguments"
+		grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" ||
+		_fail "no expected error message in the output"
 done
 
 # valid resize
Signature · 1 line
2.22.0
Applied
#1 lore raw
Quoted 7 lines · Vladimir Panteleev

grep's exit code was never checked (and -o errexit is not in effect), thus the test was ineffectual and regressed.

Add the missing exit code check, and update the error messages to make the test pass again.

Applied, thanks.