From 5d444edcb77758beb4a6809f00cc307c1e9d7ac1 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 3 Jul 2019 22:01:25 +0200 Subject: [PATCH] btrfs-progs: tests: use common loop device helpers in misc-tests/021 Signed-off-by: David Sterba --- tests/misc-tests/021-image-multi-devices/test.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/misc-tests/021-image-multi-devices/test.sh b/tests/misc-tests/021-image-multi-devices/test.sh index 1604df60..b1013b5d 100755 --- a/tests/misc-tests/021-image-multi-devices/test.sh +++ b/tests/misc-tests/021-image-multi-devices/test.sh @@ -10,13 +10,10 @@ check_prereq btrfs setup_root_helper -rm -f dev1 dev2 -run_check truncate -s 2G dev1 -run_check truncate -s 2G dev2 -chmod a+w dev1 dev2 - -loop1=$(run_check_stdout $SUDO_HELPER losetup --find --show dev1) -loop2=$(run_check_stdout $SUDO_HELPER losetup --find --show dev2) +setup_loopdevs 2 +prepare_loopdevs +loop1=${loopdevs[1]} +loop2=${loopdevs[2]} # Create the test file system. @@ -44,10 +41,7 @@ run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT" new_md5=$(run_check_stdout md5sum "$TEST_MNT/foobar" | cut -d ' ' -f 1) run_check $SUDO_HELPER umount "$TEST_MNT" -# Cleanup loop devices. -run_check $SUDO_HELPER losetup -d "$loop1" -run_check $SUDO_HELPER losetup -d "$loop2" -rm -f dev1 dev2 +cleanup_loopdevs # Compare the file digests. [ "$orig_md5" == "$new_md5" ] || _fail "File digests do not match"