aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-05-19 10:46:13 +0000
committerKevin Wolf <kwolf@redhat.com>2015-06-12 15:54:00 +0200
commit9aa711d75030356f1e179b9f71780da5fd1a45bb (patch)
tree76a944edc37d2e58420fd85345f7cae79d1a8a91 /tests
parentff793890faeb119c8dad53b7ed614407ff7b027a (diff)
qemu-iotests: Fix 128 if sudo required
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>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/1284
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
index 249a865581..e2a0f2f890 100755
--- a/tests/qemu-iotests/128
+++ b/tests/qemu-iotests/128
@@ -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"