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

Message ID 20190817231849.18675-1-git@vladimir.panteleev.md
State New
Headers show
Series
  • btrfs-progs: tests: fix cli-tests/003-fi-resize-args
Related show

Commit Message

Vladimir Panteleev Aug. 17, 2019, 11:18 p.m. UTC
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.

Signed-off-by: Vladimir Panteleev <git@vladimir.panteleev.md>
---
 tests/cli-tests/003-fi-resize-args/test.sh | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

Comments

David Sterba Aug. 20, 2019, 2:26 p.m. UTC | #1
On Sat, Aug 17, 2019 at 11:18:49PM +0000, Vladimir Panteleev wrote:
> 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.
> 
> Signed-off-by: Vladimir Panteleev <git@vladimir.panteleev.md>

Applied, thanks.

Patch
diff mbox series

diff --git a/tests/cli-tests/003-fi-resize-args/test.sh b/tests/cli-tests/003-fi-resize-args/test.sh
index 4249c1ce..c9267035 100755
--- a/tests/cli-tests/003-fi-resize-args/test.sh
+++ b/tests/cli-tests/003-fi-resize-args/test.sh
@@ -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