From: Karel Zak Date: Thu, 25 Oct 2007 22:55:36 +0000 (+0200) Subject: tests: use losetup -s X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32f7216b4c480e140a035c92319e527120d26616;p=util-linux tests: use losetup -s Signed-off-by: Karel Zak --- diff --git a/tests/functions.sh b/tests/functions.sh index 7b555f5f..660e4adf 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -173,15 +173,13 @@ function ts_restore_cache { function ts_device_init { local IMAGE="$TS_OUTDIR/$TS_NAME.img" - local IMAGE_RE=$( echo "$IMAGE" | sed 's:/:\\/:g' ) local DEV="" ts_backup_cache dd if=/dev/zero of="$IMAGE" bs=1M count=5 &> /dev/null - $TS_CMD_LOSETUP -f "$IMAGE" 2>&1 >> $TS_OUTPUT - DEV=$( $TS_CMD_LOSETUP -a | $AWK 'BEGIN {FS=":"} /'$IMAGE_RE'/ { print $1 }' ) + DEV=$($TS_CMD_LOSETUP -s -f "$IMAGE") if [ -z "$DEV" ]; then ts_device_deinit $DEV diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs index 4185184c..d2289676 100755 --- a/tests/ts-cramfs-mkfs +++ b/tests/ts-cramfs-mkfs @@ -28,7 +28,6 @@ set -o pipefail IMAGE="$TS_OUTDIR/cramfs-loop.img" IMAGE_DATA="$TS_OUTDIR/cramfs-data" -IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' ) LABEL="testCramfs" TS_MOUNTPOINT="$TS_OUTDIR/cramfs-mnt" @@ -63,8 +62,7 @@ echo >> $TS_OUTPUT ts_log "create loop device from image" ts_backup_cache -DEVICE=$( $TS_CMD_LOSETUP -f ) -$TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT +DEVICE=$( $TS_CMD_LOSETUP -s -f $IMAGE) ts_log "check the image" ts_device_has "TYPE" "cramfs" $DEVICE