diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-11-08 18:50:09 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-11-08 18:50:09 +0100 |
commit | 114f3c8cc427333dbae331dfd2ecae64676b087e (patch) | |
tree | 6b609b516b20585ab8ad70cd86055c37132fd169 | |
parent | 5e10ccc2706768bcba608f5d174d4079944c270a (diff) | |
parent | b94d00898a9ee708b4d4b79432c2272905a56b06 (diff) | |
download | qemu-114f3c8cc427333dbae331dfd2ecae64676b087e.zip qemu-114f3c8cc427333dbae331dfd2ecae64676b087e.tar.gz qemu-114f3c8cc427333dbae331dfd2ecae64676b087e.tar.bz2 |
Merge remote-tracking branch 'remotes/philmd/tags/avocado-20211108' into staging
Integration testing patches
- Rename tests/acceptance/ -> tests/avocado/
- Rename avocado_qemu.Test -> avocado_qemu.QemuSystemTest
- Introduce QemuUserTest class
- Add the first linux-user test, covering the bFLT loader
# gpg: Signature made Mon 08 Nov 2021 05:16:46 PM CET
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
* remotes/philmd/tags/avocado-20211108:
tests/avocado: Remove p7zip binary availability check
tests/avocado: Rename avocado_qemu.Test -> QemuSystemTest
tests/avocado: Add bFLT loader linux-user test
tests/avocado: Share useful helpers from virtiofs_submounts test
tests/avocado: Introduce QemuUserTest base class
tests/avocado: Make pick_default_qemu_bin() more generic
tests/avocado: Extract QemuBaseTest from Test
tests/acceptance: rename tests acceptance to tests avocado
tests/acceptance: introduce new check-avocado target
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | .gitlab-ci.d/buildtest-template.yml | 2 | ||||
-rw-r--r-- | .gitlab-ci.d/buildtest.yml | 56 | ||||
-rw-r--r-- | MAINTAINERS | 52 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | docs/devel/build-system.rst | 2 | ||||
-rw-r--r-- | docs/devel/ci-definitions.rst.inc | 2 | ||||
-rw-r--r-- | docs/devel/testing.rst | 57 | ||||
-rw-r--r-- | docs/system/arm/orangepi.rst | 8 | ||||
-rw-r--r-- | python/qemu/machine/README.rst | 2 | ||||
-rw-r--r-- | python/qemu/qmp/README.rst | 2 | ||||
-rw-r--r-- | python/qemu/utils/README.rst | 2 | ||||
-rw-r--r-- | tests/Makefile.include | 21 | ||||
-rw-r--r-- | tests/acceptance/README.rst | 10 | ||||
-rw-r--r-- | tests/avocado/README.rst | 10 | ||||
-rw-r--r-- | tests/avocado/avocado_qemu/__init__.py (renamed from tests/acceptance/avocado_qemu/__init__.py) | 163 | ||||
-rw-r--r-- | tests/avocado/boot_linux.py (renamed from tests/acceptance/boot_linux.py) | 0 | ||||
-rw-r--r-- | tests/avocado/boot_linux_console.py (renamed from tests/acceptance/boot_linux_console.py) | 11 | ||||
-rw-r--r-- | tests/avocado/boot_xen.py (renamed from tests/acceptance/boot_xen.py) | 0 | ||||
-rw-r--r-- | tests/avocado/cpu_queries.py (renamed from tests/acceptance/cpu_queries.py) | 4 | ||||
-rw-r--r-- | tests/avocado/empty_cpu_model.py (renamed from tests/acceptance/empty_cpu_model.py) | 4 | ||||
-rw-r--r-- | tests/avocado/hotplug_cpu.py (renamed from tests/acceptance/hotplug_cpu.py) | 0 | ||||
-rw-r--r-- | tests/avocado/info_usernet.py (renamed from tests/acceptance/info_usernet.py) | 4 | ||||
-rw-r--r-- | tests/avocado/intel_iommu.py (renamed from tests/acceptance/intel_iommu.py) | 0 | ||||
-rw-r--r-- | tests/avocado/linux_initrd.py (renamed from tests/acceptance/linux_initrd.py) | 6 | ||||
-rw-r--r-- | tests/avocado/linux_ssh_mips_malta.py (renamed from tests/acceptance/linux_ssh_mips_malta.py) | 5 | ||||
-rw-r--r-- | tests/avocado/load_bflt.py | 54 | ||||
-rw-r--r-- | tests/avocado/machine_arm_canona1100.py (renamed from tests/acceptance/machine_arm_canona1100.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_arm_integratorcp.py (renamed from tests/acceptance/machine_arm_integratorcp.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_arm_n8x0.py (renamed from tests/acceptance/machine_arm_n8x0.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_avr6.py (renamed from tests/acceptance/machine_avr6.py) | 6 | ||||
-rw-r--r-- | tests/avocado/machine_m68k_nextcube.py (renamed from tests/acceptance/machine_m68k_nextcube.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_microblaze.py (renamed from tests/acceptance/machine_microblaze.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_mips_fuloong2e.py (renamed from tests/acceptance/machine_mips_fuloong2e.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_mips_loongson3v.py (renamed from tests/acceptance/machine_mips_loongson3v.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_mips_malta.py (renamed from tests/acceptance/machine_mips_malta.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_rx_gdbsim.py (renamed from tests/acceptance/machine_rx_gdbsim.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_s390_ccw_virtio.py (renamed from tests/acceptance/machine_s390_ccw_virtio.py) | 4 | ||||
-rw-r--r-- | tests/avocado/machine_sparc64_sun4u.py (renamed from tests/acceptance/machine_sparc64_sun4u.py) | 0 | ||||
-rw-r--r-- | tests/avocado/machine_sparc_leon3.py (renamed from tests/acceptance/machine_sparc_leon3.py) | 4 | ||||
-rw-r--r-- | tests/avocado/migration.py (renamed from tests/acceptance/migration.py) | 4 | ||||
-rw-r--r-- | tests/avocado/multiprocess.py (renamed from tests/acceptance/multiprocess.py) | 4 | ||||
-rw-r--r-- | tests/avocado/pc_cpu_hotplug_props.py (renamed from tests/acceptance/pc_cpu_hotplug_props.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_405.py (renamed from tests/acceptance/ppc_405.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_bamboo.py (renamed from tests/acceptance/ppc_bamboo.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_mpc8544ds.py (renamed from tests/acceptance/ppc_mpc8544ds.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_prep_40p.py (renamed from tests/acceptance/ppc_prep_40p.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_pseries.py (renamed from tests/acceptance/ppc_pseries.py) | 4 | ||||
-rw-r--r-- | tests/avocado/ppc_virtex_ml507.py (renamed from tests/acceptance/ppc_virtex_ml507.py) | 4 | ||||
-rw-r--r-- | tests/avocado/replay_kernel.py (renamed from tests/acceptance/replay_kernel.py) | 0 | ||||
-rw-r--r-- | tests/avocado/replay_linux.py (renamed from tests/acceptance/replay_linux.py) | 0 | ||||
-rw-r--r-- | tests/avocado/reverse_debugging.py (renamed from tests/acceptance/reverse_debugging.py) | 0 | ||||
-rw-r--r-- | tests/avocado/smmu.py (renamed from tests/acceptance/smmu.py) | 0 | ||||
-rw-r--r-- | tests/avocado/tcg_plugins.py (renamed from tests/acceptance/tcg_plugins.py) | 0 | ||||
-rw-r--r-- | tests/avocado/tesseract_utils.py (renamed from tests/acceptance/tesseract_utils.py) | 0 | ||||
-rw-r--r-- | tests/avocado/version.py (renamed from tests/acceptance/version.py) | 4 | ||||
-rw-r--r-- | tests/avocado/virtio-gpu.py (renamed from tests/acceptance/virtio-gpu.py) | 4 | ||||
-rw-r--r-- | tests/avocado/virtio_check_params.py (renamed from tests/acceptance/virtio_check_params.py) | 4 | ||||
-rw-r--r-- | tests/avocado/virtio_version.py (renamed from tests/acceptance/virtio_version.py) | 4 | ||||
-rw-r--r-- | tests/avocado/virtiofs_submounts.py (renamed from tests/acceptance/virtiofs_submounts.py) | 59 | ||||
-rw-r--r-- | tests/avocado/virtiofs_submounts.py.data/cleanup.sh (renamed from tests/acceptance/virtiofs_submounts.py.data/cleanup.sh) | 0 | ||||
-rw-r--r-- | tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh (renamed from tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh) | 0 | ||||
-rw-r--r-- | tests/avocado/virtiofs_submounts.py.data/guest.sh (renamed from tests/acceptance/virtiofs_submounts.py.data/guest.sh) | 0 | ||||
-rw-r--r-- | tests/avocado/virtiofs_submounts.py.data/host.sh (renamed from tests/acceptance/virtiofs_submounts.py.data/host.sh) | 0 | ||||
-rw-r--r-- | tests/avocado/vnc.py (renamed from tests/acceptance/vnc.py) | 4 | ||||
-rw-r--r-- | tests/avocado/x86_cpu_model_versions.py (renamed from tests/acceptance/x86_cpu_model_versions.py) | 4 |
65 files changed, 364 insertions, 284 deletions
diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml index fcbcc4e..2c7980a 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -37,7 +37,7 @@ # Avoid recompiling by hiding ninja with NINJA=":" - make NINJA=":" $MAKE_CHECK_ARGS -.acceptance_test_job_template: +.avocado_test_job_template: extends: .native_test_job_template cache: key: "${CI_JOB_NAME}-cache" diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 6c1301e..71d0f40 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -26,14 +26,14 @@ check-system-alpine: IMAGE: alpine MAKE_CHECK_ARGS: check -acceptance-system-alpine: - extends: .acceptance_test_job_template +avocado-system-alpine: + extends: .avocado_test_job_template needs: - job: build-system-alpine artifacts: true variables: IMAGE: alpine - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-system-ubuntu: extends: .native_build_job_template @@ -59,14 +59,14 @@ check-system-ubuntu: IMAGE: ubuntu2004 MAKE_CHECK_ARGS: check -acceptance-system-ubuntu: - extends: .acceptance_test_job_template +avocado-system-ubuntu: + extends: .avocado_test_job_template needs: - job: build-system-ubuntu artifacts: true variables: IMAGE: ubuntu2004 - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-system-debian: extends: .native_build_job_template @@ -91,14 +91,14 @@ check-system-debian: IMAGE: debian-amd64 MAKE_CHECK_ARGS: check -acceptance-system-debian: - extends: .acceptance_test_job_template +avocado-system-debian: + extends: .avocado_test_job_template needs: - job: build-system-debian artifacts: true variables: IMAGE: debian-amd64 - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-system-fedora: extends: .native_build_job_template @@ -125,14 +125,14 @@ check-system-fedora: IMAGE: fedora MAKE_CHECK_ARGS: check -acceptance-system-fedora: - extends: .acceptance_test_job_template +avocado-system-fedora: + extends: .avocado_test_job_template needs: - job: build-system-fedora artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-system-centos: extends: .native_build_job_template @@ -159,14 +159,14 @@ check-system-centos: IMAGE: centos8 MAKE_CHECK_ARGS: check -acceptance-system-centos: - extends: .acceptance_test_job_template +avocado-system-centos: + extends: .avocado_test_job_template needs: - job: build-system-centos artifacts: true variables: IMAGE: centos8 - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-system-opensuse: extends: .native_build_job_template @@ -191,14 +191,14 @@ check-system-opensuse: IMAGE: opensuse-leap MAKE_CHECK_ARGS: check -acceptance-system-opensuse: - extends: .acceptance_test_job_template +avocado-system-opensuse: + extends: .avocado_test_job_template needs: - job: build-system-opensuse artifacts: true variables: IMAGE: opensuse-leap - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado # This jobs explicitly disable TCG (--disable-tcg), KVM is detected by @@ -317,7 +317,7 @@ clang-user: # This can be accomplished by using -enable-slirp=git, which avoids the use of # a system-wide version of the library # -# Split in three sets of build/check/acceptance to limit the execution time of each +# Split in three sets of build/check/avocado to limit the execution time of each # job build-cfi-aarch64: extends: .native_build_job_template @@ -352,14 +352,14 @@ check-cfi-aarch64: IMAGE: fedora MAKE_CHECK_ARGS: check -acceptance-cfi-aarch64: - extends: .acceptance_test_job_template +avocado-cfi-aarch64: + extends: .avocado_test_job_template needs: - job: build-cfi-aarch64 artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-cfi-ppc64-s390x: extends: .native_build_job_template @@ -394,14 +394,14 @@ check-cfi-ppc64-s390x: IMAGE: fedora MAKE_CHECK_ARGS: check -acceptance-cfi-ppc64-s390x: - extends: .acceptance_test_job_template +avocado-cfi-ppc64-s390x: + extends: .avocado_test_job_template needs: - job: build-cfi-ppc64-s390x artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado build-cfi-x86_64: extends: .native_build_job_template @@ -430,14 +430,14 @@ check-cfi-x86_64: IMAGE: fedora MAKE_CHECK_ARGS: check -acceptance-cfi-x86_64: - extends: .acceptance_test_job_template +avocado-cfi-x86_64: + extends: .avocado_test_job_template needs: - job: build-cfi-x86_64 artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-acceptance + MAKE_CHECK_ARGS: check-avocado tsan-build: extends: .native_build_job_template diff --git a/MAINTAINERS b/MAINTAINERS index 797be5b..53b63df 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -177,7 +177,7 @@ L: qemu-arm@nongnu.org S: Maintained F: hw/arm/smmu* F: include/hw/arm/smmu* -F: tests/acceptance/smmu.py +F: tests/avocado/smmu.py AVR TCG CPUs M: Michael Rolnik <mrolnik@gmail.com> @@ -185,7 +185,7 @@ S: Maintained F: docs/system/target-avr.rst F: gdb-xml/avr-cpu.xml F: target/avr/ -F: tests/acceptance/machine_avr6.py +F: tests/avocado/machine_avr6.py CRIS TCG CPUs M: Edgar E. Iglesias <edgar.iglesias@gmail.com> @@ -657,7 +657,7 @@ S: Odd Fixes F: include/hw/arm/digic.h F: hw/*/digic* F: include/hw/*/digic* -F: tests/acceptance/machine_arm_canona1100.py +F: tests/avocado/machine_arm_canona1100.py F: docs/system/arm/digic.rst Goldfish RTC @@ -708,7 +708,7 @@ S: Maintained F: hw/arm/integratorcp.c F: hw/misc/arm_integrator_debug.c F: include/hw/misc/arm_integrator_debug.h -F: tests/acceptance/machine_arm_integratorcp.py +F: tests/avocado/machine_arm_integratorcp.py F: docs/system/arm/integratorcp.rst MCIMX6UL EVK / i.MX6ul @@ -805,7 +805,7 @@ F: include/hw/display/blizzard.h F: include/hw/input/lm832x.h F: include/hw/input/tsc2xxx.h F: include/hw/misc/cbus.h -F: tests/acceptance/machine_arm_n8x0.py +F: tests/avocado/machine_arm_n8x0.py F: docs/system/arm/nseries.rst Palm @@ -1159,7 +1159,7 @@ M: Edgar E. Iglesias <edgar.iglesias@gmail.com> S: Maintained F: hw/microblaze/petalogix_s3adsp1800_mmu.c F: include/hw/char/xilinx_uartlite.h -F: tests/acceptance/machine_microblaze.py +F: tests/avocado/machine_microblaze.py petalogix_ml605 M: Edgar E. Iglesias <edgar.iglesias@gmail.com> @@ -1192,8 +1192,8 @@ F: hw/acpi/piix4.c F: hw/mips/malta.c F: hw/mips/gt64xxx_pci.c F: include/hw/southbridge/piix.h -F: tests/acceptance/linux_ssh_mips_malta.py -F: tests/acceptance/machine_mips_malta.py +F: tests/avocado/linux_ssh_mips_malta.py +F: tests/avocado/machine_mips_malta.py Mipssim R: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com> @@ -1211,7 +1211,7 @@ F: hw/isa/vt82c686.c F: hw/pci-host/bonito.c F: hw/usb/vt82c686-uhci-pci.c F: include/hw/isa/vt82c686.h -F: tests/acceptance/machine_mips_fuloong2e.py +F: tests/avocado/machine_mips_fuloong2e.py Loongson-3 virtual platforms M: Huacai Chen <chenhuacai@kernel.org> @@ -1221,7 +1221,7 @@ F: hw/intc/loongson_liointc.c F: hw/mips/loongson3_bootp.c F: hw/mips/loongson3_bootp.h F: hw/mips/loongson3_virt.c -F: tests/acceptance/machine_mips_loongson3v.py +F: tests/avocado/machine_mips_loongson3v.py Boston M: Paul Burton <paulburton@kernel.org> @@ -1250,7 +1250,7 @@ Bamboo L: qemu-ppc@nongnu.org S: Orphan F: hw/ppc/ppc440_bamboo.c -F: tests/acceptance/ppc_bamboo.py +F: tests/avocado/ppc_bamboo.py e500 L: qemu-ppc@nongnu.org @@ -1271,7 +1271,7 @@ L: qemu-ppc@nongnu.org S: Orphan F: hw/ppc/mpc8544ds.c F: hw/ppc/mpc8544_guts.c -F: tests/acceptance/ppc_mpc8544ds.py +F: tests/avocado/ppc_mpc8544ds.py New World (mac99) M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> @@ -1318,7 +1318,7 @@ F: hw/dma/i82374.c F: hw/rtc/m48t59-isa.c F: include/hw/isa/pc87312.h F: include/hw/rtc/m48t59.h -F: tests/acceptance/ppc_prep_40p.py +F: tests/avocado/ppc_prep_40p.py sPAPR M: David Gibson <david@gibson.dropbear.id.au> @@ -1336,7 +1336,7 @@ F: tests/qtest/spapr* F: tests/qtest/libqos/*spapr* F: tests/qtest/rtas* F: tests/qtest/libqos/rtas* -F: tests/acceptance/ppc_pseries.py +F: tests/avocado/ppc_pseries.py PowerNV (Non-Virtualized) M: Cédric Le Goater <clg@kaod.org> @@ -1356,7 +1356,7 @@ M: Edgar E. Iglesias <edgar.iglesias@gmail.com> L: qemu-ppc@nongnu.org S: Odd Fixes F: hw/ppc/virtex_ml507.c -F: tests/acceptance/ppc_virtex_ml507.py +F: tests/avocado/ppc_virtex_ml507.py sam460ex M: BALATON Zoltan <balaton@eik.bme.hu> @@ -1443,7 +1443,7 @@ R: Yoshinori Sato <ysato@users.sourceforge.jp> S: Orphan F: docs/system/target-rx.rst F: hw/rx/rx-gdbsim.c -F: tests/acceptance/machine_rx_gdbsim.py +F: tests/avocado/machine_rx_gdbsim.py SH4 Machines ------------ @@ -1497,7 +1497,7 @@ F: include/hw/pci-host/sabre.h F: hw/pci-bridge/simba.c F: include/hw/pci-bridge/simba.h F: pc-bios/openbios-sparc64 -F: tests/acceptance/machine_sparc64_sun4u.py +F: tests/avocado/machine_sparc64_sun4u.py Sun4v M: Artyom Tarasenko <atar4qemu@gmail.com> @@ -1513,7 +1513,7 @@ S: Maintained F: hw/sparc/leon3.c F: hw/*/grlib* F: include/hw/*/grlib* -F: tests/acceptance/machine_sparc_leon3.py +F: tests/avocado/machine_sparc_leon3.py S390 Machines ------------- @@ -1528,7 +1528,7 @@ F: include/hw/s390x/ F: hw/watchdog/wdt_diag288.c F: include/hw/watchdog/wdt_diag288.h F: configs/devices/s390x-softmmu/default.mak -F: tests/acceptance/machine_s390_ccw_virtio.py +F: tests/avocado/machine_s390_ccw_virtio.py T: git https://github.com/borntraeger/qemu.git s390-next L: qemu-s390x@nongnu.org @@ -2112,7 +2112,7 @@ M: Alex Bennée <alex.bennee@linaro.org> S: Maintained F: hw/core/guest-loader.c F: docs/system/guest-loader.rst -F: tests/acceptance/boot_xen.py +F: tests/avocado/boot_xen.py Intel Hexadecimal Object File Loader M: Su Hang <suhang16@mails.ucas.ac.cn> @@ -2986,9 +2986,9 @@ F: net/filter-replay.c F: include/sysemu/replay.h F: docs/replay.txt F: stubs/replay.c -F: tests/acceptance/replay_kernel.py -F: tests/acceptance/replay_linux.py -F: tests/acceptance/reverse_debugging.py +F: tests/avocado/replay_kernel.py +F: tests/avocado/replay_linux.py +F: tests/avocado/reverse_debugging.py F: qapi/replay.json IOVA Tree @@ -3105,7 +3105,7 @@ S: Maintained F: docs/devel/tcg-plugins.rst F: plugins/ F: tests/plugin/ -F: tests/acceptance/tcg_plugins.py +F: tests/avocado/tcg_plugins.py F: contrib/plugins/ AArch64 TCG target @@ -3494,14 +3494,14 @@ S: Maintained F: tests/tcg/Makefile F: tests/tcg/Makefile.include -Acceptance (Integration) Testing with the Avocado framework +Integration Testing with the Avocado framework W: https://trello.com/b/6Qi1pxVn/avocado-qemu R: Cleber Rosa <crosa@redhat.com> R: Philippe Mathieu-Daudé <philmd@redhat.com> R: Wainer dos Santos Moschetta <wainersm@redhat.com> R: Willian Rampazzo <willianr@redhat.com> S: Odd Fixes -F: tests/acceptance/ +F: tests/avocado/ Documentation ------------- @@ -3838,7 +3838,7 @@ LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS roms/seabios/Makefile" LINKS="$LINKS pc-bios/qemu-icon.bmp" LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit -LINKS="$LINKS tests/acceptance tests/data" +LINKS="$LINKS tests/avocado tests/data" LINKS="$LINKS tests/qemu-iotests/check" LINKS="$LINKS python" LINKS="$LINKS contrib/plugins/Makefile " diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst index 84282ca..7a83f5f 100644 --- a/docs/devel/build-system.rst +++ b/docs/devel/build-system.rst @@ -416,7 +416,7 @@ number of dynamically created files listed later. ``tests/Makefile.include`` Rules for external test harnesses. These include the TCG tests, - ``qemu-iotests`` and the Avocado-based acceptance tests. + ``qemu-iotests`` and the Avocado-based integration tests. ``tests/docker/Makefile.include`` Rules for Docker tests. Like tests/Makefile, this file is included diff --git a/docs/devel/ci-definitions.rst.inc b/docs/devel/ci-definitions.rst.inc index 32e22ff..6d5c6fd 100644 --- a/docs/devel/ci-definitions.rst.inc +++ b/docs/devel/ci-definitions.rst.inc @@ -59,7 +59,7 @@ to system testing [5]_. Note that, in some cases, system testing may require interaction with third-party software, like operating system images, databases, networks, and so on. -On QEMU, system testing is represented by the 'check-acceptance' target from +On QEMU, system testing is represented by the 'check-avocado' target from 'make'. Flaky tests diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 7500f07..60c5902 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -653,17 +653,16 @@ supported. To start the fuzzer, run Alternatively, some command different from "qemu-img info" can be tested, by changing the ``-c`` option. -Acceptance tests using the Avocado Framework --------------------------------------------- +Integration tests using the Avocado Framework +--------------------------------------------- -The ``tests/acceptance`` directory hosts functional tests, also known -as acceptance level tests. They're usually higher level tests, and -may interact with external resources and with various guest operating -systems. +The ``tests/avocado`` directory hosts integration tests. They're usually +higher level tests, and may interact with external resources and with +various guest operating systems. These tests are written using the Avocado Testing Framework (which must be installed separately) in conjunction with a the ``avocado_qemu.Test`` -class, implemented at ``tests/acceptance/avocado_qemu``. +class, implemented at ``tests/avocado/avocado_qemu``. Tests based on ``avocado_qemu.Test`` can easily: @@ -695,11 +694,11 @@ Tests based on ``avocado_qemu.Test`` can easily: Running tests ~~~~~~~~~~~~~ -You can run the acceptance tests simply by executing: +You can run the avocado tests simply by executing: .. code:: - make check-acceptance + make check-avocado This involves the automatic creation of Python virtual environment within the build tree (at ``tests/venv``) which will have all the @@ -714,12 +713,12 @@ specific version, they may be on packages named ``python3-venv`` and ``python3-pip``. It is also possible to run tests based on tags using the -``make check-acceptance`` command and the ``AVOCADO_TAGS`` environment +``make check-avocado`` command and the ``AVOCADO_TAGS`` environment variable: .. code:: - make check-acceptance AVOCADO_TAGS=quick + make check-avocado AVOCADO_TAGS=quick Note that tags separated with commas have an AND behavior, while tags separated by spaces have an OR behavior. For more information on Avocado @@ -728,31 +727,31 @@ tags, see: https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/tags.html To run a single test file, a couple of them, or a test within a file -using the ``make check-acceptance`` command, set the ``AVOCADO_TESTS`` +using the ``make check-avocado`` command, set the ``AVOCADO_TESTS`` environment variable with the test files or test names. To run all tests from a single file, use: .. code:: - make check-acceptance AVOCADO_TESTS=$FILEPATH + make check-avocado AVOCADO_TESTS=$FILEPATH The same is valid to run tests from multiple test files: .. code:: - make check-acceptance AVOCADO_TESTS='$FILEPATH1 $FILEPATH2' + make check-avocado AVOCADO_TESTS='$FILEPATH1 $FILEPATH2' To run a single test within a file, use: .. code:: - make check-acceptance AVOCADO_TESTS=$FILEPATH:$TESTCLASS.$TESTNAME + make check-avocado AVOCADO_TESTS=$FILEPATH:$TESTCLASS.$TESTNAME The same is valid to run single tests from multiple test files: .. code:: - make check-acceptance AVOCADO_TESTS='$FILEPATH1:$TESTCLASS1.$TESTNAME1 $FILEPATH2:$TESTCLASS2.$TESTNAME2' + make check-avocado AVOCADO_TESTS='$FILEPATH1:$TESTCLASS1.$TESTNAME1 $FILEPATH2:$TESTCLASS2.$TESTNAME2' The scripts installed inside the virtual environment may be used without an "activation". For instance, the Avocado test runner @@ -760,9 +759,9 @@ may be invoked by running: .. code:: - tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/acceptance/ + tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/avocado/ -Note that if ``make check-acceptance`` was not executed before, it is +Note that if ``make check-avocado`` was not executed before, it is possible to create the Python virtual environment with the dependencies needed running: @@ -775,20 +774,20 @@ a test file. To run tests from a single file within the build tree, use: .. code:: - tests/venv/bin/avocado run tests/acceptance/$TESTFILE + tests/venv/bin/avocado run tests/avocado/$TESTFILE To run a single test within a test file, use: .. code:: - tests/venv/bin/avocado run tests/acceptance/$TESTFILE:$TESTCLASS.$TESTNAME + tests/venv/bin/avocado run tests/avocado/$TESTFILE:$TESTCLASS.$TESTNAME Valid test names are visible in the output from any previous execution -of Avocado or ``make check-acceptance``, and can also be queried using: +of Avocado or ``make check-avocado``, and can also be queried using: .. code:: - tests/venv/bin/avocado list tests/acceptance + tests/venv/bin/avocado list tests/avocado Manual Installation ~~~~~~~~~~~~~~~~~~~ @@ -806,16 +805,16 @@ Alternatively, follow the instructions on this link: Overview ~~~~~~~~ -The ``tests/acceptance/avocado_qemu`` directory provides the +The ``tests/avocado/avocado_qemu`` directory provides the ``avocado_qemu`` Python module, containing the ``avocado_qemu.Test`` class. Here's a simple usage example: .. code:: - from avocado_qemu import Test + from avocado_qemu import QemuSystemTest - class Version(Test): + class Version(QemuSystemTest): """ :avocado: tags=quick """ @@ -860,10 +859,10 @@ and hypothetical example follows: .. code:: - from avocado_qemu import Test + from avocado_qemu import QemuSystemTest - class MultipleMachines(Test): + class MultipleMachines(QemuSystemTest): def test_multiple_machines(self): first_machine = self.get_vm() second_machine = self.get_vm() @@ -913,7 +912,7 @@ like this: self.ssh_command('some_command_to_be_run_in_the_guest') Please refer to tests that use ``avocado_qemu.LinuxTest`` under -``tests/acceptance`` for more examples. +``tests/avocado`` for more examples. QEMUMachine ~~~~~~~~~~~ @@ -1204,7 +1203,7 @@ And remove any package you want with:: pip uninstall <package_name> -If you've used ``make check-acceptance``, the Python virtual environment where +If you've used ``make check-avocado``, the Python virtual environment where Avocado is installed will be cleaned up as part of ``make check-clean``. .. _checktcg-ref: diff --git a/docs/system/arm/orangepi.rst b/docs/system/arm/orangepi.rst index 6f23907..c55694d 100644 --- a/docs/system/arm/orangepi.rst +++ b/docs/system/arm/orangepi.rst @@ -250,14 +250,14 @@ and set the following environment variables before booting: Optionally you may save the environment variables to SD card with 'saveenv'. To continue booting simply give the 'boot' command and NetBSD boots. -Orange Pi PC acceptance tests -""""""""""""""""""""""""""""" +Orange Pi PC integration tests +"""""""""""""""""""""""""""""" -The Orange Pi PC machine has several acceptance tests included. +The Orange Pi PC machine has several integration tests included. To run the whole set of tests, build QEMU from source and simply provide the following command: .. code-block:: bash $ AVOCADO_ALLOW_LARGE_STORAGE=yes avocado --show=app,console run \ - -t machine:orangepi-pc tests/acceptance/boot_linux_console.py + -t machine:orangepi-pc tests/avocado/boot_linux_console.py diff --git a/python/qemu/machine/README.rst b/python/qemu/machine/README.rst index ac2b4ff..8de2c3d 100644 --- a/python/qemu/machine/README.rst +++ b/python/qemu/machine/README.rst @@ -2,7 +2,7 @@ qemu.machine package ==================== This package provides core utilities used for testing and debugging -QEMU. It is used by the iotests, vm tests, acceptance tests, and several +QEMU. It is used by the iotests, vm tests, avocado tests, and several other utilities in the ./scripts directory. It is not a fully-fledged SDK and it is subject to change at any time. diff --git a/python/qemu/qmp/README.rst b/python/qemu/qmp/README.rst index c219514..5bfb825 100644 --- a/python/qemu/qmp/README.rst +++ b/python/qemu/qmp/README.rst @@ -3,7 +3,7 @@ qemu.qmp package This package provides a library used for connecting to and communicating with QMP servers. It is used extensively by iotests, vm tests, -acceptance tests, and other utilities in the ./scripts directory. It is +avocado tests, and other utilities in the ./scripts directory. It is not a fully-fledged SDK and is subject to change at any time. See the documentation in ``__init__.py`` for more information. diff --git a/python/qemu/utils/README.rst b/python/qemu/utils/README.rst index 975fbf4..d5f2da1 100644 --- a/python/qemu/utils/README.rst +++ b/python/qemu/utils/README.rst @@ -2,6 +2,6 @@ qemu.utils package ================== This package provides miscellaneous utilities used for testing and -debugging QEMU. It is used primarily by the vm and acceptance tests. +debugging QEMU. It is used primarily by the vm and avocado tests. See the documentation in ``__init__.py`` for more information. diff --git a/tests/Makefile.include b/tests/Makefile.include index 8434a33..4c564cf 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -16,7 +16,7 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) @echo " $(MAKE) check-tcg Run TCG tests" @echo " $(MAKE) check-softfloat Run FPU emulation tests" endif - @echo " $(MAKE) check-acceptance Run acceptance (functional) tests for currently configured targets" + @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets" @echo @echo " $(MAKE) check-report.tap Generates an aggregated TAP test report" @echo " $(MAKE) check-venv Creates a Python venv for tests" @@ -24,7 +24,7 @@ endif @echo @echo "The following are useful for CI builds" @echo " $(MAKE) check-build Build most test binaris" - @echo " $(MAKE) get-vm-images Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)" + @echo " $(MAKE) get-vm-images Downloads all images used by avocado tests, according to configured targets (~350 MB each, 1.5 GB max)" @echo @echo @echo "The variable SPEED can be set to control the gtester speed setting." @@ -83,13 +83,13 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES) # Python venv for running tests -.PHONY: check-venv check-acceptance +.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results ifndef AVOCADO_TESTS - AVOCADO_TESTS=tests/acceptance + AVOCADO_TESTS=tests/avocado endif # Controls the output generated by Avocado when running tests. # Any number of command separated loggers are accepted. For more @@ -127,12 +127,12 @@ get-vm-image-fedora-31-%: check-venv $(call quiet-command, \ $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \ --distro=fedora --distro-version=31 --arch=$*, \ - "AVOCADO", "Downloading acceptance tests VM image for $*") + "AVOCADO", "Downloading avocado tests VM image for $*") # download all vm images, according to defined targets get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) -check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images +check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images $(call quiet-command, \ $(TESTS_VENV_DIR)/bin/python -m avocado \ --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ @@ -140,7 +140,14 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images --filter-by-tags-include-empty-key) \ $(AVOCADO_CMDLINE_TAGS) \ $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ - "AVOCADO", "tests/acceptance") + "AVOCADO", "tests/avocado") + +check-acceptance-deprecated-warning: + @echo + @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead." + @echo + +check-acceptance: check-acceptance-deprecated-warning | check-avocado # Consolidated targets diff --git a/tests/acceptance/README.rst b/tests/acceptance/README.rst deleted file mode 100644 index 89260fa..0000000 --- a/tests/acceptance/README.rst +++ /dev/null @@ -1,10 +0,0 @@ -============================================ -Acceptance tests using the Avocado Framework -============================================ - -This directory contains functional tests, also known as acceptance -level tests. They're usually higher level, and may interact with -external resources and with various guest operating systems. - -For more information, please refer to ``docs/devel/testing.rst``, -section "Acceptance tests using the Avocado Framework". diff --git a/tests/avocado/README.rst b/tests/avocado/README.rst new file mode 100644 index 0000000..9448837 --- /dev/null +++ b/tests/avocado/README.rst @@ -0,0 +1,10 @@ +============================================= +Integration tests using the Avocado Framework +============================================= + +This directory contains integration tests. They're usually higher +level, and may interact with external resources and with various +guest operating systems. + +For more information, please refer to ``docs/devel/testing.rst``, +section "Integration tests using the Avocado Framework". diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index 1841053..75063c0 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -11,13 +11,14 @@ import logging import os import shutil +import subprocess import sys import tempfile import time import uuid import avocado -from avocado.utils import cloudinit, datadrainer, network, ssh, vmimage +from avocado.utils import cloudinit, datadrainer, network, process, ssh, vmimage from avocado.utils.path import find_command #: The QEMU build root directory. It may also be the source directory @@ -27,7 +28,7 @@ from avocado.utils.path import find_command BUILD_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) if os.path.islink(os.path.dirname(os.path.dirname(__file__))): - # The link to the acceptance tests dir in the source code directory + # The link to the avocado tests dir in the source code directory lnk = os.path.dirname(os.path.dirname(__file__)) #: The QEMU root source directory SOURCE_DIR = os.path.dirname(os.path.dirname(os.readlink(lnk))) @@ -41,11 +42,67 @@ from qemu.utils import (get_info_usernet_hostfwd_port, kvm_available, tcg_available) +def has_cmd(name, args=None): + """ + This function is for use in a @avocado.skipUnless decorator, e.g.: + + @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) + def test_something_that_needs_sudo(self): + ... + """ + + if args is None: + args = ('which', name) + + try: + _, stderr, exitcode = run_cmd(args) + except Exception as e: + exitcode = -1 + stderr = str(e) + + if exitcode != 0: + cmd_line = ' '.join(args) + err = f'{name} required, but "{cmd_line}" failed: {stderr.strip()}' + return (False, err) + else: + return (True, '') + +def has_cmds(*cmds): + """ + This function is for use in a @avocado.skipUnless decorator and + allows checking for the availability of multiple commands, e.g.: + + @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), + 'cmd2', 'cmd3')) + def test_something_that_needs_cmd1_and_cmd2(self): + ... + """ + + for cmd in cmds: + if isinstance(cmd, str): + cmd = (cmd,) + + ok, errstr = has_cmd(*cmd) + if not ok: + return (False, errstr) + + return (True, '') + +def run_cmd(args): + subp = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True) + stdout, stderr = subp.communicate() + ret = subp.returncode + + return (stdout, stderr, ret) + def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) -def pick_default_qemu_bin(arch=None): +def pick_default_qemu_bin(bin_prefix='qemu-system-', arch=None): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. @@ -64,7 +121,7 @@ def pick_default_qemu_bin(arch=None): # qemu binary path does not match arch for powerpc, handle it if 'ppc64le' in arch: arch = 'ppc64' - qemu_bin_relative_path = "./qemu-system-%s" % arch + qemu_bin_relative_path = os.path.join(".", bin_prefix + arch) if is_readable_executable_file(qemu_bin_relative_path): return qemu_bin_relative_path @@ -119,7 +176,7 @@ def interrupt_interactive_console_until_pattern(test, success_message, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails :param interrupt_string: a string to send to the console before trying @@ -135,7 +192,7 @@ def wait_for_console_pattern(test, success_message, failure_message=None, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ @@ -147,7 +204,7 @@ def exec_command(test, command): the content. :param test: an Avocado test containing a VM. - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param command: the command to send :type command: str """ @@ -162,14 +219,14 @@ def exec_command_and_wait_for_pattern(test, command, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param command: the command to send :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ _console_interaction(test, success_message, failure_message, command + '\r') -class Test(avocado.Test): +class QemuBaseTest(avocado.Test): def _get_unique_tag_val(self, tag_name): """ Gets a tag value, if unique for a key @@ -179,6 +236,43 @@ class Test(avocado.Test): return vals.pop() return None + def setUp(self, bin_prefix): + self.arch = self.params.get('arch', + default=self._get_unique_tag_val('arch')) + + self.cpu = self.params.get('cpu', + default=self._get_unique_tag_val('cpu')) + + default_qemu_bin = pick_default_qemu_bin(bin_prefix, arch=self.arch) + self.qemu_bin = self.params.get('qemu_bin', + default=default_qemu_bin) + if self.qemu_bin is None: + self.cancel("No QEMU binary defined or found in the build tree") + + def fetch_asset(self, name, + asset_hash=None, algorithm=None, + locations=None, expire=None, + find_only=False, cancel_on_missing=True): + return super().fetch_asset(name, + asset_hash=asset_hash, + algorithm=algorithm, + locations=locations, + expire=expire, + find_only=find_only, + cancel_on_missing=cancel_on_missing) + + +class QemuSystemTest(QemuBaseTest): + """Facilitates system emulation tests.""" + + def setUp(self): + self._vms = {} + + super().setUp('qemu-system-') + + self.machine = self.params.get('machine', + default=self._get_unique_tag_val('machine')) + def require_accelerator(self, accelerator): """ Requires an accelerator to be available for the test to continue @@ -201,24 +295,6 @@ class Test(avocado.Test): self.cancel("%s accelerator does not seem to be " "available" % accelerator) - def setUp(self): - self._vms = {} - - self.arch = self.params.get('arch', - default=self._get_unique_tag_val('arch')) - - self.cpu = self.params.get('cpu', - default=self._get_unique_tag_val('cpu')) - - self.machine = self.params.get('machine', - default=self._get_unique_tag_val('machine')) - - default_qemu_bin = pick_default_qemu_bin(arch=self.arch) - self.qemu_bin = self.params.get('qemu_bin', - default=default_qemu_bin) - if self.qemu_bin is None: - self.cancel("No QEMU binary defined or found in the build tree") - def _new_vm(self, name, *args): self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_") vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir, @@ -272,17 +348,22 @@ class Test(avocado.Test): self._sd = None super().tearDown() - def fetch_asset(self, name, - asset_hash=None, algorithm=None, - locations=None, expire=None, - find_only=False, cancel_on_missing=True): - return super().fetch_asset(name, - asset_hash=asset_hash, - algorithm=algorithm, - locations=locations, - expire=expire, - find_only=find_only, - cancel_on_missing=cancel_on_missing) + +class QemuUserTest(QemuBaseTest): + """Facilitates user-mode emulation tests.""" + + def setUp(self): + self._ldpath = [] + super().setUp('qemu-') + + def add_ldpath(self, ldpath): + self._ldpath.append(os.path.abspath(ldpath)) + + def run(self, bin_path, args=[]): + qemu_args = " ".join(["-L %s" % ldpath for ldpath in self._ldpath]) + bin_args = " ".join(args) + return process.run("%s %s %s %s" % (self.qemu_bin, qemu_args, + bin_path, bin_args)) class LinuxSSHMixIn: @@ -424,11 +505,11 @@ class LinuxDistro: return self._info.get('kernel_params', None) -class LinuxTest(LinuxSSHMixIn, Test): +class LinuxTest(LinuxSSHMixIn, QemuSystemTest): """Facilitates having a cloud-image Linux based available. - For tests that indend to interact with guests, this is a better choice - to start with than the more vanilla `Test` class. + For tests that indent to interact with guests, this is a better choice + to start with than the more vanilla `QemuSystemTest` class. """ timeout = 900 diff --git a/tests/acceptance/boot_linux.py b/tests/avocado/boot_linux.py index ab19146..ab19146 100644 --- a/tests/acceptance/boot_linux.py +++ b/tests/avocado/boot_linux.py diff --git a/tests/acceptance/boot_linux_console.py b/tests/avocado/boot_linux_console.py index 06fc967..9c618d4 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -15,20 +15,13 @@ import shutil from avocado import skip from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import interrupt_interactive_console_until_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive -from avocado.utils.path import find_command, CmdNotFoundError - -P7ZIP_AVAILABLE = True -try: - find_command('7z') -except CmdNotFoundError: - P7ZIP_AVAILABLE = False """ Round up to next power of 2 @@ -46,7 +39,7 @@ def image_pow2ceil_expand(path): with open(path, 'ab+') as fd: fd.truncate(size_aligned) -class LinuxKernelTest(Test): +class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' def wait_for_console_pattern(self, success_message, vm=None): diff --git a/tests/acceptance/boot_xen.py b/tests/avocado/boot_xen.py index fc2faee..fc2faee 100644 --- a/tests/acceptance/boot_xen.py +++ b/tests/avocado/boot_xen.py diff --git a/tests/acceptance/cpu_queries.py b/tests/avocado/cpu_queries.py index cc9e380..cf69f69 100644 --- a/tests/acceptance/cpu_queries.py +++ b/tests/avocado/cpu_queries.py @@ -8,9 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class QueryCPUModelExpansion(Test): +class QueryCPUModelExpansion(QemuSystemTest): """ Run query-cpu-model-expansion for each CPU model, and validate results """ diff --git a/tests/acceptance/empty_cpu_model.py b/tests/avocado/empty_cpu_model.py index a1e59e4..22f5044 100644 --- a/tests/acceptance/empty_cpu_model.py +++ b/tests/avocado/empty_cpu_model.py @@ -7,9 +7,9 @@ # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class EmptyCPUModel(Test): +class EmptyCPUModel(QemuSystemTest): def test(self): self.vm.add_args('-S', '-display', 'none', '-machine', 'none', '-cpu', '') self.vm.set_qmp_monitor(enabled=False) diff --git a/tests/acceptance/hotplug_cpu.py b/tests/avocado/hotplug_cpu.py index 6374bf1..6374bf1 100644 --- a/tests/acceptance/hotplug_cpu.py +++ b/tests/avocado/hotplug_cpu.py diff --git a/tests/acceptance/info_usernet.py b/tests/avocado/info_usernet.py index 9c1fd90..dc01f74 100644 --- a/tests/acceptance/info_usernet.py +++ b/tests/avocado/info_usernet.py @@ -8,12 +8,12 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from qemu.utils import get_info_usernet_hostfwd_port -class InfoUsernet(Test): +class InfoUsernet(QemuSystemTest): def test_hostfwd(self): self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22') diff --git a/tests/acceptance/intel_iommu.py b/tests/avocado/intel_iommu.py index 474d62f..474d62f 100644 --- a/tests/acceptance/intel_iommu.py +++ b/tests/avocado/intel_iommu.py diff --git a/tests/acceptance/linux_initrd.py b/tests/avocado/linux_initrd.py index a249e2f..ba02e5a 100644 --- a/tests/acceptance/linux_initrd.py +++ b/tests/avocado/linux_initrd.py @@ -1,4 +1,4 @@ -# Linux initrd acceptance test. +# Linux initrd integration test. # # Copyright (c) 2018 Red Hat, Inc. # @@ -12,11 +12,11 @@ import os import logging import tempfile -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipIf -class LinuxInitrd(Test): +class LinuxInitrd(QemuSystemTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option. diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/avocado/linux_ssh_mips_malta.py index 4de1947..c0f0be5 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/avocado/linux_ssh_mips_malta.py @@ -12,7 +12,8 @@ import logging import time from avocado import skipUnless -from avocado_qemu import Test, LinuxSSHMixIn +from avocado_qemu import LinuxSSHMixIn +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive @@ -21,7 +22,7 @@ from avocado.utils import ssh @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') @skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available') -class LinuxSSH(Test, LinuxSSHMixIn): +class LinuxSSH(QemuSystemTest, LinuxSSHMixIn): timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg' diff --git a/tests/avocado/load_bflt.py b/tests/avocado/load_bflt.py new file mode 100644 index 0000000..bb50cec --- /dev/null +++ b/tests/avocado/load_bflt.py @@ -0,0 +1,54 @@ +# Test the bFLT loader format +# +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import bz2 +import subprocess + +from avocado import skipUnless +from avocado_qemu import QemuUserTest +from avocado_qemu import has_cmd + + +class LoadBFLT(QemuUserTest): + + def extract_cpio(self, cpio_path): + """ + Extracts a cpio archive into the test workdir + + :param cpio_path: path to the cpio archive + """ + cwd = os.getcwd() + os.chdir(self.workdir) + with bz2.open(cpio_path, 'rb') as archive_cpio: + subprocess.run(['cpio', '-i'], input=archive_cpio.read(), + stderr=subprocess.DEVNULL) + os.chdir(cwd) + + @skipUnless(*has_cmd('cpio')) + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_stm32(self): + """ + :avocado: tags=arch:arm + :avocado: tags=linux_user + :avocado: tags=quick + """ + # See https://elinux.org/STM32#User_Space + rootfs_url = ('https://elinux.org/images/5/51/' + 'Stm32_mini_rootfs.cpio.bz2') + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6' + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + busybox_path = os.path.join(self.workdir, "/bin/busybox") + + self.extract_cpio(rootfs_path_bz2) + + res = self.run(busybox_path) + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.' + self.assertIn(ver, res.stdout_text) + + res = self.run(busybox_path, ['uname', '-a']) + unm = 'armv7l GNU/Linux' + self.assertIn(unm, res.stdout_text) diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/avocado/machine_arm_canona1100.py index 0e5c43d..182a0b0 100644 --- a/tests/acceptance/machine_arm_canona1100.py +++ b/tests/avocado/machine_arm_canona1100.py @@ -8,11 +8,11 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class CanonA1100Machine(Test): +class CanonA1100Machine(QemuSystemTest): """Boots the barebox firmware and checks that the console is operational""" timeout = 90 diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/avocado/machine_arm_integratorcp.py index 49c8ebf..1ffe107 100644 --- a/tests/acceptance/machine_arm_integratorcp.py +++ b/tests/avocado/machine_arm_integratorcp.py @@ -12,7 +12,7 @@ import os import logging from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern @@ -29,7 +29,7 @@ except ImportError: CV2_AVAILABLE = False -class IntegratorMachine(Test): +class IntegratorMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/machine_arm_n8x0.py b/tests/avocado/machine_arm_n8x0.py index e5741f2..12e9a68 100644 --- a/tests/acceptance/machine_arm_n8x0.py +++ b/tests/avocado/machine_arm_n8x0.py @@ -11,10 +11,10 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class N8x0Machine(Test): +class N8x0Machine(QemuSystemTest): """Boots the Linux kernel and checks that the console is operational""" timeout = 90 diff --git a/tests/acceptance/machine_avr6.py b/tests/avocado/machine_avr6.py index 6baf4e9..5485db7 100644 --- a/tests/acceptance/machine_avr6.py +++ b/tests/avocado/machine_avr6.py @@ -1,5 +1,5 @@ # -# QEMU AVR acceptance tests +# QEMU AVR integration tests # # Copyright (c) 2019-2020 Michael Rolnik <mrolnik@gmail.com> # @@ -19,9 +19,9 @@ import time -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class AVR6Machine(Test): +class AVR6Machine(QemuSystemTest): timeout = 5 def test_freertos(self): diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/avocado/machine_m68k_nextcube.py index 09e2745..6790e7d 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/avocado/machine_m68k_nextcube.py @@ -8,7 +8,7 @@ import os import time -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipUnless from tesseract_utils import tesseract_available, tesseract_ocr @@ -20,7 +20,7 @@ except ImportError: PIL_AVAILABLE = False -class NextCubeMachine(Test): +class NextCubeMachine(QemuSystemTest): """ :avocado: tags=arch:m68k :avocado: tags=machine:next-cube diff --git a/tests/acceptance/machine_microblaze.py b/tests/avocado/machine_microblaze.py index 7f6d184..4928920 100644 --- a/tests/acceptance/machine_microblaze.py +++ b/tests/avocado/machine_microblaze.py @@ -5,11 +5,11 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class MicroblazeMachine(Test): +class MicroblazeMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/machine_mips_fuloong2e.py b/tests/avocado/machine_mips_fuloong2e.py index 0ac285e..89291f4 100644 --- a/tests/acceptance/machine_mips_fuloong2e.py +++ b/tests/avocado/machine_mips_fuloong2e.py @@ -10,10 +10,10 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class MipsFuloong2e(Test): +class MipsFuloong2e(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/avocado/machine_mips_loongson3v.py index 85b131a..5194cf1 100644 --- a/tests/acceptance/machine_mips_loongson3v.py +++ b/tests/avocado/machine_mips_loongson3v.py @@ -11,10 +11,10 @@ import os import time from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class MipsLoongson3v(Test): +class MipsLoongson3v(QemuSystemTest): timeout = 60 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') diff --git a/tests/acceptance/machine_mips_malta.py b/tests/avocado/machine_mips_malta.py index b67d8cb..f1895d5 100644 --- a/tests/acceptance/machine_mips_malta.py +++ b/tests/avocado/machine_mips_malta.py @@ -12,7 +12,7 @@ import gzip import logging from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive from avocado import skipIf @@ -33,7 +33,7 @@ except ImportError: @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') -class MaltaMachineFramebuffer(Test): +class MaltaMachineFramebuffer(QemuSystemTest): timeout = 30 diff --git a/tests/acceptance/machine_rx_gdbsim.py b/tests/avocado/machine_rx_gdbsim.py index 32b737b..6cd8704 100644 --- a/tests/acceptance/machine_rx_gdbsim.py +++ b/tests/avocado/machine_rx_gdbsim.py @@ -11,13 +11,13 @@ import os from avocado import skipIf -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class RxGdbSimMachine(Test): +class RxGdbSimMachine(QemuSystemTest): timeout = 30 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/avocado/machine_s390_ccw_virtio.py index 4028c99..bd03d71 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/avocado/machine_s390_ccw_virtio.py @@ -13,12 +13,12 @@ import os import tempfile from avocado import skipIf -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class S390CCWVirtioMachine(Test): +class S390CCWVirtioMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' timeout = 120 diff --git a/tests/acceptance/machine_sparc64_sun4u.py b/tests/avocado/machine_sparc64_sun4u.py index 4581655..4581655 100644 --- a/tests/acceptance/machine_sparc64_sun4u.py +++ b/tests/avocado/machine_sparc64_sun4u.py diff --git a/tests/acceptance/machine_sparc_leon3.py b/tests/avocado/machine_sparc_leon3.py index 2405cd7..e61b223 100644 --- a/tests/acceptance/machine_sparc_leon3.py +++ b/tests/avocado/machine_sparc_leon3.py @@ -5,12 +5,12 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado import skip -class Leon3Machine(Test): +class Leon3Machine(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/migration.py b/tests/avocado/migration.py index 792639c..584d6ef 100644 --- a/tests/acceptance/migration.py +++ b/tests/avocado/migration.py @@ -11,7 +11,7 @@ import tempfile -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipUnless from avocado.utils import network @@ -19,7 +19,7 @@ from avocado.utils import wait from avocado.utils.path import find_command -class Migration(Test): +class Migration(QemuSystemTest): """ :avocado: tags=migration """ diff --git a/tests/acceptance/multiprocess.py b/tests/avocado/multiprocess.py index 96627f0..80a3b8f 100644 --- a/tests/acceptance/multiprocess.py +++ b/tests/avocado/multiprocess.py @@ -7,12 +7,12 @@ import os import socket -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command from avocado_qemu import exec_command_and_wait_for_pattern -class Multiprocess(Test): +class Multiprocess(QemuSystemTest): """ :avocado: tags=multiprocess """ diff --git a/tests/acceptance/pc_cpu_hotplug_props.py b/tests/avocado/pc_cpu_hotplug_props.py index 2e86d50..52b8781 100644 --- a/tests/acceptance/pc_cpu_hotplug_props.py +++ b/tests/avocado/pc_cpu_hotplug_props.py @@ -20,9 +20,9 @@ # License along with this library; if not, see <http://www.gnu.org/licenses/>. # -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class OmittedCPUProps(Test): +class OmittedCPUProps(QemuSystemTest): """ :avocado: tags=arch:x86_64 :avocado: tags=cpu:qemu64 diff --git a/tests/acceptance/ppc_405.py b/tests/avocado/ppc_405.py index c534d5d..a47f89b 100644 --- a/tests/acceptance/ppc_405.py +++ b/tests/avocado/ppc_405.py @@ -6,11 +6,11 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern -class Ppc405Machine(Test): +class Ppc405Machine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/ppc_bamboo.py b/tests/avocado/ppc_bamboo.py index dd33bf6..40629e3 100644 --- a/tests/acceptance/ppc_bamboo.py +++ b/tests/avocado/ppc_bamboo.py @@ -6,11 +6,11 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern -class BambooMachine(Test): +class BambooMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/ppc_mpc8544ds.py b/tests/avocado/ppc_mpc8544ds.py index ce84060..886f967 100644 --- a/tests/acceptance/ppc_mpc8544ds.py +++ b/tests/avocado/ppc_mpc8544ds.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class Mpc8544dsMachine(Test): +class Mpc8544dsMachine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/avocado/ppc_prep_40p.py index 5e61e68..4bd9565 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/avocado/ppc_prep_40p.py @@ -8,11 +8,11 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class IbmPrep40pMachine(Test): +class IbmPrep40pMachine(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/ppc_pseries.py b/tests/avocado/ppc_pseries.py index f14a884..d8b04dc 100644 --- a/tests/acceptance/ppc_pseries.py +++ b/tests/avocado/ppc_pseries.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class pseriesMachine(Test): +class pseriesMachine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/ppc_virtex_ml507.py b/tests/avocado/ppc_virtex_ml507.py index 27f7bf2..a6912ee 100644 --- a/tests/acceptance/ppc_virtex_ml507.py +++ b/tests/avocado/ppc_virtex_ml507.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class VirtexMl507Machine(Test): +class VirtexMl507Machine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/replay_kernel.py b/tests/avocado/replay_kernel.py index c68a953..c68a953 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/avocado/replay_kernel.py diff --git a/tests/acceptance/replay_linux.py b/tests/avocado/replay_linux.py index 15953f9..15953f9 100644 --- a/tests/acceptance/replay_linux.py +++ b/tests/avocado/replay_linux.py diff --git a/tests/acceptance/reverse_debugging.py b/tests/avocado/reverse_debugging.py index d2921e7..d2921e7 100644 --- a/tests/acceptance/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py diff --git a/tests/acceptance/smmu.py b/tests/avocado/smmu.py index b3c4de6..b3c4de6 100644 --- a/tests/acceptance/smmu.py +++ b/tests/avocado/smmu.py diff --git a/tests/acceptance/tcg_plugins.py b/tests/avocado/tcg_plugins.py index 9ca1515..9ca1515 100644 --- a/tests/acceptance/tcg_plugins.py +++ b/tests/avocado/tcg_plugins.py diff --git a/tests/acceptance/tesseract_utils.py b/tests/avocado/tesseract_utils.py index 72cd9ab..72cd9ab 100644 --- a/tests/acceptance/tesseract_utils.py +++ b/tests/avocado/tesseract_utils.py diff --git a/tests/acceptance/version.py b/tests/avocado/version.py index 79b923d..ded7f03 100644 --- a/tests/acceptance/version.py +++ b/tests/avocado/version.py @@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class Version(Test): +class Version(QemuSystemTest): """ :avocado: tags=quick """ diff --git a/tests/acceptance/virtio-gpu.py b/tests/avocado/virtio-gpu.py index 4acc1e6..2a249a3 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/avocado/virtio-gpu.py @@ -4,8 +4,8 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test from avocado_qemu import BUILD_DIR +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import is_readable_executable_file @@ -27,7 +27,7 @@ def pick_default_vug_bin(): return bld_dir_path -class VirtioGPUx86(Test): +class VirtioGPUx86(QemuSystemTest): """ :avocado: tags=virtio-gpu :avocado: tags=arch:x86_64 diff --git a/tests/acceptance/virtio_check_params.py b/tests/avocado/virtio_check_params.py index 87e6c83..e869690 100644 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/avocado/virtio_check_params.py @@ -24,7 +24,7 @@ import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skip #list of machine types and virtqueue properties to test @@ -41,7 +41,7 @@ VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'], 'driver=null-co,id=drive0,if=none']} -class VirtioMaxSegSettingsCheck(Test): +class VirtioMaxSegSettingsCheck(QemuSystemTest): @staticmethod def make_pattern(props): pattern_items = ['{0} = \w+'.format(prop) for prop in props] diff --git a/tests/acceptance/virtio_version.py b/tests/avocado/virtio_version.py index 33593c2..208910b 100644 --- a/tests/acceptance/virtio_version.py +++ b/tests/avocado/virtio_version.py @@ -13,7 +13,7 @@ import os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest # Virtio Device IDs: VIRTIO_NET = 1 @@ -55,7 +55,7 @@ def get_pci_interfaces(vm, devtype): interfaces = ('pci-express-device', 'conventional-pci-device') return [i for i in interfaces if devtype_implements(vm, devtype, i)] -class VirtioVersionCheck(Test): +class VirtioVersionCheck(QemuSystemTest): """ Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/avocado/virtiofs_submounts.py index 21ad7d7..e6dc32f 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/avocado/virtiofs_submounts.py @@ -6,67 +6,12 @@ import time from avocado import skipUnless from avocado_qemu import LinuxTest, BUILD_DIR +from avocado_qemu import has_cmds +from avocado_qemu import run_cmd from avocado_qemu import wait_for_console_pattern from avocado.utils import ssh -def run_cmd(args): - subp = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True) - stdout, stderr = subp.communicate() - ret = subp.returncode - - return (stdout, stderr, ret) - -def has_cmd(name, args=None): - """ - This function is for use in a @avocado.skipUnless decorator, e.g.: - - @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) - def test_something_that_needs_sudo(self): - ... - """ - - if args is None: - args = ('which', name) - - try: - _, stderr, exitcode = run_cmd(args) - except Exception as e: - exitcode = -1 - stderr = str(e) - - if exitcode != 0: - cmd_line = ' '.join(args) - err = f'{name} required, but "{cmd_line}" failed: {stderr.strip()}' - return (False, err) - else: - return (True, '') - -def has_cmds(*cmds): - """ - This function is for use in a @avocado.skipUnless decorator and - allows checking for the availability of multiple commands, e.g.: - - @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), - 'cmd2', 'cmd3')) - def test_something_that_needs_cmd1_and_cmd2(self): - ... - """ - - for cmd in cmds: - if isinstance(cmd, str): - cmd = (cmd,) - - ok, errstr = has_cmd(*cmd) - if not ok: - return (False, errstr) - - return (True, '') - - class VirtiofsSubmountsTest(LinuxTest): """ :avocado: tags=arch:x86_64 diff --git a/tests/acceptance/virtiofs_submounts.py.data/cleanup.sh b/tests/avocado/virtiofs_submounts.py.data/cleanup.sh index 2a6579a..2a6579a 100644 --- a/tests/acceptance/virtiofs_submounts.py.data/cleanup.sh +++ b/tests/avocado/virtiofs_submounts.py.data/cleanup.sh diff --git a/tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh b/tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh index 729cb2d..729cb2d 100644 --- a/tests/acceptance/virtiofs_submounts.py.data/guest-cleanup.sh +++ b/tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh diff --git a/tests/acceptance/virtiofs_submounts.py.data/guest.sh b/tests/avocado/virtiofs_submounts.py.data/guest.sh index 59ba40f..59ba40f 100644 --- a/tests/acceptance/virtiofs_submounts.py.data/guest.sh +++ b/tests/avocado/virtiofs_submounts.py.data/guest.sh diff --git a/tests/acceptance/virtiofs_submounts.py.data/host.sh b/tests/avocado/virtiofs_submounts.py.data/host.sh index d8a9afe..d8a9afe 100644 --- a/tests/acceptance/virtiofs_submounts.py.data/host.sh +++ b/tests/avocado/virtiofs_submounts.py.data/host.sh diff --git a/tests/acceptance/vnc.py b/tests/avocado/vnc.py index f301fbb..0964329 100644 --- a/tests/acceptance/vnc.py +++ b/tests/avocado/vnc.py @@ -8,10 +8,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class Vnc(Test): +class Vnc(QemuSystemTest): """ :avocado: tags=vnc,quick """ diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/avocado/x86_cpu_model_versions.py index 0e9feda..a6edf74 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/avocado/x86_cpu_model_versions.py @@ -24,7 +24,7 @@ import avocado_qemu import re -class X86CPUModelAliases(avocado_qemu.Test): +class X86CPUModelAliases(avocado_qemu.QemuSystemTest): """ Validation of PC CPU model versions and CPU model aliases @@ -239,7 +239,7 @@ class X86CPUModelAliases(avocado_qemu.Test): self.validate_aliases(cpus) -class CascadelakeArchCapabilities(avocado_qemu.Test): +class CascadelakeArchCapabilities(avocado_qemu.QemuSystemTest): """ Validation of Cascadelake arch-capabilities |