summaryrefslogtreecommitdiffstats
path: root/tests/ts-cramfs-mkfs
diff options
context:
space:
mode:
authorKarel Zak2007-05-18 13:49:15 +0200
committerKarel Zak2007-05-18 13:49:15 +0200
commit3dfa278ea5462fceec0c6dcae7211f70eaf1fbb3 (patch)
treedeed7f83f5055fb11d0f55e0ebad096ff137f631 /tests/ts-cramfs-mkfs
parenttests: add functions for label, uuid and fstype detection (diff)
downloadkernel-qcow2-util-linux-3dfa278ea5462fceec0c6dcae7211f70eaf1fbb3.tar.gz
kernel-qcow2-util-linux-3dfa278ea5462fceec0c6dcae7211f70eaf1fbb3.tar.xz
kernel-qcow2-util-linux-3dfa278ea5462fceec0c6dcae7211f70eaf1fbb3.zip
tests: simplify devices usage
The patch simplifies devices usage in the tests. The patch also improves errors checking and reporting. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts-cramfs-mkfs')
-rwxr-xr-xtests/ts-cramfs-mkfs24
1 files changed, 6 insertions, 18 deletions
diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs
index 715f575c0..b2c43e62d 100755
--- a/tests/ts-cramfs-mkfs
+++ b/tests/ts-cramfs-mkfs
@@ -60,11 +60,7 @@ echo >> $TS_OUTPUT
echo "create cramfs image" >> $TS_OUTPUT
$TS_CMD_MKCRAMFS -n $LABEL $IMAGE_DATA $IMAGE 2>&1 >> $TS_OUTPUT
-
-if [ ! -s "$IMAGE" ]; then
- echo "Cannot create $IMAGE" >> $TS_OUTPUT
- ts_finalize
-fi
+[ -s "$IMAGE" ] || ts_die "Cannot create $IMAGE"
echo "count MD5 from the image" >> $TS_OUTPUT
md5sum $IMAGE 2>&1 >> $TS_OUTPUT
@@ -75,26 +71,18 @@ DEVICE=$( $TS_CMD_LOSETUP -f )
$TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT
echo "check the image" >> $TS_OUTPUT
-if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "cramfs" ]; then
- echo "Cannot found cramfs on $DEVICE" >> $TS_OUTPUT
- ts_finalize
-fi
+ts_device_has "TYPE" "cramfs" $DEVICE
+[ "$?" == "0" ] || ts_die "Cannot found cramfs on $DEVICE" $DEVICE
-ts_udev_loop_support $LABEL
-if [ "$?" != "0" ]; then
- ts_device_deinit;
- ts_skip "udev ignores /dev/loop*"
-fi
+ts_udev_dev_support "by-label" $LABEL
+[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE
echo "mount the image" >> $TS_OUTPUT
$TS_CMD_MOUNT -L $LABEL $MOUNTPOINT 2>&1 >> $TS_OUTPUT
# check it
grep -q $DEVICE /proc/mounts
-
-if [ "$?" != "0" ]; then
- echo "Cannot found $DEVICE in /proc/mounts" >> $TS_OUTPUT
-fi
+[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
echo "list the image" >> $TS_OUTPUT
ls -laR $MOUNTPOINT >> $TS_OUTPUT