On 3/28/19 3:20 AM, Vladimir Sementsov-Ogievskiy wrote: > 28.03.2019 1:39, Eric Blake wrote: >> Add a test for the NBD client workaround in the previous patch. It's >> not really feasible for an iotest to assume a specific tracing engine, >> so we can't really probe for the new >> trace_nbd_parse_blockstatus_compliance to see if the server was fixed >> vs. whether the client just worked around the server (other than by >> rearranging order between code patches and this test). But having a >> successful exchange sure beats the previous state of an error message. >>
>> +seq="$(basename $0)"
>> +echo "QA output created by $seq"
>> +
>> +status=1 # failure is the default!
>> +
>> +nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
>> +rm -f "${TEST_DIR}/qemu-nbd.pid"
>
> hmm, strange that we need to remove something from test directory at start.
Well, until we follow through with our thread of implementing per-test
scratch directories for iotests, it proved invaluable to me during
testing (as a failed test does not properly clean up after itself).
>> +# can't use _make_test_img, because qemu-img rounds image size up,
>> +# and because we want to use Unix socket rather than TCP port. Likewise,
>> +# we have to redirect TEST_IMG to our server.
>> +# This tests that we can deal with the hole at the end of an unaligned
>> +# raw file (either because the server doesn't advertise alignment too
>> +# large, or because the client ignores the server's noncompliance).
>> +printf %01000d 0 > "$TEST_IMG_FILE"
>> +nbd_server_start_unix_socket -f $IMGFMT -e 42 -x '' "$TEST_IMG_FILE"
>
> why do we need -e 42? we don't have more than one client simultaneously..
Matches what other tests use. You are right that I could get away
without it, though.
> and -x '' is the default anyway
Ditto.
>
>> +TEST_IMG="nbd:unix:$nbd_unix_socket"
>> +
>> +$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
>
> is filter needed? seems like not
I'd rather keep the filter (makes it easier to copy-and-paste between
other tests, especially if it does matter down the road)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
