Skip to contentSkip to conversation

iotests: Fix test 128 for password-less sudo

PATCH In review Max Reitz 3 participants 3 messages Sep 25, 2015 – Oct 1, 2015

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 iotests: Fix test 128 for password-less sudo

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.

---
 tests/qemu-iotests/128 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tests/qemu-iotests/128 +8 -1
index e2a0f2f..3d8107d 100755
@@ -31,6 +31,11 @@ status=1	# failure is the default!
 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
@@ -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
-$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"
Signature · 1 line
2.5.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Max Reitz

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.

Quoted 5 lines
---
 tests/qemu-iotests/128 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
In reply to Max Reitz

Am 25.09.2015 um 19:19 hat Max Reitz geschrieben:

Quoted 10 lines

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.

I just noticed that this is in my branch, but I don't seem to have sent an email yet. So thanks, applied to the block branch.

Kevin