qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Hanna Reitz <hreitz@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Using json: in common.rc's TEST_IMG
Date: Thu, 1 Jun 2023 10:29:25 +0200	[thread overview]
Message-ID: <ZHhW5Qff1p2x0oB+@redhat.com> (raw)
In-Reply-To: <CAJSP0QX5XFw81XrHHn9p1pX+1y7tc+xMJLVx9YgRsMCkUwjW7Q@mail.gmail.com>

Am 31.05.2023 um 21:00 hat Stefan Hajnoczi geschrieben:
> Hi Hanna,
> I'm adding the io_uring block driver (block/blkio.c) to qemu-iotests
> and hit a syntax issue with json:.
> 
> In tests/qemu-iotests/common.rc where TEST_IMG_FILE and TEST_IMG are
> defined for each IMGPROTO, I'm unable to come up with a TEST_IMG that
> works with all test cases. Some test cases want:
> 
>   TEST_IMG="json:{\"file.driver\":\"io_uring\",\"file.filename\":\"$TEST_IMG_FILE\"}"
> 
> While others want:
> 
>   TEST_IMG="json:{\"driver\":\"io_uring\",\"filename\":\"$TEST_IMG_FILE\"}"
> 
> It seems to depend on how TEST_IMG is used by the tests.

The first one makes more sense, doesn't the second one override the
image format and effectively use raw images by going to the protocol
driver directly?

But should we use json: at all? All the other protocols don't make use
of it, but just use the real protocol prefix, i.e. what I would expect
here is io_uring:/foo/bar (which is already covered by the else branch
in common.rc).

Maybe this doesn't work currently for the libblkio block driver because
it doesn't implement .bdrv_parse_filename, but it would be nice to
support for human users anyway, so maybe just implement it as a small
wrapper around bdrv_parse_filename_strip_prefix()?

> For example, 001 works with the first version. When I use the second
> version it fails with:
> 
>   qemu-io: can't open device
> json:{"driver":"io_uring","filename":"/home/stefanha/qemu/build/scratch/raw-io_uring-001/t.raw"}:
> A block device must be specified for "file"
> 
> The opposite is true for 077, which works with the second version but
> fails as follows with the first version:
> 
>   qemu-io: can't open device
> blkdebug::json:{"file.driver":"io_uring","file.filename":"/home/stefanha/qemu/build/scratch/raw-io_uring-077/t.raw"}:
> Must specify either driver or file
> 
> This only seems to happen with json: because the other protocols use
> TEST_IMG=nfs://... and so on without any problems.
> 
> Any ideas?

Another problem I remember with json: is that you need different
escaping in qemu-img and -drive in qemu-system-*: The latter requires
commas to be doubled.

So with a single $TEST_IMG, you won't be able to cover both the tools
and the system emulator anyway.

Kevin



  parent reply	other threads:[~2023-06-01  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJSP0QX5XFw81XrHHn9p1pX+1y7tc+xMJLVx9YgRsMCkUwjW7Q@mail.gmail.com>
     [not found] ` <CAJSP0QXpxyVPXieK9W4h+NxK4KNkOvnFD4KvuDMcZ9PLx9Sfvw@mail.gmail.com>
2023-06-01  8:10   ` Using json: in common.rc's TEST_IMG Hanna Czenczek
2023-06-01  8:29 ` Kevin Wolf [this message]
2023-06-01  9:46   ` 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=ZHhW5Qff1p2x0oB+@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).