mbox series

[v3,00/10] iotests: Fix 129 and expand 297’s reach

Message ID 20210114170304.87507-1-mreitz@redhat.com (mailing list archive)
Headers show
Series iotests: Fix 129 and expand 297’s reach | expand

Message

Max Reitz Jan. 14, 2021, 5:02 p.m. UTC
Cover letters:
v1: https://lists.nongnu.org/archive/html/qemu-block/2021-01/msg00254.html
v2: https://lists.nongnu.org/archive/html/qemu-block/2021-01/msg00296.html

git:
https://github.com/XanClic/qemu.git fix-129-2-v3
https://git.xanclic.moe/XanClic/qemu.git fix-129-2-v3


Hi,

See the v1 cover letter above for the main point of this series (it’s
just that all patch indices are shifted up by two).


The main change in v2 is the extension of iotest 297 to run pylint and
mypy not only on iotests.py, but on every Python file in the
qemu-iotests/ directory that isn’t part of a skip list.

The main changes in v3 are that 297 is rewritten in Python, that patch 1
is added (which helps tests to pass mypy scrutiny without having to
assert that vital variables such as iotests.test_dir are not None), and
that patch 10 is added (because I was already modifying 300 in patch 1,
so I thought i might as well).


Changes in v3 (from v2):
- Patch 1: Some vital environment variables such as TEST_DIR are
  currently fetched with os.environ.get(), which returns an
  Optional[str] type.  Every test wanting to use them has to assert they
  are not None, or mypy will complain.
  This new patch makes iotests.py use os.environ[] for those vital
  variables instead, which makes them of plain str type.

- Patch 2:
  - Rewrite 297 in Python
  - As in v2, make it check all Python files in qemu-iotests/ by
    default, skipping “only” files given in an explicit list.  This list
    is extremely long right now, but at least patches 9 and 10 make it
    one entry shorter each.
  - Drop the list of checked files from the reference output, because
    that may lead to conflicts when backporting patches etc.

- Patch 9: Drop 'assert iotests.test_dir is not None', because patch 1
  makes that unnecessary.  (Also, some changes in how 297 is treated,
  thanks to the changes in patch 2.)

- Patch 10: When writing patch 1, I looked for iotests that contained
  such 'assert iotests.* is not None' lines, and 300 was the one I
  found.  That made it look to me like it was already written with mypy
  acceptance in mind.  Turned out there were still a couple of things to
  fix, but then I was already working on it and decided there’s no point
  in not making a patch out of it.


git-backport-diff against v2:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/10:[down] 'iotests.py: Assume a couple of variables as given'
002/10:[down] 'iotests/297: Rewrite in Python and extend reach'
003/10:[----] [--] 'iotests: Move try_remove to iotests.py'
004/10:[----] [--] 'iotests/129: Remove test images in tearDown()'
005/10:[----] [--] 'iotests/129: Do not check @busy'
006/10:[----] [--] 'iotests/129: Use throttle node'
007/10:[----] [--] 'iotests/129: Actually test a commit job'
008/10:[----] [--] 'iotests/129: Limit mirror job's buffer size'
009/10:[0007] [FC] 'iotests/129: Clean up pylint and mypy complaints'
010/10:[down] 'iotests/300: Clean up pylint and mypy complaints'


Max Reitz (10):
  iotests.py: Assume a couple of variables as given
  iotests/297: Rewrite in Python and extend reach
  iotests: Move try_remove to iotests.py
  iotests/129: Remove test images in tearDown()
  iotests/129: Do not check @busy
  iotests/129: Use throttle node
  iotests/129: Actually test a commit job
  iotests/129: Limit mirror job's buffer size
  iotests/129: Clean up pylint and mypy complaints
  iotests/300: Clean up pylint and mypy complaints

 tests/qemu-iotests/124        |   8 +--
 tests/qemu-iotests/129        |  72 +++++++++++++---------
 tests/qemu-iotests/297        | 109 +++++++++++++++++++++++++++-------
 tests/qemu-iotests/297.out    |   5 +-
 tests/qemu-iotests/300        |  19 ++++--
 tests/qemu-iotests/iotests.py |  37 ++++++------
 6 files changed, 168 insertions(+), 82 deletions(-)