Docs / testing patches for 2024-07-29
Subsystems (2)
The following changes since commit 93b799fafd9170da3a79a533ea6f73a18de82e22:
Merge tag 'pull-ppc-for-9.1-2-20240726-1' of https://gitlab.com/npiggin/qemu into staging (2024-07-26 15:10:45 +1000)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/docs-testing-20240729
for you to fetch changes up to 8e2275592299b637e87cc905d20bfdeffa586a83:
tests/avocado: test_arm_emcraft_sf2: handle RW requirements for asset (2024-07-29 16:33:24 +0200)
Ignored warnings:
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
WARNING: line over 80 characters
----------------------------------------------------------------
Docs & testing patch queue
- Test QAPI firmware.json schema (Thomas)
- Handle new env.doc2path() return value (Peter)
- Convert some Avocado tests to simpler python-based functional testing (Thomas)
- Improve how assets are used by some Avocado tests (Cleber)
----------------------------------------------------------------
Cleber Rosa (3):
tests/avocado: mips: fallback to HTTP given certificate expiration tests/avocado: mips: add hint for fetchasset plugin tests/avocado: test_arm_emcraft_sf2: handle RW requirements for asset
Peter Maydell (1):
docs/sphinx/depfile.py: Handle env.doc2path() returning a Path not a
str
Thomas Huth (9):
python: Install pycotap in our venv if necessary tests/functional: Add base classes for the upcoming pytest-based tests tests/Makefile.include: Increase the level of indentation in the help
text
tests/functional: Prepare the meson build system for the functional
tests
tests/functional: Convert simple avocado tests into standalone python
tests
tests/functional: Convert avocado tests that just need a small
adjustment
tests/functional: Convert the x86_cpu_model_versions test tests/functional: Convert the riscv_opensbi avocado test into a
standalone test
gitlab-ci: Add "check-functional" to the build tests
Thomas Weißschuh (1):
docs: add test for firmware.json QAPI
MAINTAINERS | 11 +
docs/meson.build | 5 +
docs/sphinx/depfile.py | 2 +-
.gitlab-ci.d/buildtest-template.yml | 3 +-
.gitlab-ci.d/buildtest.yml | 60 ++--
python/wheels/pycotap-1.3.1-py3-none-any.whl | Bin 0 -> 5119 bytes
pythondeps.toml | 1 +
tests/Makefile.include | 41 ++-
tests/avocado/boot_linux_console.py | 24 +-
tests/avocado/riscv_opensbi.py | 63 ----
tests/functional/meson.build | 86 +++++
tests/functional/qemu_test/__init__.py | 328 ++++++++++++++++++
.../test_cpu_queries.py} | 7 +-
.../test_empty_cpu_model.py} | 7 +-
.../test_info_usernet.py} | 11 +-
.../test_mem_addr_space.py} | 52 +--
.../test_pc_cpu_hotplug_props.py} | 11 +-
.../test_ppc_74xx.py} | 74 ++--
tests/functional/test_riscv_opensbi.py | 36 ++
.../version.py => functional/test_version.py} | 13 +-
.../test_virtio_version.py} | 8 +-
.../test_x86_cpu_model_versions.py} | 63 +---
tests/meson.build | 1 +
23 files changed, 636 insertions(+), 271 deletions(-)
create mode 100644 python/wheels/pycotap-1.3.1-py3-none-any.whl
delete mode 100644 tests/avocado/riscv_opensbi.py
create mode 100644 tests/functional/meson.build
create mode 100644 tests/functional/qemu_test/__init__.py
rename tests/{avocado/cpu_queries.py => functional/test_cpu_queries.py} (89%)
mode change 100644 => 100755
rename tests/{avocado/empty_cpu_model.py => functional/test_empty_cpu_model.py} (84%)
mode change 100644 => 100755
rename tests/{avocado/info_usernet.py => functional/test_info_usernet.py} (87%)
mode change 100644 => 100755
rename tests/{avocado/mem-addr-space-check.py => functional/test_mem_addr_space.py} (93%)
mode change 100644 => 100755
rename tests/{avocado/pc_cpu_hotplug_props.py => functional/test_pc_cpu_hotplug_props.py} (90%)
mode change 100644 => 100755
rename tests/{avocado/ppc_74xx.py => functional/test_ppc_74xx.py} (74%)
mode change 100644 => 100755
create mode 100755 tests/functional/test_riscv_opensbi.py
rename tests/{avocado/version.py => functional/test_version.py} (78%)
mode change 100644 => 100755
rename tests/{avocado/virtio_version.py => functional/test_virtio_version.py} (98%)
mode change 100644 => 100755
rename tests/{avocado/x86_cpu_model_versions.py => functional/test_x86_cpu_model_versions.py} (92%)
mode change 100644 => 100755Signature · 1 line
2.45.2
[PULL 02/14] docs/sphinx/depfile.py: Handle env.doc2path() returning a Path not a str
From: Peter Maydell <[email protected]>
In newer versions of Sphinx the env.doc2path() API is going to change to return a Path object rather than a str. This was originally visible in Sphinx 8.0.0rc1, but has been rolled back for the final 8.0.0 release. However it will probably emit a deprecation warning and is likely to change for good in 9.0:
https://github.com/sphinx-doc/sphinx/issues/12686
Our use in depfile.py assumes a str, and if it is passed a Path
it will fall over:
Handler <function write_depfile at 0x77a1775ff560> for event 'build-finished' threw an exception (exception: unsupported operand type(s) for +: 'PosixPath' and 'str')
Wrapping the env.doc2path() call in str() will coerce a Path object to the str we expect, and have no effect in older Sphinx versions that do return a str.
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2458
Message-ID: <[email protected]>
--- docs/sphinx/depfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
docs/sphinx/depfile.py +1 -1
@@ -19,7 +19,7 @@ def get_infiles(env): for x in env.found_docs: - yield env.doc2path(x) + yield str(env.doc2path(x)) yield from ((os.path.join(env.srcdir, dep) for dep in env.dependencies[x])) for mod in sys.modules.values():
Signature · 1 line
2.45.2
[PULL 01/14] docs: add test for firmware.json QAPI
In reply to Philippe Mathieu-DaudéFrom: Thomas Weißschuh <[email protected]>
To make sure that the QAPI description stays valid, add a testcase.
Message-ID: <[email protected]>
--- docs/meson.build | 5 +++++ 1 file changed, 5 insertions(+)
docs/meson.build +5 -0
@@ -99,3 +99,8 @@ if build_docs alias_target('html', sphinxdocs) alias_target('man', sphinxmans) endif + +test('QAPI firmware.json regression tests', qapi_gen, + args: ['-o', meson.current_build_dir() / 'qapi', + meson.current_source_dir() / 'interop/firmware.json'], + suite: ['qapi-schema', 'qapi-interop'])
Signature · 1 line
2.45.2
[PULL 06/14] tests/functional: Prepare the meson build system for the functional tests
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
Provide a meson.build file for the upcoming python-based functional tests, and add some wrapper glue targets to the tests/Makefile.include file. We are going to use two "speed" modes for the functional tests:
The "quick" tests can be run at any time (i.e. also during "make check"), while the "thorough" tests should only be run when running a "make check-functional" test run (since these tests might download additional assets from the internet).
The changes to the meson.build files are partly based on an earlier patch by Ani Sinha.
Message-ID: <[email protected]>
--- tests/Makefile.include | 11 ++++++ tests/functional/meson.build | 66 ++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 78 insertions(+) create mode 100644 tests/functional/meson.build
tests/Makefile.include +11 -0
@@ -9,6 +9,8 @@ check-help: @echo "Individual test suites:" @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" @echo " $(MAKE) check-qtest Run qtest tests" + @echo " $(MAKE) check-functional Run python-based functional tests" + @echo " $(MAKE) check-functional-TARGET Run functional tests for a given target" @echo " $(MAKE) check-unit Run qobject tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-block Run block tests"
@@ -152,6 +154,15 @@ check-acceptance-deprecated-warning: check-acceptance: check-acceptance-deprecated-warning | check-avocado +FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS))) +.PHONY: $(FUNCTIONAL_TARGETS) +$(FUNCTIONAL_TARGETS): + @$(MAKE) SPEED=thorough $(subst -functional,-func,$@) + +.PHONY: check-functional +check-functional: + @$(MAKE) SPEED=thorough check-func-quick + # Consolidated targets .PHONY: check check-clean get-vm-images
tests/functional/meson.build new file +66 -0
66 lines not on this page · raw message
tests/meson.build +1 -0
@@ -85,3 +85,4 @@ subdir('unit') subdir('qapi-schema') subdir('qtest') subdir('migration') +subdir('functional')
Signature · 1 line
2.45.2
[PULL 08/14] tests/functional: Convert avocado tests that just need a small adjustment
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
These simple tests can be converted to stand-alone tests quite easily, e.g. by just setting the machine to 'none' now manually or by adding "-cpu" command line parameters, since we don't support the corresponding avocado tags in the new python test framework.
Message-ID: <[email protected]>
---
MAINTAINERS | 3 +
tests/functional/meson.build | 6 ++
.../test_info_usernet.py} | 11 ++-
.../test_ppc_74xx.py} | 74 ++++++++-----------
.../version.py => functional/test_version.py} | 13 ++--
5 files changed, 56 insertions(+), 51 deletions(-)
rename tests/{avocado/info_usernet.py => functional/test_info_usernet.py} (87%)
mode change 100644 => 100755
rename tests/{avocado/ppc_74xx.py => functional/test_ppc_74xx.py} (74%)
mode change 100644 => 100755
rename tests/{avocado/version.py => functional/test_version.py} (78%)
mode change 100644 => 100755MAINTAINERS +3 -0
@@ -317,6 +317,7 @@ F: configs/devices/ppc* F: docs/system/ppc/embedded.rst F: docs/system/target-ppc.rst F: tests/tcg/ppc*/* +F: tests/functional/test_ppc_74xx.py RISC-V TCG CPUs M: Palmer Dabbelt <[email protected]>
@@ -2105,6 +2106,7 @@ S: Odd Fixes F: hw/net/ F: include/hw/net/ F: tests/qtest/virtio-net-test.c +F: tests/avocado/info_usernet.py F: docs/virtio-net-failover.rst T: git https://github.com/jasowang/qemu.git net
@@ -2974,6 +2976,7 @@ S: Supported F: include/qemu/option.h F: tests/unit/test-keyval.c F: tests/unit/test-qemu-opts.c +F: tests/functional/test_version.py F: util/keyval.c F: util/qemu-option.c
tests/functional/meson.build +6 -0
@@ -15,6 +15,12 @@ test_timeouts = { tests_generic = [ 'empty_cpu_model', + 'info_usernet', + 'version', +] + +tests_ppc_quick = [ + 'ppc_74xx', ] tests_x86_64_quick = [
tests/functional/test_info_usernet.py renamed from tests/avocado/info_usernet.py +7 -4
@@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test for the hmp command "info usernet" # # Copyright (c) 2021 Red Hat, Inc.
@@ -8,18 +10,16 @@ # 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 QemuSystemTest +from qemu_test import QemuSystemTest from qemu.utils import get_info_usernet_hostfwd_port class InfoUsernet(QemuSystemTest): - """ - :avocado: tags=machine:none - """ def test_hostfwd(self): self.require_netdev('user') + self.set_machine('none') self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22') self.vm.launch() res = self.vm.cmd('human-monitor-command',
@@ -31,3 +31,6 @@ def test_hostfwd(self): self.assertGreater(port, 0, ('Found a redirected port that is not greater than' ' zero')) + +if __name__ == '__main__': + QemuSystemTest.main()
tests/functional/test_ppc_74xx.py renamed from tests/avocado/ppc_74xx.py +32 -42
167 lines not on this page · raw message
tests/functional/test_version.py renamed from tests/avocado/version.py +8 -5
@@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Version check example test # # Copyright (c) 2018 Red Hat, Inc.
@@ -9,17 +11,18 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest class Version(QemuSystemTest): - """ - :avocado: tags=quick - :avocado: tags=machine:none - """ + def test_qmp_human_info_version(self): + self.set_machine('none') self.vm.add_args('-nodefaults') self.vm.launch() res = self.vm.cmd('human-monitor-command', command_line='info version') self.assertRegex(res, r'^(\d+\.\d+\.\d)') + +if __name__ == '__main__': + QemuSystemTest.main()
Signature · 1 line
2.45.2
[PULL 03/14] python: Install pycotap in our venv if necessary
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The upcoming functional tests will require pycotap for providing TAP output from the python-based tests. Since we want to be able to run some of the tests offline by default, too, let's install it along with meson in our venv if necessary (it's size is only 5 kB, so adding the wheel here should not really be a problem).
The wheel file has been obtained with:
pip download --only-binary :all: --dest . --no-cache pycotap
Message-ID: <[email protected]>
--- python/wheels/pycotap-1.3.1-py3-none-any.whl | Bin 0 -> 5119 bytes pythondeps.toml | 1 + 2 files changed, 1 insertion(+) create mode 100644 python/wheels/pycotap-1.3.1-py3-none-any.whl
python/wheels/pycotap-1.3.1-py3-none-any.whl new file binary +0 -0
pythondeps.toml +1 -0
@@ -20,6 +20,7 @@ [meson] # The install key should match the version in python/wheels/ meson = { accepted = ">=1.1.0", installed = "1.2.3", canary = "meson" } +pycotap = { accepted = ">=1.1.0", installed = "1.3.1" } [docs] # Please keep the installed versions in sync with docs/requirements.txt
Signature · 1 line
2.45.2
[PULL 05/14] tests/Makefile.include: Increase the level of indentation in the help text
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The next patch is going to add some entries that need more space between the command and the help text, so let's increase the indentation here first.
Message-ID: <[email protected]>
--- tests/Makefile.include | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
tests/Makefile.include +15 -15
@@ -3,28 +3,28 @@ .PHONY: check-help check-help: @echo "Regression testing targets:" - @echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests" - @echo " $(MAKE) bench Run speed tests" + @echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests" + @echo " $(MAKE) bench Run speed tests" @echo @echo "Individual test suites:" - @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" - @echo " $(MAKE) check-qtest Run qtest tests" - @echo " $(MAKE) check-unit Run qobject tests" - @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" - @echo " $(MAKE) check-block Run block tests" + @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" + @echo " $(MAKE) check-qtest Run qtest tests" + @echo " $(MAKE) check-unit Run qobject tests" + @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" + @echo " $(MAKE) check-block Run block tests" ifneq ($(filter $(all-check-targets), check-softfloat),) - @echo " $(MAKE) check-tcg Run TCG tests" - @echo " $(MAKE) check-softfloat Run FPU emulation tests" + @echo " $(MAKE) check-tcg Run TCG tests" + @echo " $(MAKE) check-softfloat Run FPU emulation tests" endif - @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets" + @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets" @echo - @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" - @echo " $(MAKE) check-venv Creates a Python venv for tests" - @echo " $(MAKE) check-clean Clean the tests and related data" + @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" + @echo " $(MAKE) check-venv Creates a Python venv for tests" + @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds" - @echo " $(MAKE) check-build Build most test binaries" - @echo " $(MAKE) get-vm-images Downloads all images used by avocado tests, according to configured targets (~350 MB each, 1.5 GB max)" + @echo " $(MAKE) check-build Build most test binaries" + @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."
Signature · 1 line
2.45.2
[PULL 10/14] tests/functional: Convert the riscv_opensbi avocado test into a standalone test
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The avocado test defined test functions for both, riscv32 and riscv64. Since we can run the whole file with multiple targets in the new framework, we can now consolidate the functions so we have to only define one function per machine now.
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + tests/avocado/riscv_opensbi.py | 63 -------------------------- tests/functional/meson.build | 8 ++++ tests/functional/test_riscv_opensbi.py | 36 +++++++++++++++ 4 files changed, 45 insertions(+), 63 deletions(-) delete mode 100644 tests/avocado/riscv_opensbi.py create mode 100755 tests/functional/test_riscv_opensbi.py
MAINTAINERS +1 -0
@@ -337,6 +337,7 @@ F: include/hw/riscv/ F: linux-user/host/riscv32/ F: linux-user/host/riscv64/ F: tests/tcg/riscv64/ +F: tests/functional/test_riscv_opensbi.py RISC-V XThead* extensions M: Christoph Muellner <[email protected]>
tests/avocado/riscv_opensbi.py deleted +0 -63
63 lines not on this page · raw message
tests/functional/meson.build +8 -0
@@ -23,6 +23,14 @@ tests_ppc_quick = [ 'ppc_74xx', ] +tests_riscv32_quick = [ + 'riscv_opensbi', +] + +tests_riscv64_quick = [ + 'riscv_opensbi', +] + tests_x86_64_quick = [ 'cpu_queries', 'mem_addr_space',
tests/functional/test_riscv_opensbi.py new file +36 -0
@@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# +# OpenSBI boot test for RISC-V machines +# +# Copyright (c) 2022, Ventana Micro +# +# 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 qemu_test import QemuSystemTest +from qemu_test import wait_for_console_pattern + +class RiscvOpenSBI(QemuSystemTest): + + timeout = 5 + + def boot_opensbi(self): + self.vm.set_console() + self.vm.launch() + wait_for_console_pattern(self, 'Platform Name') + wait_for_console_pattern(self, 'Boot HART MEDELEG') + + def test_riscv_spike(self): + self.set_machine('spike') + self.boot_opensbi() + + def test_riscv_sifive_u(self): + self.set_machine('sifive_u') + self.boot_opensbi() + + def test_riscv_virt(self): + self.set_machine('virt') + self.boot_opensbi() + +if __name__ == '__main__': + QemuSystemTest.main()
Signature · 1 line
2.45.2
[PULL 14/14] tests/avocado: test_arm_emcraft_sf2: handle RW requirements for asset
In reply to Philippe Mathieu-DaudéFrom: Cleber Rosa <[email protected]>
The asset used in the mentioned test gets truncated before it's used in the test. This means that the file gets modified, and thus the asset's expected hash doesn't match anymore. This causes cache misses and re-downloads every time the test is re-run.
Let's make a copy of the asset so that the one in the cache is preserved and the cache sees a hit on re-runs.
Message-ID: <[email protected]>
--- tests/avocado/boot_linux_console.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tests/avocado/boot_linux_console.py +4 -2
@@ -401,14 +401,16 @@ def test_arm_emcraft_sf2(self): 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin') spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501' spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash) + spi_path_rw = os.path.join(self.workdir, os.path.basename(spi_path)) + shutil.copy(spi_path, spi_path_rw) - file_truncate(spi_path, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB + file_truncate(spi_path_rw, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB self.vm.set_console() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE self.vm.add_args('-kernel', uboot_path, '-append', kernel_command_line, - '-drive', 'file=' + spi_path + ',if=mtd,format=raw', + '-drive', 'file=' + spi_path_rw + ',if=mtd,format=raw', '-no-reboot') self.vm.launch() self.wait_for_console_pattern('Enter \'help\' for a list')
Signature · 1 line
2.45.2
[PULL 09/14] tests/functional: Convert the x86_cpu_model_versions test
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
Nothing thrilling in here, it's just a straight forward conversion.
Message-ID: <[email protected]>
---
MAINTAINERS | 1 +
tests/functional/meson.build | 1 +
.../test_x86_cpu_model_versions.py} | 63 ++++++-------------
3 files changed, 21 insertions(+), 44 deletions(-)
rename tests/{avocado/x86_cpu_model_versions.py => functional/test_x86_cpu_model_versions.py} (92%)
mode change 100644 => 100755MAINTAINERS +1 -0
@@ -1833,6 +1833,7 @@ F: tests/unit/test-x86-topo.c F: tests/qtest/test-x86-cpuid-compat.c F: tests/functional/test_mem_addr_space.py F: tests/functional/test_pc_cpu_hotplug_props.py +F: tests/functional/test_x86_cpu_model_versions.py PC Chipset M: Michael S. Tsirkin <[email protected]>
tests/functional/meson.build +1 -0
@@ -28,6 +28,7 @@ tests_x86_64_quick = [ 'mem_addr_space', 'pc_cpu_hotplug_props', 'virtio_version', + 'x86_cpu_model_versions', ] tests_x86_64_thorough = [
tests/functional/test_x86_cpu_model_versions.py renamed from tests/avocado/x86_cpu_model_versions.py +19 -44
154 lines not on this page · raw message
Signature · 1 line
2.45.2
[PULL 11/14] gitlab-ci: Add "check-functional" to the build tests
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
Now that we converted many tests from the "check-avocado" test suite to the "check-functional" test suite, we should make sure that these also get tested in the CI.
Message-ID: <[email protected]>
--- .gitlab-ci.d/buildtest-template.yml | 3 +- .gitlab-ci.d/buildtest.yml | 60 ++++++++++++++--------------- 2 files changed, 32 insertions(+), 31 deletions(-)
.gitlab-ci.d/buildtest-template.yml +2 -1
@@ -71,7 +71,7 @@ reports: junit: build/meson-logs/testlog.junit.xml -.avocado_test_job_template: +.functional_test_job_template: extends: .common_test_job_template cache: key: "${CI_JOB_NAME}-cache"
@@ -98,6 +98,7 @@ du -chs ${CI_PROJECT_DIR}/avocado-cache ; fi - export AVOCADO_ALLOW_UNTRUSTED_CODE=1 + - export QEMU_TEST_ALLOW_UNTRUSTED_CODE=1 after_script: - cd build - du -chs ${CI_PROJECT_DIR}/avocado-cache
.gitlab-ci.d/buildtest.yml +30 -30
171 lines not on this page · raw message
Signature · 1 line
2.45.2
[PULL 13/14] tests/avocado: mips: add hint for fetchasset plugin
In reply to Philippe Mathieu-DaudéFrom: Cleber Rosa <[email protected]>
Avocado's fetchasset plugin runs before the actual Avocado job (and any test). It analyses the test's code looking for occurrences of "self.fetch_asset()" in the either the actual test or setUp() method. It's not able to fully analyze all code, though.
The way these tests are written, make the fetchasset plugin blind to the assets. This adds some more code duplication, true, but it will aid the fetchasset plugin to download or verify the existence of these assets in advance.
Message-ID: <[email protected]>
--- tests/avocado/boot_linux_console.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tests/avocado/boot_linux_console.py +7 -5
@@ -274,8 +274,7 @@ def test_mips64el_malta_5KEc_cpio(self): # Wait for VM to shut down gracefully self.vm.wait() - def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash): - kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + def do_test_mips_malta32el_nanomips(self, kernel_path_xz): kernel_path = self.workdir + "kernel" with lzma.open(kernel_path_xz, 'rb') as f_in: with open(kernel_path, 'wb') as f_out:
@@ -303,7 +302,8 @@ def test_mips_malta32el_nanomips_4k(self): 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page4k.xz') kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6' - self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) + kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + self.do_test_mips_malta32el_nanomips(kernel_path_xz) def test_mips_malta32el_nanomips_16k_up(self): """
@@ -316,7 +316,8 @@ def test_mips_malta32el_nanomips_16k_up(self): 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page16k_up.xz') kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc' - self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) + kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + self.do_test_mips_malta32el_nanomips(kernel_path_xz) def test_mips_malta32el_nanomips_64k_dbg(self): """
@@ -329,7 +330,8 @@ def test_mips_malta32el_nanomips_64k_dbg(self): 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page64k_dbg.xz') kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180' - self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) + kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + self.do_test_mips_malta32el_nanomips(kernel_path_xz) def test_aarch64_xlnx_versal_virt(self): """
Signature · 1 line
2.45.2
[PULL 04/14] tests/functional: Add base classes for the upcoming pytest-based tests
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The file is mostly a copy of the tests/avocado/avocado_qemu/__init__.py file with some adjustments to get rid of the Avocado dependencies (i.e. we also have to drop the LinuxSSHMixIn and LinuxTest for now).
The emulator binary and build directory are now passed via environment variables that will be set via meson.build later.
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + tests/functional/qemu_test/__init__.py | 328 +++++++++++++++++++++++++ 2 files changed, 329 insertions(+) create mode 100644 tests/functional/qemu_test/__init__.py
MAINTAINERS +1 -0
@@ -4127,6 +4127,7 @@ F: .travis.yml F: docs/devel/ci* F: scripts/ci/ F: tests/docker/ +F: tests/functional/ F: tests/vm/ F: tests/lcitool/ F: tests/avocado/tuxrun_baselines.py
tests/functional/qemu_test/__init__.py new file +328 -0
328 lines not on this page · raw message
Signature · 1 line
2.45.2
[PULL 07/14] tests/functional: Convert simple avocado tests into standalone python tests
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
These test are rather simple and don't need any modifications apart from adjusting the "from avocado_qemu" line. To ease debugging, make the files executable and add a shebang line and Python '__main__' handling, too, so that these tests can now be run by executing them directly.
Message-ID: <[email protected]>
---
MAINTAINERS | 5 ++
tests/functional/meson.build | 5 ++
.../test_cpu_queries.py} | 7 ++-
.../test_empty_cpu_model.py} | 7 ++-
.../test_mem_addr_space.py} | 52 +++----------------
.../test_pc_cpu_hotplug_props.py} | 11 ++--
.../test_virtio_version.py} | 8 +--
7 files changed, 39 insertions(+), 56 deletions(-)
rename tests/{avocado/cpu_queries.py => functional/test_cpu_queries.py} (89%)
mode change 100644 => 100755
rename tests/{avocado/empty_cpu_model.py => functional/test_empty_cpu_model.py} (84%)
mode change 100644 => 100755
rename tests/{avocado/mem-addr-space-check.py => functional/test_mem_addr_space.py} (93%)
mode change 100644 => 100755
rename tests/{avocado/pc_cpu_hotplug_props.py => functional/test_pc_cpu_hotplug_props.py} (90%)
mode change 100644 => 100755
rename tests/{avocado/virtio_version.py => functional/test_virtio_version.py} (98%)
mode change 100644 => 100755MAINTAINERS +5 -0
@@ -1830,6 +1830,8 @@ F: hw/isa/apm.c F: include/hw/isa/apm.h F: tests/unit/test-x86-topo.c F: tests/qtest/test-x86-cpuid-compat.c +F: tests/functional/test_mem_addr_space.py +F: tests/functional/test_pc_cpu_hotplug_props.py PC Chipset M: Michael S. Tsirkin <[email protected]>
@@ -1896,6 +1898,8 @@ F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/cpu/cluster.h F: include/sysemu/numa.h +F: tests/functional/test_cpu_queries.py +F: tests/functional/test_empty_cpu_model.py F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next
@@ -2236,6 +2240,7 @@ F: net/vhost-user.c F: include/hw/virtio/ F: docs/devel/virtio* F: docs/devel/migration/virtio.rst +F: tests/functional/test_virtio_version.py virtio-balloon M: Michael S. Tsirkin <[email protected]>
tests/functional/meson.build +5 -0
@@ -14,9 +14,14 @@ test_timeouts = { } tests_generic = [ + 'empty_cpu_model', ] tests_x86_64_quick = [ + 'cpu_queries', + 'mem_addr_space', + 'pc_cpu_hotplug_props', + 'virtio_version', ] tests_x86_64_thorough = [
tests/functional/test_cpu_queries.py renamed from tests/avocado/cpu_queries.py +6 -1
@@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Sanity check of query-cpu-* results # # Copyright (c) 2019 Red Hat, Inc.
@@ -8,7 +10,7 @@ # 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 QemuSystemTest +from qemu_test import QemuSystemTest class QueryCPUModelExpansion(QemuSystemTest): """
@@ -33,3 +35,6 @@ def test(self): e = self.vm.cmd('query-cpu-model-expansion', model=model, type='full') self.assertEqual(e['model']['name'], c['name']) + +if __name__ == '__main__': + QemuSystemTest.main()
tests/functional/test_empty_cpu_model.py renamed from tests/avocado/empty_cpu_model.py +6 -1
@@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Check for crash when using empty -cpu option # # Copyright (c) 2019 Red Hat, Inc.
@@ -7,7 +9,7 @@ # # 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 QemuSystemTest +from qemu_test import QemuSystemTest class EmptyCPUModel(QemuSystemTest): def test(self):
@@ -17,3 +19,6 @@ def test(self): self.vm.wait() self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1") self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty') + +if __name__ == '__main__': + QemuSystemTest.main()
tests/functional/test_mem_addr_space.py renamed from tests/avocado/mem-addr-space-check.py +6 -46
154 lines not on this page · raw message
tests/functional/test_pc_cpu_hotplug_props.py renamed from tests/avocado/pc_cpu_hotplug_props.py +6 -5
@@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Ensure CPU die-id can be omitted on -device #
@@ -20,16 +21,16 @@ # License along with this library; if not, see <http://www.gnu.org/licenses/>. # -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest class OmittedCPUProps(QemuSystemTest): - """ - :avocado: tags=arch:x86_64 - :avocado: tags=cpu:qemu64 - """ + def test_no_die_id(self): self.vm.add_args('-nodefaults', '-S') self.vm.add_args('-smp', '1,sockets=2,cores=2,threads=2,maxcpus=8') self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=1,core-id=0,thread-id=0') self.vm.launch() self.assertEqual(len(self.vm.cmd('query-cpus-fast')), 2) + +if __name__ == '__main__': + QemuSystemTest.main()
tests/functional/test_virtio_version.py renamed from tests/avocado/virtio_version.py +5 -3
@@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """ Check compatibility of virtio device types """
@@ -12,7 +13,7 @@ import os from qemu.machine import QEMUMachine -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest # Virtio Device IDs: VIRTIO_NET = 1
@@ -60,8 +61,6 @@ class VirtioVersionCheck(QemuSystemTest): Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and `disable-legacy`. - - :avocado: tags=arch:x86_64 """ # just in case there are failures, show larger diff:
@@ -173,3 +172,6 @@ def test_modern_only_devs(self): self.check_modern_only('virtio-mouse-pci', VIRTIO_INPUT) self.check_modern_only('virtio-tablet-pci', VIRTIO_INPUT) self.check_modern_only('virtio-keyboard-pci', VIRTIO_INPUT) + +if __name__ == '__main__': + QemuSystemTest.main()
Signature · 1 line
2.45.2
[PULL 12/14] tests/avocado: mips: fallback to HTTP given certificate expiration
In reply to Philippe Mathieu-DaudéFrom: Cleber Rosa <[email protected]>
The SSL certificate installed at mipsdistros.mips.com has expired:
0 s:CN = mipsdistros.mips.com
i:C = US, O = Amazon, OU = Server CA 1B, CN = Amazon
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256 v:NotBefore: Dec 23 00:00:00 2019 GMT; NotAfter: Jan 23 12:00:00 2021 GMT
Because this project has no control over that certificate and host, this falls back to plain HTTP instead. The integrity of the downloaded files can be guaranteed by the existing hashes for those files (which are not modified here).
Message-ID: <[email protected]>
--- tests/avocado/boot_linux_console.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/avocado/boot_linux_console.py +3 -3
@@ -299,7 +299,7 @@ def test_mips_malta32el_nanomips_4k(self): :avocado: tags=endian:little :avocado: tags=cpu:I7200 """ - kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' + kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page4k.xz') kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
@@ -312,7 +312,7 @@ def test_mips_malta32el_nanomips_16k_up(self): :avocado: tags=endian:little :avocado: tags=cpu:I7200 """ - kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' + kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page16k_up.xz') kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
@@ -325,7 +325,7 @@ def test_mips_malta32el_nanomips_64k_dbg(self): :avocado: tags=endian:little :avocado: tags=cpu:I7200 """ - kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/' + kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/' 'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/' 'generic_nano32r6el_page64k_dbg.xz') kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
Signature · 1 line
2.45.2
Quoted 36 lines · Philippe Mathieu-Daudé
The following changes since commit
93b799fafd9170da3a79a533ea6f73a18de82e22:Merge tag 'pull-ppc-for-9.1-2-20240726-1' of https://gitlab.com/npiggin/qemu into staging (2024-07-26 15:10:45 +1000)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/docs-testing-20240729
for you to fetch changes up to
8e2275592299b637e87cc905d20bfdeffa586a83:tests/avocado:
test_arm_emcraft_sf2: handle RW requirements for asset (2024-07-29 16:33:24 +0200)Ignored warnings:
WARNING: added, moved or deleted file(s), does
MAINTAINERSneed updating?
WARNING: line over 80 characters----------------------------------------------------------------
Docs & testing patch queue- Test QAPI firmware.json schema (Thomas)
- Handle newenv.doc2path()return value (Peter)
- Convert some Avocado tests to simpler python-based functional testing (Thomas)
- Improve how assets are used by some Avocado tests (Cleber)----------------------------------------------------------------
Cleber Rosa (3):
tests/avocado: mips: fallback to HTTP given certificate expiration tests/avocado: mips: add hint for fetchasset plugin tests/avocado:test_arm_emcraft_sf2: handle RW requirements for assetPeter Maydell (1):
docs/sphinx/depfile.py: Handleenv.doc2path()returning a Path not a
str
Quoted 15 lines
Thomas Huth (9):
python: Install pycotap in our venv if necessary tests/functional: Add base classes for the upcoming pytest-based tests tests/Makefile.include: Increase the level of indentation in the help
text
tests/functional: Prepare the meson build system for the functional
tests
tests/functional: Convert simple avocado tests into standalone python
tests
tests/functional: Convert avocado tests that just need a small
adjustment
tests/functional: Convert thex86_cpu_model_versionstest tests/functional: Convert theriscv_opensbiavocado test into a
standalone test
gitlab-ci: Add "check-functional" to the build tests
On the avocado review I mentioned that I didn't think we should be rebasing avocado during freeze. By the same token, I'm not convinced we should be introducing a new test framework during the freeze period. This is alot simpler than avocado, but at the same time this small subset of Thomas' patches isn't really fixing any problem on its own, as avocado still exists in parallel.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 18 lines · Daniel P. Berrangé
Quoted 7 lines · Philippe Mathieu-Daudé
Thomas Huth (9):
python: Install pycotap in our venv if necessary tests/functional: Add base classes for the upcoming pytest-based tests tests/Makefile.include: Increase the level of indentation in the help
text
tests/functional: Prepare the meson build system for the functional
testsQuoted 8 lines
tests/functional: Convert simple avocado tests into standalone python
tests
tests/functional: Convert avocado tests that just need a small
adjustment
tests/functional: Convert thex86_cpu_model_versionstest tests/functional: Convert theriscv_opensbiavocado test into a
standalone test
gitlab-ci: Add "check-functional" to the build tests
Quoted 7 lines
On the avocado review I mentioned that I didn't think we should be rebasing avocado during freeze. By the same token, I'm not convinced we should be introducing a new test framework during the freeze period. This is alot simpler than avocado, but at the same time this small subset of Thomas' patches isn't really fixing any problem on its own, as avocado still exists in parallel.
- As you noticed, Avocado isn't rebased here
- The python file added is almost a copy of the avocado base class, already well tested
- Test are moved from Avocado, so no waste of time running them twice
- macOS developers can run 178 functional tests. This is the big win and time saver for me.
Do you really see merging these few patches now as being counter productive for the community?
Regards,
Phil.
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Daniel P. Berrangé
Quoted 7 lines · Philippe Mathieu-Daudé
Thomas Huth (9):
python: Install pycotap in our venv if necessary tests/functional: Add base classes for the upcoming pytest-based tests tests/Makefile.include: Increase the level of indentation in the help
text
tests/functional: Prepare the meson build system for the functional
testsQuoted 8 lines
tests/functional: Convert simple avocado tests into standalone python
tests
tests/functional: Convert avocado tests that just need a small
adjustment
tests/functional: Convert thex86_cpu_model_versionstest tests/functional: Convert theriscv_opensbiavocado test into a
standalone test
gitlab-ci: Add "check-functional" to the build testsQuoted 7 lines
On the avocado review I mentioned that I didn't think we should be rebasing avocado during freeze. By the same token, I'm not convinced we should be introducing a new test framework during the freeze period. This is alot simpler than avocado, but at the same time this small subset of Thomas' patches isn't really fixing any problem on its own, as avocado still exists in parallel.
- As you noticed, Avocado isn't rebased here
- The python file added is almost a copy of the avocado base class, already well tested
- Test are moved from Avocado, so no waste of time running them twice
- macOS developers can run 178 functional tests. This is the big win and time saver for me.
Quoted 2 lines
Do you really see merging these few patches now as being counter productive for the community?
I do feel from the discussion in other threads that "what is the way forward for our currently-in-avocado test cases?" is currently still an open question, so I tend to agree with Daniel that it would be better to resolve that question first, and we don't need to be in a hurry to change things in our test framework during the freeze period.
thanks
-- PMM
Quoted 37 lines · Peter Maydell
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Daniel P. Berrangé
Quoted 7 lines · Philippe Mathieu-Daudé
Thomas Huth (9):
python: Install pycotap in our venv if necessary tests/functional: Add base classes for the upcoming pytest-based tests tests/Makefile.include: Increase the level of indentation in the help
text
tests/functional: Prepare the meson build system for the functional
testsQuoted 8 lines
tests/functional: Convert simple avocado tests into standalone python
tests
tests/functional: Convert avocado tests that just need a small
adjustment
tests/functional: Convert thex86_cpu_model_versionstest tests/functional: Convert theriscv_opensbiavocado test into a
standalone test
gitlab-ci: Add "check-functional" to the build testsQuoted 7 lines
On the avocado review I mentioned that I didn't think we should be rebasing avocado during freeze. By the same token, I'm not convinced we should be introducing a new test framework during the freeze period. This is alot simpler than avocado, but at the same time this small subset of Thomas' patches isn't really fixing any problem on its own, as avocado still exists in parallel.
- As you noticed, Avocado isn't rebased here
- The python file added is almost a copy of the avocado base class, already well tested
- Test are moved from Avocado, so no waste of time running them twice
- macOS developers can run 178 functional tests. This is the big win and time saver for me.
Quoted 6 lines
Quoted 2 lines
Do you really see merging these few patches now as being counter productive for the community?
I do feel from the discussion in other threads that "what is the way forward for our currently-in-avocado test cases?" is currently still an open question,
Thomas demonstrated with few LoC we can leverage some Avocado libraries (util, archive, ...) without having to use Avocado framework as our entry point to run acceptance tests - which is what gave us headaches the last 2 years -.
Richard only requirement is a "fetch assets" equivalent. We'll look at.
I don't see anything else blocking this test conversion.
Quoted 4 lines
so I tend to agree with Daniel
that it would be better to resolve that question first, and we don't need to be in a hurry to change things in our test framework during the freeze period.
OK. I'll repost without these patches.
Regards,
Phil.