aboutsummaryrefslogtreecommitdiff
path: root/tests/losetup.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/losetup.test')
-rwxr-xr-xtests/losetup.test18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/losetup.test b/tests/losetup.test
index f30a0fe2..c04a72b9 100755
--- a/tests/losetup.test
+++ b/tests/losetup.test
@@ -13,13 +13,17 @@ fi
truncate -s 1M blah.img &&
FILE="$(readlink -f blah.img)"
-DEV="$(printf '%04s' $(stat -t blah.img | awk '{print $7}'))"
-NODE="$(stat -t blah.img | awk '{print $8}')"
+DEV="$(stat --format %d blah.img)"
+NODE="$(stat --format %i blah.img)"
-losetup -f
-losetup -f -s
-losetup -f file
-
-losetup -d
+# TODO: assumes there are no loopback devices!
+testcmd "-f" "-f" "/dev/loop0\n" "" ""
+testcmd "-f blah.img" "-f blah.img" "" "" ""
+testcmd "-f --show" "-f --show blah.img" "/dev/loop1\n" "" ""
+testcmd "-a" "-a | sort" \
+ "/dev/loop0: [$DEV]:$NODE ($FILE)\n/dev/loop1: [$DEV]:$NODE ($FILE)\n" "" ""
+testcmd "-d /dev/loop0" "-d /dev/loop0 && losetup -a" \
+ "/dev/loop1: [$DEV]:$NODE ($FILE)\n" "" ""
+testcmd "-D" "-D && losetup -a" "" "" ""
rm blah.img