The basic idea is to make a generic job runtime manager and allow callers to subclass the manager. Then, instead of adding callback arguments to the function all the time, we have à la carte customization of the loop.
To showcase this a little bit, I removed the pre_finalization argument and made existing callers use a custom JobRunner; and then converted test 040 to use this style of job runner. Is it a simplification? No. Is it cool? Maybe. Did it remove the duplicated job-running code in 040? yes. As of V4, I'm not sure I really want to pursue this at the moment; it does feel a bit harder to use than the old interface; though it's more "complete". I might look into refining the idea and trying to include it directly in python/qemu; and providing some more 'bespoke' wrappers in iotests that make using it in the test framework a little less cumbersome. Regardless, I am posting it to the list for archiving for now. v4: - Rebased on current master. - Converted new usages is test 055. V3: - Rebased on logging series v8 - Converted 155's new usage of job_run V2: - Rebased on logging series; logging conditionals are pretty now. - Inlined callback login in 257 - No longer based on bitmap-populate job (no test 287) - Moved super() call to the beginning of test 040's callback - Added docstrings and type annotations John Snow (3): qmp.py: change event_wait to use a dict iotests: add JobRunner class iotests: modify test 040 to use JobRunner python/qemu/machine.py | 10 +- tests/qemu-iotests/040 | 51 +++++---- tests/qemu-iotests/055 | 17 +-- tests/qemu-iotests/155 | 11 +- tests/qemu-iotests/255 | 9 +- tests/qemu-iotests/257 | 54 +++++---- tests/qemu-iotests/260 | 5 +- tests/qemu-iotests/iotests.py | 206 +++++++++++++++++++++++++--------- tests/qemu-iotests/pylintrc | 11 ++ 9 files changed, 258 insertions(+), 116 deletions(-) -- 2.21.1