From: Hanna Czenczek <hreitz@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Using json: in common.rc's TEST_IMG
Date: Thu, 1 Jun 2023 10:10:35 +0200 [thread overview]
Message-ID: <391cb112-80da-e8b6-6561-d62adb4a26ba@redhat.com> (raw)
In-Reply-To: <CAJSP0QXpxyVPXieK9W4h+NxK4KNkOvnFD4KvuDMcZ9PLx9Sfvw@mail.gmail.com>
On 31.05.23 21:09, Stefan Hajnoczi wrote:
> Another issue is that 145 uses $TEST_IMG as follows:
>
> SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT
>
> That doesn't work when json: contains a comma, since commas need to be
> doubled up to escape them. This fails:
>
> $ qemu-system-x86_64 -drive
> 'if=none,file=json:{"driver":"io_uring","filename":"test.img"}'
> qemu-system-x86_64: -drive
> if=none,file=json:{"driver":"io_uring","filename":"test.img"}:
> warning: short-form boolean option '"filename":"test.img"}' deprecated
> Please use "filename":"test.img"}=on instead
>
> This works:
>
> qemu-system-x86_64 -drive
> 'if=none,file=json:{"driver":"io_uring",,"filename":"test.img"}'
>
> Maybe it's simply not possible to use TEST_IMG=json: in qemu-iotests?
Probably not as-is. None of the tests has been written with that in
mind, and many have been written at a time where TEST_IMG was basically
always a plain filename. We’ve had a lot of churn in the past e.g. to
separate TEST_IMG_FILE out from TEST_IMG, and I suspect if you want
json:{} to work, that would be even more churn.
Admittedly I don’t remember how it’s to be done, but looking at the code
(common.rc starting from line 274), it seems clear what other protocols
do: If $IMGOPTSSYNTAX is true, use a dotted-key-value syntax; and
otherwise, make use of the protocol prefix. Now, "io_uring:test.img"
doesn’t work, because while bdrv_io_uring has .protocol_name set, it
doesn’t implement .bdrv_parse_filename(). file-posix for example does
(see raw_parse_filename()), and all it does is to strip the protocol prefix.
So I think you should be able to get the non-IMGOPTSSYNTAX case to work
by adding a trivial .bdrv_parse_filename() implementation to each blkio
driver, which just strips the protocol prefix, and then use
"io_uring:$TEST_IMG_FILE".
Hanna
> The alternative is to always set IMGOPTSSYNTAX=true and then find the
> test cases that fail because they contain non-IMGOPTSSYNTAX commands.
>
> Stefan
>
next parent reply other threads:[~2023-06-01 8:11 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 ` Hanna Czenczek [this message]
2023-06-01 8:29 ` Using json: in common.rc's TEST_IMG Kevin Wolf
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=391cb112-80da-e8b6-6561-d62adb4a26ba@redhat.com \
--to=hreitz@redhat.com \
--cc=kwolf@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).