mbox series

[v2,00/31] tests/functional: various improvements wrt assets/scratch files

Message ID 20241211172648.2893097-1-berrange@redhat.com (mailing list archive)
Headers show
Series tests/functional: various improvements wrt assets/scratch files | expand

Message

Daniel P. Berrangé Dec. 11, 2024, 5:26 p.m. UTC
This series is an attempt to bring a little more guaranteed order
to asset and scratch file handling in the functional tests. The
main highlights are:

 * Add custom @skipXXXXX decorators for common scenarios
   present in QEMU tests

 * Add helpers for creating file paths for various well
   known types of data, or well known locations, to avoid
   adhoc path manipulation

 * Add helpers to simplify uncompressing and extracting
   archives, from files downloaded as assets

The series overall has a neutral diffstat, but if you look at
just test files,  as opposed to the shared infra, you'll see
a significant reduction of lines of code in the tests, and I
believe its easier to read them with less boilerplate.

This is based on:

     https://gitlab.com/thuth/qemu.git tags/pull-request-2024-12-11

Changes in v2:

 * Put archive & uncompress helpers in their own files
 * Have archive_extract & uncompress directly handle
   assets and format detection
 * Drop has_cmd/has_cmds helpers in favour of 'which'
 * Drop obsolete tessract version check
 * Simplify 'which' impl
 * Replace 'run_cmd' with direct use of subprocess
 * Remove even more unused imports
 * Gracefully handle asset download failure by skipping tests
 * Drop redundant hardcoded ./contrib path in virtio GPU test
 * Various docs improvements to decorators
 * Drop formatting change to import statements

Daniel P. Berrangé (31):
  tests/functional: remove many unused imports
  tests/functional: resolve str(Asset) to cache file path
  tests/functional: remove duplicated 'which' function impl
  tests/functional: simplify 'which' implementation
  tests/functional: drop 'tesseract_available' helper
  tests/functional: introduce some helpful decorators
  tests/functional: switch to new test skip decorators
  tests/functional: drop 'has_cmd' and 'has_cmds' helpers
  tests/functional: add helpers for building file paths
  tests/functional: switch over to using self.log_file(...)
  tests/functional: switch over to using self.build_file(...)
  tests/functional: switch over to using self.data_file(...)
  tests/functional: switch over to using self.scratch_file()
  tests/functional: switch over to using self.socket_dir(...)
  tests/functional: remove redundant 'rmtree' call
  tests/functional: move archive handling into new archive.py file
  tests/functional: move uncompress handling into new uncompress.py file
  tests/functional: add common zip_extract helper
  tests/functional: add common deb_extract helper
  tests/functional: let cpio_extract accept filenames
  tests/functional: add a generalized archive_extract
  tests/functional: add 'archive_extract' to QemuBaseTest
  tests/functional: convert tests to new archive_extract helper
  tests/functional: add a generalized uncompress helper
  tests/functional: add 'uncompress' to QemuBaseTest
  tests/functional: convert tests to new uncompress helper
  tests/functional: drop back compat imports from utils.py
  tests/functional: replace 'run_cmd' with subprocess helpers
  tests/functional: remove now unused 'run_cmd' helper
  tests/functional: skip tests if assets are not available
  tests/functional: ignore errors when caching assets, except for 404

 tests/functional/qemu_test/__init__.py        |   9 +-
 tests/functional/qemu_test/archive.py         | 117 ++++++++++
 tests/functional/qemu_test/asset.py           |  26 ++-
 tests/functional/qemu_test/cmd.py             |  76 ++-----
 tests/functional/qemu_test/decorators.py      | 107 +++++++++
 tests/functional/qemu_test/linuxkernel.py     |  30 +--
 tests/functional/qemu_test/tesseract.py       |  21 +-
 tests/functional/qemu_test/testcase.py        | 205 ++++++++++++++++--
 tests/functional/qemu_test/tuxruntest.py      |  19 +-
 tests/functional/qemu_test/uncompress.py      |  83 +++++++
 tests/functional/qemu_test/utils.py           |  45 ----
 tests/functional/test_aarch64_aspeed.py       |  23 +-
 tests/functional/test_aarch64_raspi3.py       |   9 +-
 tests/functional/test_aarch64_raspi4.py       |  21 +-
 tests/functional/test_aarch64_sbsaref.py      |  12 +-
 .../functional/test_aarch64_sbsaref_alpine.py |   1 -
 .../test_aarch64_sbsaref_freebsd.py           |   1 -
 tests/functional/test_aarch64_virt.py         |  14 +-
 tests/functional/test_acpi_bits.py            | 124 ++++-------
 tests/functional/test_alpha_clipper.py        |   6 +-
 tests/functional/test_arm_aspeed.py           |  46 ++--
 tests/functional/test_arm_bflt.py             |  13 +-
 tests/functional/test_arm_bpim2u.py           |  44 ++--
 tests/functional/test_arm_canona1100.py       |  10 +-
 tests/functional/test_arm_collie.py           |   2 +-
 tests/functional/test_arm_cubieboard.py       |  40 ++--
 tests/functional/test_arm_emcraft_sf2.py      |   2 +-
 tests/functional/test_arm_integratorcp.py     |  28 +--
 tests/functional/test_arm_orangepi.py         |  60 +++--
 tests/functional/test_arm_raspi2.py           |  21 +-
 tests/functional/test_arm_smdkc210.py         |  18 +-
 tests/functional/test_arm_sx1.py              |   2 +-
 tests/functional/test_arm_vexpress.py         |  10 +-
 tests/functional/test_linux_initrd.py         |   7 +-
 tests/functional/test_m68k_mcf5208evb.py      |   8 +-
 tests/functional/test_m68k_nextcube.py        |  24 +-
 tests/functional/test_m68k_q800.py            |   5 +-
 .../functional/test_microblaze_s3adsp1800.py  |   9 +-
 .../test_microblazeel_s3adsp1800.py           |  10 +-
 tests/functional/test_mips64el_fuloong2e.py   |  10 +-
 tests/functional/test_mips64el_loongson3v.py  |   8 +-
 tests/functional/test_mips64el_malta.py       |  45 ++--
 tests/functional/test_mips_malta.py           |  19 +-
 tests/functional/test_mipsel_malta.py         |  24 +-
 tests/functional/test_or1k_sim.py             |   7 +-
 tests/functional/test_ppc64_e500.py           |   7 +-
 tests/functional/test_ppc64_hv.py             |  39 +---
 tests/functional/test_ppc64_tuxrun.py         |   7 +-
 tests/functional/test_ppc_40p.py              |   7 +-
 tests/functional/test_ppc_amiga.py            |  20 +-
 tests/functional/test_ppc_bamboo.py           |  15 +-
 tests/functional/test_ppc_mac.py              |   8 +-
 tests/functional/test_ppc_mpc8544ds.py        |   8 +-
 tests/functional/test_ppc_virtex_ml507.py     |  10 +-
 tests/functional/test_rx_gdbsim.py            |  13 +-
 tests/functional/test_s390x_ccw_virtio.py     |   6 +-
 tests/functional/test_s390x_topology.py       |   7 +-
 tests/functional/test_sh4_r2d.py              |  14 +-
 tests/functional/test_sh4eb_r2d.py            |  14 +-
 tests/functional/test_sparc64_sun4u.py        |  11 +-
 tests/functional/test_sparc_sun4m.py          |   7 +-
 tests/functional/test_virtio_gpu.py           |  16 +-
 tests/functional/test_xtensa_lx60.py          |   8 +-
 tests/lcitool/libvirt-ci                      |   2 +-
 64 files changed, 885 insertions(+), 755 deletions(-)
 create mode 100644 tests/functional/qemu_test/archive.py
 create mode 100644 tests/functional/qemu_test/decorators.py
 create mode 100644 tests/functional/qemu_test/uncompress.py