qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using json: in common.rc's TEST_IMG


From: Hanna Czenczek
Subject: Re: Using json: in common.rc's TEST_IMG
Date: Thu, 1 Jun 2023 10:10:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]