diff options
author | Elliott Hughes <enh@google.com> | 2019-06-26 15:57:25 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-06-26 22:13:32 -0500 |
commit | 40e55eb40afab3bc978fb42b6ec009a108d8e0c3 (patch) | |
tree | 28d56739772d7ea8950345a2481c22632234f006 /tests | |
parent | b75675297700e365cc8482b048ad9a7fc4946065 (diff) | |
download | toybox-40e55eb40afab3bc978fb42b6ec009a108d8e0c3.tar.gz |
losetup: fix Android.
Use /dev/block/loop* more uniformly, and teach the tests which to expect.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/losetup.test | 18 |
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 |