Hi Lucas,
The Python script below verifies the image streaming feature. It's
built on the standard library "unittest" module, as well as QEMU's
qmp.py module. It spawns a qemu process and creates necessary disk
image files. The tests themselves issue QMP commands and check their
result or wait for QMP events to be raised.
I think this sort of test could be done with kvm-autotest but I don't
see much usage of cmd_qmp() in client/tests/kvm/tests/. I'm curious
how you would approach this. The high-level steps are:
1. Create a backing file.
2. Create a test QED image file using the backing file.
3. Issue "block_stream device=drive0" to the running VM. This should
return no value.
4. Wait for the BLOCK_JOB_COMPLETED QMP event and check its fields -
they must contain expected values.
5. Ensure "query-block-job" does not show any active jobs anymore.
6. Use qemu-io's map command to verify that the image stays compact
and isn't bloated with actual zero bytes (this is kind of unrelated to
the rest of the test).
The other test cases share much of the same building blocks as
TestSingleDrive, so they are less interesting.
Would it be possible to look at TestSingleDrive below and give a
kvm-autotest equivalent?