iotests: Fix test 128 for password-less sudo

As of 934659c460, $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 <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Max Reitz 2015-09-25 19:19:24 +02:00 committed by Kevin Wolf
parent 552bb52c4b
commit bb3c801df7

View File

@ -31,6 +31,11 @@ status=1 # failure is the default!
devname="eiodev$$" devname="eiodev$$"
sudo="" sudo=""
_sudo_qemu_io_wrapper()
{
(exec $sudo "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@")
}
_setup_eiodev() _setup_eiodev()
{ {
# This test should either be run as root or with passwordless sudo # This test should either be run as root or with passwordless sudo
@ -76,7 +81,9 @@ TEST_IMG="/dev/mapper/$devname"
echo echo
echo "== reading from error device ==" echo "== reading from error device =="
# Opening image should succeed but the read operation should fail # 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 # success, all done
echo "*** done" echo "*** done"