btrfs-progs: tests: don't pass size to prepare_test_dev if not necessary
[platform/upstream/btrfs-progs.git] / tests / cli-tests / 004-send-parent-multi-subvol / test.sh
1 #!/bin/bash
2 #
3 # minimal test for the following syntax: btrfs send -p parent subvol1 subvol2
4
5 source "$TOP/tests/common"
6
7 check_prereq mkfs.btrfs
8 check_prereq btrfs
9
10 setup_root_helper
11 prepare_test_dev
12
13 run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV"
14 run_check_mount_test_dev
15
16 here=`pwd`
17 cd "$TEST_MNT" || _fail "cannot chdir to TEST_MNT"
18
19 run_check $SUDO_HELPER "$TOP/btrfs" subvolume create subv-parent
20 run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent/file bs=1M count=10
21 run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r subv-parent subv-snap1
22 run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent/file bs=1M count=10
23 run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r subv-parent subv-snap2
24 run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent/file bs=1M count=10
25 run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r subv-parent subv-snap3
26
27 run_check truncate -s0 "$here"/send.stream
28 run_check chmod a+w "$here"/send.stream
29 run_check $SUDO_HELPER "$TOP/btrfs" send -f "$here"/send.stream -p subv-snap1 subv-snap2 subv-snap3
30
31 cd "$here" || _fail "cannot chdir back to test directory"
32 rm send.stream
33
34 run_check_umount_test_dev