From 0f3e1575554951bd8f6bf0e63a7658d3e293805b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 15 May 2007 12:34:39 +0200 Subject: [PATCH] tests: fix dependence on blkid The util-linux-ng tests have to be useful with blkid and also with volume_id. Signed-off-by: Karel Zak --- tests/ts-cramfs-mkfs | 15 +++++++++++---- tests/ts-mkswap-doit | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs index 6a9e029d..1f7156ee 100755 --- a/tests/ts-cramfs-mkfs +++ b/tests/ts-cramfs-mkfs @@ -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 diff --git a/tests/ts-mkswap-doit b/tests/ts-mkswap-doit index 6e19b46d..e4b5b763 100755 --- a/tests/ts-mkswap-doit +++ b/tests/ts-mkswap-doit @@ -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 -- 2.39.5