btrfs-progs: tests: fix cli-tests/003-fi-resize-args
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.
Signed-off-by Vladimir Panteleev <[email protected]>
--- 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
@@ -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
David Sterba
AppliedQuoted 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.
Signed-off-by Vladimir Panteleev <[email protected]>
Applied, thanks.