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: Kevin Wolf
Subject: Re: Using json: in common.rc's TEST_IMG
Date: Thu, 1 Jun 2023 10:29:25 +0200

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




reply via email to

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