btrfs-progs: misc-tests/039: cleanup test

Cleanups done separately:

* use the default test image, loop devices not needed for the test
* trim TEST_MNT from all paths
* send output is created inside the test filesystem

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2020-03-23 20:55:39 +01:00
parent 25e3e5cb12
commit 1311f1b83a
1 changed files with 16 additions and 18 deletions

View File

@ -10,25 +10,23 @@ check_prereq btrfs
check_prereq mkfs.btrfs
setup_root_helper
prepare_test_dev
rm -f disk
run_check truncate -s 1G disk
chmod a+w disk
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f disk
run_check $SUDO_HELPER mount -o loop disk "$TEST_MNT"
run_check_mkfs_test_dev
run_check_mount_test_dev
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subvol"
run_check $SUDO_HELPER dd if=/dev/urandom of="$TEST_MNT/subvol/foo" \
bs=1M count=1 status=none
run_check $SUDO_HELPER cp --reflink "$TEST_MNT/subvol/foo" "$TEST_MNT/subvol/bar"
run_check $SUDO_HELPER mkdir "$TEST_MNT/subvol/dir"
run_check $SUDO_HELPER mv "$TEST_MNT/subvol/foo" "$TEST_MNT/subvol/dir"
run_check $SUDO_HELPER "$TOP/btrfs" property set "$TEST_MNT/subvol" ro true
run_check $SUDO_HELPER "$TOP/btrfs" send -f send.data "$TEST_MNT/subvol"
cd "$TEST_MNT"
run_check $SUDO_HELPER mkdir "$TEST_MNT/first" "$TEST_MNT/second"
run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.data "$TEST_MNT/first"
run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.data "$TEST_MNT/second"
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "subvol"
run_check $SUDO_HELPER dd if=/dev/urandom of="subvol/foo" bs=1M count=1 status=none
run_check $SUDO_HELPER cp --reflink "subvol/foo" "subvol/bar"
run_check $SUDO_HELPER mkdir "subvol/dir"
run_check $SUDO_HELPER mv "subvol/foo" "subvol/dir"
run_check $SUDO_HELPER "$TOP/btrfs" property set "subvol" ro true
run_check $SUDO_HELPER "$TOP/btrfs" send -f send.data "subvol"
run_check $SUDO_HELPER mkdir "first" "second"
run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.data "first"
run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.data "second"
run_check $SUDO_HELPER umount "$TEST_MNT"
rm -f disk send.data
cd ..
run_check_umount_test_dev