Files
qemu/tests/qemu-iotests/171.out
T
Marc-André Lureau 3c0c7bfeba qemu-io: propagate errors through Error API instead of printf
Convert the qemu-io command infrastructure to use QEMU's Error API
(Error **errp) for error propagation instead of printing directly to
stdout/stderr via printf/fprintf.

The cfunc_t typedef, all ~35 command functions, the dispatcher chain
(command/init_check_command/qemuio_command), and helper functions
(parse_pattern, create_iovec, qemu_io_alloc_from_file) all gain an
Error **errp parameter. Async completion callbacks (aio_read_done,
aio_write_done, aio_discard_done) use error_report() since they have
no Error path back to the caller.

Update tests:
- error_report_err() prepends qemu-io: prefix
- copy-before-write: check the HMP return value, rather than stdio
- other tests: update to check JSON {"return": "Error: error text"}

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260828-qemu-no-hmp-v5-21-9227de146347@redhat.com>
2026-08-29 12:07:44 +04:00

314 lines
9.0 KiB
Plaintext

QA output created by 171
== test 'offset' option ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4096
write to image
wrote 3584/3584 bytes at offset 0
3.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read the image
read 3584/3584 bytes at offset 0
3.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
check that offset is respected
000001fe: 00 00 0a 0a ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write before image boundary
wrote 1/1 bytes at offset 3583
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write across image boundary
qemu-io: write failed: Input/output error
write at image boundary
qemu-io: write failed: Input/output error
write after image boundary
qemu-io: write failed: Input/output error
writev before/after image boundary
qemu-io: writev failed: Input/output error
read before image boundary
read 1/1 bytes at offset 3583
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read across image boundary
qemu-io: read failed: Input/output error
read at image boundary
qemu-io: read failed: Input/output error
read after image boundary
qemu-io: read failed: Input/output error
readv before/after image boundary
qemu-io: readv failed: Input/output error
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes and check
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000001fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes across image boundary
qemu-io: write failed: Input/output error
write zeroes at image boundary and check
wrote 2/2 bytes at offset 3582
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000ffe: 00 00 ..
read 2/2 bytes at offset 4094
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io: read failed: Input/output error
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard and check
discard 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000001fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard across image boundary
qemu-io: discard failed: Input/output error
discard at image boundary and check
discard 2/2 bytes at offset 3582
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000ffe: 00 00 ..
read 2/2 bytes at offset 4094
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io: read failed: Input/output error
== test 'offset' and 'size' options ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4096
write to image
wrote 2048/2048 bytes at offset 0
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read the image
read 2048/2048 bytes at offset 0
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
check that offset is respected
000001fe: 00 00 0a 0a ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write before image boundary
wrote 1/1 bytes at offset 2047
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write across image boundary
qemu-io: write failed: Input/output error
write at image boundary
qemu-io: write failed: Input/output error
write after image boundary
qemu-io: write failed: Input/output error
writev before/after image boundary
qemu-io: writev failed: Input/output error
read before image boundary
read 1/1 bytes at offset 2047
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read across image boundary
qemu-io: read failed: Input/output error
read at image boundary
qemu-io: read failed: Input/output error
read after image boundary
qemu-io: read failed: Input/output error
readv before/after image boundary
qemu-io: readv failed: Input/output error
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes and check
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000001fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes across image boundary
qemu-io: write failed: Input/output error
write zeroes at image boundary and check
wrote 2/2 bytes at offset 2046
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000009fe: 00 00 ..
read 2/2 bytes at offset 2558
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000a00: 0a 0a ..
read 2/2 bytes at offset 2560
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard and check
discard 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000001fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard across image boundary
qemu-io: discard failed: Input/output error
discard at image boundary and check
discard 2/2 bytes at offset 2046
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000009fe: 00 00 ..
read 2/2 bytes at offset 2558
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000a00: 0a 0a ..
read 2/2 bytes at offset 2560
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== test misaligned 'offset' ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4096
write to image
wrote 2048/2048 bytes at offset 0
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read the image
read 2048/2048 bytes at offset 0
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
check that offset is respected
00000008: 00 00 0a 0a ....
read 4/4 bytes at offset 8
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write before image boundary
wrote 1/1 bytes at offset 2047
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write across image boundary
qemu-io: write failed: Input/output error
write at image boundary
qemu-io: write failed: Input/output error
write after image boundary
qemu-io: write failed: Input/output error
writev before/after image boundary
qemu-io: writev failed: Input/output error
read before image boundary
read 1/1 bytes at offset 2047
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read across image boundary
qemu-io: read failed: Input/output error
read at image boundary
qemu-io: read failed: Input/output error
read after image boundary
qemu-io: read failed: Input/output error
readv before/after image boundary
qemu-io: readv failed: Input/output error
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes and check
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000008: 0a 0a 00 00 ....
read 4/4 bytes at offset 8
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write zeroes across image boundary
qemu-io: write failed: Input/output error
write zeroes at image boundary and check
wrote 2/2 bytes at offset 2046
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000808: 00 00 ..
read 2/2 bytes at offset 2056
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0000080a: 0a 0a ..
read 2/2 bytes at offset 2058
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
fill image with pattern
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard and check
discard 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000008: 0a 0a 00 00 ....
read 4/4 bytes at offset 8
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard across image boundary
qemu-io: discard failed: Input/output error
discard at image boundary and check
discard 2/2 bytes at offset 2046
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000808: 00 00 ..
read 2/2 bytes at offset 2056
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0000080a: 0a 0a ..
read 2/2 bytes at offset 2058
2 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== test reopen ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4096
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1/1 bytes at offset 511
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io: write failed: Input/output error
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1/1 bytes at offset 1023
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io: write failed: Input/output error
checking boundaries
000001fe: 00 00 0a 0a ....
read 4/4 bytes at offset 510
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000003fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 1022
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000005fe: 00 00 0a 0a ....
read 4/4 bytes at offset 1534
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
000009fe: 0a 0a 00 00 ....
read 4/4 bytes at offset 2558
4 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done