]> Git Repo - qemu.git/commitdiff
iotests: Fix test 128 for password-less sudo
authorMax Reitz <[email protected]>
Fri, 25 Sep 2015 17:19:24 +0000 (19:19 +0200)
committerKevin Wolf <[email protected]>
Fri, 2 Oct 2015 11:48:29 +0000 (13:48 +0200)
As of 934659c460d46c948cf348822fda1d38556ed9a4, $QEMU_IO is generally no
longer a program name, and therefore "sudo -n $QEMU_IO" will no longer
work.

Fix this by copying the qemu-io invocation function from common.config,
making it use $sudo for invoking $QEMU_IO_PROG, and then use that
function instead of $QEMU_IO.

Reported-by: Fam Zheng <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
tests/qemu-iotests/128

index e2a0f2f8904b9420e1c5942a594231e5e7859dc8..3d8107d2a34e6c8182b5e5be250611ce577ba771 100755 (executable)
@@ -31,6 +31,11 @@ status=1     # failure is the default!
 devname="eiodev$$"
 sudo=""
 
 devname="eiodev$$"
 sudo=""
 
+_sudo_qemu_io_wrapper()
+{
+    (exec $sudo "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@")
+}
+
 _setup_eiodev()
 {
        # This test should either be run as root or with passwordless sudo
 _setup_eiodev()
 {
        # This test should either be run as root or with passwordless sudo
@@ -76,7 +81,9 @@ TEST_IMG="/dev/mapper/$devname"
 echo
 echo "== reading from error device =="
 # Opening image should succeed but the read operation should fail
 echo
 echo "== reading from error device =="
 # Opening image should succeed but the read operation should fail
-$sudo $QEMU_IO --format "$IMGFMT" --nocache -c "read 0 65536" "$TEST_IMG" | _filter_qemu_io
+_sudo_qemu_io_wrapper --format "$IMGFMT" --nocache \
+                      -c "read 0 65536" "$TEST_IMG" \
+    | _filter_qemu_io
 
 # success, all done
 echo "*** done"
 
 # success, all done
 echo "*** done"
This page took 0.028243 seconds and 4 git commands to generate.