]> err.no Git - util-linux/commitdiff
tests: fix dependence on blkid
authorKarel Zak <kzak@redhat.com>
Tue, 15 May 2007 10:34:39 +0000 (12:34 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 18 May 2007 11:09:12 +0000 (13:09 +0200)
The util-linux-ng tests have to be useful with blkid and also with
volume_id.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests/ts-cramfs-mkfs
tests/ts-mkswap-doit

index 6a9e029d139dd9e6612a76ca3248b386778c57a3..1f7156ee395c3d457c6c849906ef227b1feedc5f 100755 (executable)
@@ -40,6 +40,11 @@ IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' )
 LABEL="testCramfs"
 MOUNTPOINT="$TS_OUTDIR/cramfs-mnt"
 
+ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT
+if [ "$?" == "0" ]; then
+       HAS_VOLUMEID="yes"
+fi
+
 echo "create mountpoint dir" >> $TS_OUTPUT
 if [ ! -d "$MOUNTPOINT" ]; then
        mkdir -p $MOUNTPOINT
@@ -78,15 +83,17 @@ echo "create loop device from image" >> $TS_OUTPUT
 DEVICE=$( $TS_CMD_LOSETUP -f )
 $TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT
 
-
 echo "check the image" >> $TS_OUTPUT
-blkid -c /dev/null -w /dev/null -s TYPE $DEVICE 2>&1 | grep -q 'TYPE="cramfs"' 2>&1 >> $TS_OUTPUT
-
-if [ "$?" != "0" ]; then
+if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "cramfs" ]; then
        echo "Cannot found cramfs on $DEVICE" >> $TS_OUTPUT
        ts_finalize
 fi
 
+if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then
+       $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
+       ts_skip "udev ignores /dev/loop*"
+fi
+
 echo "mount the image" >> $TS_OUTPUT
 $TS_CMD_MOUNT -L $LABEL $MOUNTPOINT 2>&1 >> $TS_OUTPUT
 
index 6e19b46ddcab95638f53c0e8f0f774ffecced3cb..e4b5b76326cfbc30beb5e47c6e8a74e9638e817f 100755 (executable)
@@ -38,6 +38,11 @@ IMAGE="$TS_OUTDIR/loop-swap.img"
 IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' )
 LABEL="testSwap"
 
+ldd $TS_CMD_SWAPON | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT
+if [ "$?" == "0" ]; then
+       HAS_VOLUMEID="yes"
+fi
+
 dd if=/dev/zero of=$IMAGE bs=1M count=20 &> /dev/null
 
 DEVICE=$( $TS_CMD_LOSETUP -f )
@@ -54,14 +59,17 @@ $TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT
 $TS_CMD_MKSWAP -L $LABEL $DEVICE 2>&1 >> $TS_OUTPUT
 
 # check it
-blkid -c /dev/null -w /dev/null -s TYPE $DEVICE 2>&1 | grep -q 'TYPE="swap"' 2>&1 >> $TS_OUTPUT
-
-if [ "$?" != "0" ]; then
+if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "swap" ]; then
        echo "Cannot found Linux swap on $DEVICE" >> $TS_OUTPUT
-       #$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
+       $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
        ts_finalize
 fi
 
+if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then
+       $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
+       ts_skip "udev ignores /dev/loop*"
+fi
+
 # try connect it to system (and found the device by label)
 $TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT