mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
ff793890fa
commit
9aa711d750
|
@ -29,6 +29,7 @@ tmp=/tmp/$$
|
||||||
status=1 # failure is the default!
|
status=1 # failure is the default!
|
||||||
|
|
||||||
devname="eiodev$$"
|
devname="eiodev$$"
|
||||||
|
sudo=""
|
||||||
|
|
||||||
_setup_eiodev()
|
_setup_eiodev()
|
||||||
{
|
{
|
||||||
|
@ -37,6 +38,7 @@ _setup_eiodev()
|
||||||
echo "0 $((1024 * 1024 * 1024 / 512)) error" | \
|
echo "0 $((1024 * 1024 * 1024 / 512)) error" | \
|
||||||
$cmd dmsetup create "$devname" 2>/dev/null
|
$cmd dmsetup create "$devname" 2>/dev/null
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
|
sudo="$cmd"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -74,7 +76,7 @@ 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
|
||||||
$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
|
# success, all done
|
||||||
echo "*** done"
|
echo "*** done"
|
||||||
|
|
Loading…
Reference in New Issue