aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/losetup.test18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/losetup.test b/tests/losetup.test
index c04a72b9..7968ecd9 100755
--- a/tests/losetup.test
+++ b/tests/losetup.test
@@ -9,6 +9,14 @@ then
exit
fi
+# Android's loopback devices are only in /dev/block/loop*.
+# Debian has symlinks like /dev/block/7:0 back to ../loop*.
+if [ -b /dev/block/sda ]; then
+ DIR="/dev/block" # Presumably Android.
+else
+ DIR="/dev"
+fi
+
#testing "name" "command" "result" "infile" "stdin"
truncate -s 1M blah.img &&
@@ -17,13 +25,13 @@ DEV="$(stat --format %d blah.img)"
NODE="$(stat --format %i blah.img)"
# TODO: assumes there are no loopback devices!
-testcmd "-f" "-f" "/dev/loop0\n" "" ""
+testcmd "-f" "-f" "$DIR/loop0\n" "" ""
testcmd "-f blah.img" "-f blah.img" "" "" ""
-testcmd "-f --show" "-f --show blah.img" "/dev/loop1\n" "" ""
+testcmd "-f --show" "-f --show blah.img" "$DIR/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" "" ""
+ "$DIR/loop0: [$DEV]:$NODE ($FILE)\n$DIR/loop1: [$DEV]:$NODE ($FILE)\n" "" ""
+testcmd "-d $DIR/loop0" "-d $DIR/loop0 && losetup -a" \
+ "$DIR/loop1: [$DEV]:$NODE ($FILE)\n" "" ""
testcmd "-D" "-D && losetup -a" "" "" ""
rm blah.img