]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-iotests: Fix 128 if sudo required
authorFam Zheng <famz@redhat.com>
Tue, 19 May 2015 10:46:13 +0000 (10:46 +0000)
committerKevin Wolf <kwolf@redhat.com>
Fri, 12 Jun 2015 13:54:00 +0000 (15:54 +0200)
If passwordless "sudo" works, use it in the qemu-io cmd.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/qemu-iotests/128

index 249a8655817f89e6308cd2fb198f610c29b2fd50..e2a0f2f8904b9420e1c5942a594231e5e7859dc8 100755 (executable)
@@ -29,6 +29,7 @@ tmp=/tmp/$$
 status=1       # failure is the default!
 
 devname="eiodev$$"
+sudo=""
 
 _setup_eiodev()
 {
@@ -37,6 +38,7 @@ _setup_eiodev()
                echo "0 $((1024 * 1024 * 1024 / 512)) error" | \
                        $cmd dmsetup create "$devname" 2>/dev/null
                if [ "$?" -eq 0 ]; then
+                       sudo="$cmd"
                        return
                fi
        done
@@ -74,7 +76,7 @@ TEST_IMG="/dev/mapper/$devname"
 echo
 echo "== reading from error device =="
 # Opening image should succeed but the read operation should fail
-$QEMU_IO --format "$IMGFMT" --nocache -c "read 0 65536" "$TEST_IMG" | _filter_qemu_io
+$sudo $QEMU_IO --format "$IMGFMT" --nocache -c "read 0 65536" "$TEST_IMG" | _filter_qemu_io
 
 # success, all done
 echo "*** done"