mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 22:53:35 +00:00
btrfs-progs: cli-tests: add test case for return value of "btrfs subvlume create"
The test case would check if "btrfs subvolume create": - Report error on an existing path - Still report error if mulitple paths are given and one of them already exists - For above case, still created a subvolume for the good parameter Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3f988c9176
commit
dbd175734a
31
tests/cli-tests/025-subvolume-create-failures/test.sh
Executable file
31
tests/cli-tests/025-subvolume-create-failures/test.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Create subvolume failure cases to make sure the return value is correct
|
||||
|
||||
source "$TEST_TOP/common" || exit
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev
|
||||
|
||||
run_check_mkfs_test_dev
|
||||
run_check_mount_test_dev
|
||||
|
||||
# Create one subvolume and one file as place holder for later subvolume
|
||||
# creation to fail.
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv1"
|
||||
run_check $SUDO_HELPER touch "$TEST_MNT/subv2"
|
||||
|
||||
# Using existing path to create a subvolume must fail
|
||||
run_mustfail "should report error when target path already exists" \
|
||||
$SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv1"
|
||||
|
||||
run_mustfail "should report error when target path already exists" \
|
||||
$SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv2"
|
||||
|
||||
# Using multiple subvolumes in one create go, the good one "subv3" should be created
|
||||
run_mustfail "should report error when target path already exists" \
|
||||
$SUDO_HELPER "$TOP/btrfs" subvolume create \
|
||||
"$TEST_MNT/subv1" "$TEST_MNT/subv2" "$TEST_MNT/subv3"
|
||||
|
||||
run_check $SUDO_HELPER stat "$TEST_MNT/subv3"
|
||||
|
||||
run_check_umount_test_dev
|
Loading…
Reference in New Issue
Block a user