diff options
author | David Sterba <dsterba@suse.com> | 2018-02-19 19:07:32 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-02-19 19:07:32 +0100 |
commit | ea0956bb2a26ca0deb1bcba186a0e53ab07164a5 (patch) | |
tree | c3822880a21d67e3684f4505532bddcfb36d911a /tests/misc-tests | |
parent | c5dc299aff6b4ee3e3490a046fcf9bf8d1c41af5 (diff) |
btrfs-progs: tests: add test for send -p on 2 mont points
Add testcase from issue, use reproducer from Axel Burri.
Issue: #96
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/misc-tests')
-rwxr-xr-x | tests/misc-tests/029-send-p-different-mountpoints/test.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/misc-tests/029-send-p-different-mountpoints/test.sh b/tests/misc-tests/029-send-p-different-mountpoints/test.sh new file mode 100755 index 00000000..64048334 --- /dev/null +++ b/tests/misc-tests/029-send-p-different-mountpoints/test.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# test that send -p does not corrupt paths when send is using 2 different mount +# points + +source "$TOP/tests/common" + +check_prereq btrfs +check_prereq mkfs.btrfs + +setup_root_helper +prepare_test_dev + +# we need two mount points, cannot nest the subvoolume under TEST_MNT +SUBVOL_MNT="$TEST_MNT/subvol" +TOPLEVEL_MNT="$TEST_MNT/toplevel" +TEST_MNT="$TOPLEVEL_MNT" +mkdir -p "$TOPLEVEL_MNT" "$SUBVOL_MNT" + +run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV" +run_check_mount_test_dev + +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TOPLEVEL_MNT/subv1" +run_check $SUDO_HELPER mount -t btrfs -o subvol=subv1 "$TEST_DEV" "$SUBVOL_MNT" + +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TOPLEVEL_MNT/test-subvol" +run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r \ + "$TOPLEVEL_MNT/test-subvol" "$SUBVOL_MNT/test-subvol-mnt-subvol" +run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r \ + "$TOPLEVEL_MNT/test-subvol" "$TOPLEVEL_MNT/test-subvol-mnt-root" + +run_mustfail_stdout "send -p on 2 mount points" \ + $SUDO_HELPER "$TOP/btrfs" send -f /dev/null -p \ + "$SUBVOL_MNT/test-subvol-mnt-subvol" "$TOPLEVEL_MNT/test-subvol-mnt-root" \ + | tee -a "$RESULTS" \ + | grep -q "not on mount point.*/toplevel" \ + || _fail "expected output not found, please check the logs" + +# without a fix, this leads to a corrupted path, with something like: +# +# ERROR: open st-subvol-mnt-subvol failed. No such file or directory +# ^^^^^^^^^^^^^^^^^^^^ +# ERROR: could not resolve rootid for .../tests/mnt/subvol/test-subvol-mnt-subvol + +# expected output: +# ERROR: not on mount point: .../tests/mnt/toplevel + +run_check_umount_test_dev "$SUBVOL_MNT" +run_check_umount_test_dev "$TOPLEVEL_MNT" + +rmdir "$SUBVOL_MNT" +rmdir "$TOPLEVEL_MNT" |