提交 9aa711d7 编写于 作者: F Fam Zheng 提交者: Kevin Wolf

qemu-iotests: Fix 128 if sudo required

If passwordless "sudo" works, use it in the qemu-io cmd.
Signed-off-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 ff793890
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册