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 <git@vladimir.panteleev.md>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Vladimir Panteleev 2019-08-17 23:18:49 +00:00 committed by David Sterba
parent e46e17ab5a
commit bbb18c990c
1 changed files with 16 additions and 8 deletions

View File

@ -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