1
0
mirror of https://github.com/kdave/btrfs-progs synced 2025-04-08 02:01:16 +00:00
btrfs-progs/tests/cli-tests/021-subvolume-multiple-arguments/test.sh
Qu Wenruo d79eb4b726 btrfs-progs: tests: add test case for subvolume create multiple arguments
The test case would verify the following behaviors:

- Partial failure
  Should return 1, but the remaining valid destinations would still be
  created.

- All success
  That's as usual.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-23 20:21:58 +01:00

38 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Create subvolume with multiple destinations
source "$TEST_TOP/common" || exit
setup_root_helper
prepare_test_dev
run_check_mkfs_test_dev
run_check_mount_test_dev
# Create one invalid subvolume with 2 valid ones.
# The command should return 1 but the 2 valid ones should be created.
run_mustfail "should report error for any failed subvolume creation" \
$SUDO_HELPER "$TOP/btrfs" subvolume create \
"$TEST_MNT/non-exist-dir/subv0" \
"$TEST_MNT/subv1" \
"$TEST_MNT/subv2"
run_check $SUDO_HELPER stat "$TEST_MNT/subv1"
run_check $SUDO_HELPER stat "$TEST_MNT/subv2"
# Create multiple subvolumes with parent
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create -p \
"$TEST_MNT/non-exist-dir/subv0" \
"$TEST_MNT/subv1/subv3" \
"$TEST_MNT/subv4" \
run_check $SUDO_HELPER stat "$TEST_MNT/non-exist-dir/subv0"
run_check $SUDO_HELPER stat "$TEST_MNT/subv1/subv3"
run_check $SUDO_HELPER stat "$TEST_MNT/subv4"
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create -p "$TEST_MNT/dir3/dir1/./..//.///subv3//////"
run_check $SUDO_HELPER stat "$TEST_MNT/dir3/dir1"
run_check $SUDO_HELPER stat "$TEST_MNT/dir3/subv3"
run_check find "$TEST_MNT" -ls
run_check_umount_test_dev