All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-block@nongnu.org, stefanha@redhat.com, afaria@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] iotests: Add loop-accept-ro-dev test
Date: Thu, 29 Oct 2026 17:42:58 +0100	[thread overview]
Message-ID: <auN3kgjhETZk-E4v@redhat.com> (raw)
In-Reply-To: <auI24QU96wyzXYEN@redhat.com>

Am 28.10.2026 um 19:10 hat Eric Blake geschrieben:
> On Wed, Oct 28, 2026 at 06:10:57PM +0100, Kevin Wolf wrote:
> > Add a test for the accept-read-only-device option of host_device.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  tests/qemu-iotests/tests/loop-accept-ro-dev   | 87 +++++++++++++++++++
> >  .../qemu-iotests/tests/loop-accept-ro-dev.out | 19 ++++
> >  2 files changed, 106 insertions(+)
> >  create mode 100755 tests/qemu-iotests/tests/loop-accept-ro-dev
> >  create mode 100644 tests/qemu-iotests/tests/loop-accept-ro-dev.out
> > 
> 
> > +
> > +run_qemu()
> > +{
> > +    echo -e '{"execute":"qmp_capabilities"}\n{"execute":"quit"}' |
> 
> 'printf %s' is slightly more portable than 'echo -e'; even though this
> script uses /bin/bash, you can use 'shopt -s xpg_echo' to break the
> latter. On the other hand, this is copy-paste from other tests, so not
> a showstopper.

Given that I have to fix the test anyway, I'll change it.

> > +    do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp |
> > +        _filter_generated_node_ids | _filter_imgfmt |
> > +        _filter_actual_image_size | _filter_img_info
> > +}
> > +
> > +if ! sudo -n losetup &>/dev/null; then
> > +    _notrun "sudo losetup not available"
> > +fi
> 
> Huh - we seem to have several outstanding patches related to probing
> whether losetup is usable:
> 
> https://lists.nongnu.org/archive/html/qemu-devel/2026-10/msg02963.html
> https://lists.nongnu.org/archive/html/qemu-devel/2026-10/msg01918.html
> 
> Is this a common enough pattern in our qemu-iotests that we should
> factor it out?

Maybe. There seem to be four tests (including this one) that use
losetup. This can be done in a separate patch, though.

> > +++ b/tests/qemu-iotests/tests/loop-accept-ro-dev.out
> > @@ -0,0 +1,19 @@
> > +QA output created by loop-accept-ro-dev
> > +
> > +=== Start QEMU on a loop device after blockdev --setro ===
> > +
> > +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
> > +Testing: -blockdev host_device,node-name=disk,filename=/dev/loop1 -device virtio-blk,drive=disk
> > +QEMU_PROG: -blockdev host_device,node-name=disk,filename=/dev/loop1: The device is not writable: Permission denied
> > +
> > +Testing: -blockdev host_device,node-name=disk,filename=/dev/loop1,accept-read-only-device=off -device virtio-blk,drive=disk
> 
> /dev/loop1 might already be busy, at which point losetup will pick
> /dev/loop2 or similar. This output needs to be filtered.

Oops, I'm too used to qemu-iotests filtering out all the filenames, but
obviously that doesn't work for something outside the scratch directory.
Thanks!

Kevin



  reply	other threads:[~2026-10-29 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 17:10 [PATCH 0/2] file-posix: Add 'accept-read-only-device' option Kevin Wolf
2026-10-28 17:10 ` [PATCH 1/2] " Kevin Wolf
2026-10-28 17:54   ` Eric Blake
2026-10-28 17:10 ` [PATCH 2/2] iotests: Add loop-accept-ro-dev test Kevin Wolf
2026-10-28 18:10   ` Eric Blake
2026-10-29 16:42     ` Kevin Wolf [this message]
2026-10-28 19:49 ` [PATCH 0/2] file-posix: Add 'accept-read-only-device' option Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auN3kgjhETZk-E4v@redhat.com \
    --to=kwolf@redhat.com \
    --cc=afaria@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.