From e89450921f693d0545ce64c81174fee5d5e11d03 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sun, 17 May 2020 10:46:34 +0200 Subject: [PATCH] test: fix public/private image detection and prefer the latter one --- test/test-functions | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/test/test-functions b/test/test-functions index 79130c3984..0df8896fd6 100644 --- a/test/test-functions +++ b/test/test-functions @@ -329,12 +329,13 @@ systemd.wants=testsuite-$1.service ${_end} \ $KERNEL_APPEND \ " + [ -e "$IMAGE_PRIVATE" ] && image="$IMAGE_PRIVATE" || image="$IMAGE_PUBLIC" QEMU_OPTIONS="-smp $QEMU_SMP \ -net none \ -m $QEMU_MEM \ -nographic \ -kernel $KERNEL_BIN \ --drive format=raw,cache=unsafe,file=${IMAGESTATEDIR}/${IMAGE_NAME}.img \ +-drive format=raw,cache=unsafe,file=$image \ $QEMU_OPTIONS \ " @@ -692,16 +693,14 @@ create_empty_image() { _size=$((4*_size)) fi - image="${TESTDIR}/${IMAGE_NAME}.img" - public="$IMAGESTATEDIR/${IMAGE_NAME}.img" - echo "Setting up $public (${_size} MB)" - rm -f "$image" "$public" + echo "Setting up $IMAGE_PUBLIC (${_size} MB)" + rm -f "$IMAGE_PRIVATE" "$IMAGE_PUBLIC" # Create the blank file to use as a root filesystem - truncate -s "${_size}M" "$image" - ln -vs "$(realpath $image)" "$public" + truncate -s "${_size}M" "$IMAGE_PRIVATE" + ln -vs "$(realpath $IMAGE_PRIVATE)" "$IMAGE_PUBLIC" - LOOPDEV=$(losetup --show -P -f "$public") + LOOPDEV=$(losetup --show -P -f "$IMAGE_PUBLIC") [ -b "$LOOPDEV" ] || return 1 sfdisk "$LOOPDEV" <