[Avocado-devel] Tips for making a standalone test script Avocado-friendly?
Eduardo Habkost
ehabkost at redhat.com
Wed Apr 5 13:00:57 UTC 2017
Hi,
I have been writing a few standalone Python scripts[1] to test
QEMU recently, and I would like to make them more useful for
people running tests using Avocado.
Most of them work this way:
1) Query QEMU to check which
architectures/machine-types/CPU-models/devices/options
it supports
2) Run QEMU multiple times for each
architectures/machine-types/CPU-models/devices/options
combination I want to test
3) Report success/failure/skip results (sometimes including
warnings) for each combination
I would like to keep the test scripts easy to run without
installing extra dependencies, so I want them to keep working as
standalone scripts even if Avocado modules aren't available.
Adding a few "if avocado_available:" lines to the script would be
OK, though.
Do you have any suggestions for making the test result output
from those scripts easily consumable by the Avocado test runner?
[1] Some examples:
https://github.com/ehabkost/qemu-hacks/blob/work/device-crash-script/scripts/device-crash-test.py
https://github.com/ehabkost/qemu-hacks/blob/work/x86-query-cpu-expansion-test/tests/query-cpu-model-test.py
https://github.com/ehabkost/qemu-hacks/blob/work/query-machines-bus-info/tests/qmp-machine-info.py
(Note that some of the scripts use the unittest module, but I
will probably get rid of it, because the list of test cases I
want to run will be generated at runtime. I've even wrote
code to add test methods dynamically to the test class, but I
will probably remove that hack because it's not worth the
extra complexity)
--
Eduardo
More information about the Avocado-devel
mailing list