
* Update to QEMU v9.0.0 --------- Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Ido Plat <ido.plat@ibm.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Gregory Price <gregory.price@memverge.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Lorenz Brun <lorenz@brun.one> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Glenn Miles <milesg@linux.ibm.com> Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Signed-off-by: Yajun Wu <yajunw@nvidia.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Signed-off-by: Lei Wang <lei4.wang@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Wafer <wafer@jaguarmicro.com> Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Signed-off-by: Zack Buhman <zack@buhman.org> Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Yuquan Wang wangyuquan1236@phytium.com.cn Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Co-authored-by: Peter Maydell <peter.maydell@linaro.org> Co-authored-by: Fabiano Rosas <farosas@suse.de> Co-authored-by: Peter Xu <peterx@redhat.com> Co-authored-by: Thomas Huth <thuth@redhat.com> Co-authored-by: Cédric Le Goater <clg@redhat.com> Co-authored-by: Zheyu Ma <zheyuma97@gmail.com> Co-authored-by: Ido Plat <ido.plat@ibm.com> Co-authored-by: Ilya Leoshkevich <iii@linux.ibm.com> Co-authored-by: Markus Armbruster <armbru@redhat.com> Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com> Co-authored-by: Paolo Bonzini <pbonzini@redhat.com> Co-authored-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Co-authored-by: David Hildenbrand <david@redhat.com> Co-authored-by: Kevin Wolf <kwolf@redhat.com> Co-authored-by: Stefan Reiter <s.reiter@proxmox.com> Co-authored-by: Fiona Ebner <f.ebner@proxmox.com> Co-authored-by: Gregory Price <gregory.price@memverge.com> Co-authored-by: Lorenz Brun <lorenz@brun.one> Co-authored-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Co-authored-by: Philippe Mathieu-Daudé <philmd@linaro.org> Co-authored-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Co-authored-by: BALATON Zoltan <balaton@eik.bme.hu> Co-authored-by: Igor Mammedov <imammedo@redhat.com> Co-authored-by: Akihiko Odaki <akihiko.odaki@daynix.com> Co-authored-by: Richard Henderson <richard.henderson@linaro.org> Co-authored-by: Sven Schnelle <svens@stackframe.org> Co-authored-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Co-authored-by: Helge Deller <deller@kernel.org> Co-authored-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Co-authored-by: Benjamin Gray <bgray@linux.ibm.com> Co-authored-by: Nicholas Piggin <npiggin@gmail.com> Co-authored-by: Avihai Horon <avihaih@nvidia.com> Co-authored-by: Michael Tokarev <mjt@tls.msk.ru> Co-authored-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Co-authored-by: Stefan Weil <sw@weilnetz.de> Co-authored-by: Dayu Liu <liu.dayu@zte.com.cn> Co-authored-by: Zhao Liu <zhao1.liu@intel.com> Co-authored-by: Glenn Miles <milesg@linux.vnet.ibm.com> Co-authored-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Co-authored-by: Yajun Wu <yajunw@nvidia.com> Co-authored-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Co-authored-by: Pierre-Clément Tosi <ptosi@google.com> Co-authored-by: Wei Wang <wei.w.wang@intel.com> Co-authored-by: Martin Hundebøll <martin@geanix.com> Co-authored-by: Michael S. Tsirkin <mst@redhat.com> Co-authored-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Co-authored-by: Wafer <wafer@jaguarmicro.com> Co-authored-by: lyx634449800 <yuxue.liu@jaguarmicro.com> Co-authored-by: Gerd Hoffmann <kraxel@redhat.com> Co-authored-by: Nguyen Dinh Phi <phind.uet@gmail.com> Co-authored-by: Zack Buhman <zack@buhman.org> Co-authored-by: Keith Packard <keithp@keithp.com> Co-authored-by: Yuquan Wang <wangyuquan1236@phytium.com.cn> Co-authored-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Co-authored-by: Cindy Lu <lulu@redhat.com>
168 lines
8.5 KiB
ReStructuredText
168 lines
8.5 KiB
ReStructuredText
=============================================================================
|
|
ACPI/SMBIOS avocado tests using biosbits
|
|
=============================================================================
|
|
************
|
|
Introduction
|
|
************
|
|
Biosbits is a software written by Josh Triplett that can be downloaded
|
|
from https://biosbits.org/. The github codebase can be found
|
|
`here <https://github.com/biosbits/bits/tree/master>`__. It is a software that
|
|
executes the bios components such as acpi and smbios tables directly through
|
|
acpica bios interpreter (a freely available C based library written by Intel,
|
|
downloadable from https://acpica.org/ and is included with biosbits) without an
|
|
operating system getting involved in between. Bios-bits has python integration
|
|
with grub so actual routines that executes bios components can be written in
|
|
python instead of bash-ish (grub's native scripting language).
|
|
There are several advantages to directly testing the bios in a real physical
|
|
machine or in a VM as opposed to indirectly discovering bios issues through the
|
|
operating system (the OS). Operating systems tend to bypass bios problems and
|
|
hide them from the end user. We have more control of what we wanted to test and
|
|
how by being as close to the bios on a running system as possible without a
|
|
complicated software component such as an operating system coming in between.
|
|
Another issue is that we cannot exercise bios components such as ACPI and
|
|
SMBIOS without being in the highest hardware privilege level, ring 0 for
|
|
example in case of x86. Since the OS executes from ring 0 whereas normal user
|
|
land software resides in unprivileged ring 3, operating system must be modified
|
|
in order to write our test routines that exercise and test the bios. This is
|
|
not possible in all cases. Lastly, test frameworks and routines are preferably
|
|
written using a high level scripting language such as python. OSes and
|
|
OS modules are generally written using low level languages such as C and
|
|
low level assembly machine language. Writing test routines in a low level
|
|
language makes things more cumbersome. These and other reasons makes using
|
|
bios-bits very attractive for testing bioses. More details on the inspiration
|
|
for developing biosbits and its real life uses can be found in [#a]_ and [#b]_.
|
|
|
|
For QEMU, we maintain a fork of bios bits in gitlab along with all the
|
|
dependent submodules `here <https://gitlab.com/qemu-project/biosbits-bits>`__.
|
|
This fork contains numerous fixes, a newer acpica and changes specific to
|
|
running this avocado QEMU tests using bits. The author of this document
|
|
is the sole maintainer of the QEMU fork of bios bits repository. For more
|
|
information, please see author's `FOSDEM talk on this bios-bits based test
|
|
framework <https://fosdem.org/2024/schedule/event/fosdem-2024-2262-exercising-qemu-generated-acpi-smbios-tables-using-biosbits-from-within-a-guest-vm-/>`__.
|
|
|
|
*********************************
|
|
Description of the test framework
|
|
*********************************
|
|
|
|
Under the directory ``tests/avocado/``, ``acpi-bits.py`` is a QEMU avocado
|
|
test that drives all this.
|
|
|
|
A brief description of the various test files follows.
|
|
|
|
Under ``tests/avocado/`` as the root we have:
|
|
|
|
::
|
|
|
|
├── acpi-bits
|
|
│ ├── bits-config
|
|
│ │ └── bits-cfg.txt
|
|
│ ├── bits-tests
|
|
│ ├── smbios.py2
|
|
│ ├── testacpi.py2
|
|
│ └── testcpuid.py2
|
|
├── acpi-bits.py
|
|
|
|
* ``tests/avocado``:
|
|
|
|
``acpi-bits.py``:
|
|
This is the main python avocado test script that generates a
|
|
biosbits iso. It then spawns a QEMU VM with it, collects the log and reports
|
|
test failures. This is the script one would be interested in if they wanted
|
|
to add or change some component of the log parsing, add a new command line
|
|
to alter how QEMU is spawned etc. Test writers typically would not need to
|
|
modify this script unless they wanted to enhance or change the log parsing
|
|
for their tests. In order to enable debugging, you can set **V=1**
|
|
environment variable. This enables verbose mode for the test and also dumps
|
|
the entire log from bios bits and more information in case failure happens.
|
|
You can also set **BITS_DEBUG=1** to turn on debug mode. It will enable
|
|
verbose logs and also retain the temporary work directory the test used for
|
|
you to inspect and run the specific commands manually.
|
|
|
|
In order to run this test, please perform the following steps from the QEMU
|
|
build directory:
|
|
::
|
|
|
|
$ make check-venv (needed only the first time to create the venv)
|
|
$ ./pyvenv/bin/avocado run -t acpi tests/avocado
|
|
|
|
The above will run all acpi avocado tests including this one.
|
|
In order to run the individual tests, perform the following:
|
|
::
|
|
|
|
$ ./pyvenv/bin/avocado run tests/avocado/acpi-bits.py --tap -
|
|
|
|
The above will produce output in tap format. You can omit "--tap -" in the
|
|
end and it will produce output like the following:
|
|
::
|
|
|
|
$ ./pyvenv/bin/avocado run tests/avocado/acpi-bits.py
|
|
Fetching asset from tests/avocado/acpi-bits.py:AcpiBitsTest.test_acpi_smbios_bits
|
|
JOB ID : eab225724da7b64c012c65705dc2fa14ab1defef
|
|
JOB LOG : /home/anisinha/avocado/job-results/job-2022-10-10T17.58-eab2257/job.log
|
|
(1/1) tests/avocado/acpi-bits.py:AcpiBitsTest.test_acpi_smbios_bits: PASS (33.09 s)
|
|
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
|
|
JOB TIME : 39.22 s
|
|
|
|
You can inspect the log file for more information about the run or in order
|
|
to diagnoze issues. If you pass V=1 in the environment, more diagnostic logs
|
|
would be found in the test log.
|
|
|
|
* ``tests/avocado/acpi-bits/bits-config``:
|
|
|
|
This location contains biosbits configuration files that determine how the
|
|
software runs the tests.
|
|
|
|
``bits-config.txt``:
|
|
This is the biosbits config file that determines what tests
|
|
or actions are performed by bits. The description of the config options are
|
|
provided in the file itself.
|
|
|
|
* ``tests/avocado/acpi-bits/bits-tests``:
|
|
|
|
This directory contains biosbits python based tests that are run from within
|
|
the biosbits environment in the spawned VM. New additions of test cases can
|
|
be made in the appropriate test file. For example, new acpi tests can go
|
|
into testacpi.py2 and one would call testsuite.add_test() to register the new
|
|
test so that it gets executed as a part of the ACPI tests.
|
|
It might be occasionally necessary to disable some subtests or add a new
|
|
test that belongs to a test suite not already present in this directory. To
|
|
do this, please clone the bits source from
|
|
https://gitlab.com/qemu-project/biosbits-bits/-/tree/qemu-bits.
|
|
Note that this is the "qemu-bits" branch and not the "bits" branch of the
|
|
repository. "qemu-bits" is the branch where we have made all the QEMU
|
|
specific enhancements and we must use the source from this branch only.
|
|
Copy the test suite/script that needs modification (addition of new tests
|
|
or disabling them) from python directory into this directory. For
|
|
example, in order to change cpuid related tests, copy the following
|
|
file into this directory and rename it with .py2 extension:
|
|
https://gitlab.com/qemu-project/biosbits-bits/-/blob/qemu-bits/python/testcpuid.py
|
|
Then make your additions and changes here. Therefore, the steps are:
|
|
|
|
(a) Copy unmodified test script to this directory from bits source.
|
|
(b) Add a SPDX license header.
|
|
(c) Perform modifications to the test.
|
|
|
|
Commits (a), (b) and (c) preferably should go under separate commits so that
|
|
the original test script and the changes we have made are separated and
|
|
clear. (a) and (b) can sometimes be combined into a single step.
|
|
|
|
The test framework will then use your modified test script to run the test.
|
|
No further changes would be needed. Please check the logs to make sure that
|
|
appropriate changes have taken effect.
|
|
|
|
The tests have an extension .py2 in order to indicate that:
|
|
|
|
(a) They are python2.7 based scripts and not python 3 scripts.
|
|
(b) They are run from within the bios bits VM and is not subjected to QEMU
|
|
build/test python script maintenance and dependency resolutions.
|
|
(c) They need not be loaded by avocado framework when running tests.
|
|
|
|
|
|
Author: Ani Sinha <anisinha@redhat.com>
|
|
|
|
References:
|
|
-----------
|
|
.. [#a] https://blog.linuxplumbersconf.org/2011/ocw/system/presentations/867/original/bits.pdf
|
|
.. [#b] https://www.youtube.com/watch?v=36QIepyUuhg
|
|
.. [#c] https://fosdem.org/2024/schedule/event/fosdem-2024-2262-exercising-qemu-generated-acpi-smbios-tables-using-biosbits-from-within-a-guest-vm-/
|