]> err.no Git - util-linux/commitdiff
tests: redirect libblkid cache to BLKID_FILE
authorKarel Zak <kzak@redhat.com>
Thu, 6 Dec 2007 21:46:00 +0000 (22:46 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 6 Dec 2007 21:46:00 +0000 (22:46 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/functions.sh
tests/ts-cramfs-mkfs

index 660e4adfea97e8eba07ceffaf2666a707ea63a2e..5857731521377ab965936bad051b66cfe8f4a3af 100644 (file)
@@ -83,20 +83,15 @@ function ts_init {
        TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME"
        TS_INPUT="$TS_INPUTDIR/$TS_NAME"
        TS_MOUNTPOINT="$(pwd)/$TS_OUTDIR/${TS_NAME}_mnt"
-       TS_BLKIDCACHE=""
        TS_HAS_VOLUMEID="no"
+       BLKID_FILE="$TS_OUTDIR/$TS_NAME.blkidtab"
+
+       export BLKID_FILE
 
        ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' &> /dev/null
        if [ "$?" == "0" ]; then
                TS_HAS_VOLUMEID="yes"
        fi
-       if [ "$TS_HAS_VOLUMEID" != "yes" ]; then
-               if [ -f "/etc/blkid/blkid.tab" ]; then
-                       TS_BLKIDCACHE="/etc/blkid/blkid.tab"
-               elif [ -f "/etc/blkid.tab" ]; then
-                       TS_BLKIDCACHE="/etc/blkid.tab"
-               fi
-       fi
 
        rm -f $TS_OUTPUT
        touch $TS_OUTPUT
@@ -155,28 +150,10 @@ function ts_die {
        ts_finalize
 }
 
-function ts_backup_cache {
-       if [ "$TS_HAS_VOLUMEID" != "yes" ] && [ -f "$TS_BLKIDCACHE" ]; then
-               cp $TS_BLKIDCACHE $OUTDIR/$TS_NAME.cache
-       fi
-}
-
-function ts_restore_cache {
-       if [ "$TS_HAS_VOLUMEID" !=  "yes" ] && [ -f "$TS_BLKIDCACHE" ] && [ -s "$OUTDIR/$TS_NAME.cache" ]; then
-               # We have to remove the device from cache otherwise
-               # libblkid will reuse cached information. The cache
-               # refresh time is 2 seconds -- that's too long. We
-               # re-use the same device more quickly.  --kzak
-               mv -f $OUTDIR/$TS_NAME.cache $TS_BLKIDCACHE
-       fi
-}
-
 function ts_device_init {
        local IMAGE="$TS_OUTDIR/$TS_NAME.img"
        local DEV=""
 
-       ts_backup_cache
-
        dd if=/dev/zero of="$IMAGE" bs=1M count=5 &> /dev/null
 
        DEV=$($TS_CMD_LOSETUP -s -f "$IMAGE")
@@ -198,7 +175,6 @@ function ts_device_deinit {
        if [ -b "$DEV" ]; then
                $TS_CMD_UMOUNT "$DEV" &> /dev/null
                $TS_CMD_LOSETUP -d "$DEV" &> /dev/null
-               ts_restore_cache
        fi
 }
 
index d228967639abd74573b4323792d666f7397cac21..c120a25fe286927bada196c07aafb2b1c2888bea 100755 (executable)
@@ -61,7 +61,6 @@ md5sum $IMAGE 2>&1 >> $TS_OUTPUT
 echo >> $TS_OUTPUT
 
 ts_log "create loop device from image"
-ts_backup_cache
 DEVICE=$( $TS_CMD_LOSETUP -s -f $IMAGE)
 
 ts_log "check the image"
@@ -89,6 +88,5 @@ echo >> $TS_OUTPUT
 ts_log "umount the image"
 $TS_CMD_UMOUNT $DEVICE
 $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
-ts_restore_cache
 ts_finalize