testing/next: gdb-multiarch, check-tcg, vbsa tests
cover testing/next: gdb-multiarch, check-tcg, vbsa tests
This is the current status of my testing tree. The gdb-multiarch and filtering changes should be pretty uncontroversial. Due to the enhancements I needed to make to get the vbsa linux tests running they may want to cook a bit longer and wait until the 11.0 release is out of the way.
Please review
Alex.
Alex Bennée (6):
tests/docker: add gdb-multiarch to all-test-cross tests/tcg: allow filtering of TCG tests tests/functional: teach uncompress about zip files tests/functional: allow tests to define decompression target tests/functional: add the ability to send keys tests/functional: add VBSA linux tests
Matheus Tavares Bernardino (1):
tests/tcg/multiarch/linux-test: use portable alternative for dirent64
tests/tcg/multiarch/linux/linux-test.c | 5 +- tests/Makefile.include | 8 +- .../dockerfiles/debian-all-test-cross.docker | 1 + tests/functional/aarch64/test_virt_vbsa.py | 123 ++++++++++++++++-- tests/functional/qemu_test/__init__.py | 3 +- tests/functional/qemu_test/cmd.py | 15 +++ tests/functional/qemu_test/testcase.py | 9 +- tests/functional/qemu_test/uncompress.py | 25 ++++ tests/lcitool/refresh | 1 + tests/tcg/Makefile.target | 12 +- 10 files changed, 181 insertions(+), 21 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/7 tests/docker: add gdb-multiarch to all-test-cross
This allows the gdb integration tests to be run as well.
--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)
tests/docker/dockerfiles/debian-all-test-cross.docker +1 -0
@@ -59,6 +59,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ apt install -y --no-install-recommends \ clang\ dpkg-dev\ + gdb-multiarch\ libclang-rt-dev ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \
tests/lcitool/refresh +1 -0
@@ -167,6 +167,7 @@ debian_all_test_cross_compilers = [ " apt install -y --no-install-recommends \\\n", " clang\\\n", " dpkg-dev\\\n", + " gdb-multiarch\\\n", " libclang-rt-dev\n", "ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \\\n", " libc6-dev-arm64-cross \\\n",
Signature · 1 line
2.47.3
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 8 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
In reply to Alex BennéeQuoted 25 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)tests/docker/dockerfiles/debian-all-test-cross.docker +1
-0@@ -59,6 +59,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ apt install -y --no-install-recommends \ clang\ dpkg-dev\ + gdb-multiarch\ libclang-rt-dev ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \tests/lcitool/refresh +0
-0
tests/lcitool/refresh debian_all_test_cross_compilers = [ · line 173
Quoted 7 lines
tests/lcitool/refresh +1
-0@@ -167,6 +167,7 @@ debian_all_test_cross_compilers = [ " apt install -y --no-install-recommends \\\n", " clang\\\n", " dpkg-dev\\\n", + " gdb-multiarch\\\n", " libclang-rt-dev\n", "ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \\\n", " libc6-dev-arm64-cross \\\n",
As long as ppc gdbstub is not fixed or Philippe series reverted, you'll need also:
tests/tcg/multiarch/Makefile.target +0 -0
@@ -156,12 +156,16 @@ else run-gdbstub-%: $(call skip-test, "gdbstub test $*", "need working gdb with
$(patsubst -%,,$(TARGET_NAME)) support")
endif
+
+# gdbstub broken on ppc
+ifneq ($(TARGET_NAME), ppc)
EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
run-gdbstub-registers run-gdbstub-prot-none \
run-gdbstub-catch-syscalls
run-gdbstub-follow-fork-mode-child \
run-gdbstub-follow-fork-mode-parent \
run-gdbstub-qxfer-siginfo-read run-gdbstub-late-attach+endif
# ARM Compatible Semi Hosting Tests
#
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
In reply to Alex BennéeQuoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>---
tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 +2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>
I'm getting:
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x45001fff Error occurred in Python: Cannot access memory at address 0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121: run-gdbstub-prot-none] Error 1 make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1.
Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66: run-tcg-tests-hppa-linux-user] Error 2
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Which is unfortunate since it is where QEMU run its CI.
Regards,
Pierrick
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 30 lines · Pierrick Bouvier
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>---
tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 +2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2
Quoted 1 line
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 5 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
Pierrick
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Pierrick Bouvier
Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>---
tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 +2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2
Quoted 11 lines
Quoted 1 line
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 5 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
Pierrick
FWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
I'm asking because it may have something to do with /proc/self/mem or with the architecture.
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 39 lines · Ilya Leoshkevich
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Pierrick Bouvier
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>---
tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 +2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Quoted 1 line
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
PierrickFWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
Have a look at these job failures:
https://gitlab.com/philmd/qemu/-/pipelines/2376819801
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x7e085b4b1fff Error occurred in Python: Cannot access memory at address 0x7e085b4b1fff
qemu-aarch64: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121: run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66: run-tcg-tests-aarch64-linux-user] Error 2
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x40802fff Error occurred in Python: Cannot access memory at address 0x40802fff
qemu-arm: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121: run-gdbstub-prot-none] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/philmd/qemu/tests/Makefile.include:66: run-tcg-tests-arm-linux-user] Error 2
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x45001fff Error occurred in Python: Cannot access memory at address 0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121: run-gdbstub-prot-none] Error 1 make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
make: *** [/builds/philmd/qemu/tests/Makefile.include:66: run-tcg-tests-hppa-linux-user] Error 2
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x7d742025efff Error occurred in Python: Cannot access memory at address 0x7d742025efff
qemu-alpha: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121: run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66: run-tcg-tests-alpha-linux-user] Error 2
So at least Alpha / ARM / Aarch64 / HPPA.
(I haven't checked whether the test is run for other targets).
We also run these on GitHub runners where the tests pass, and apparently when running on k8s private runner on GitLab they also pass. The problem is with public runner on GitLab.
Quoted 2 lines
I'm asking because it may have something to do with
/proc/self/memor with the architecture.
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 97 lines · Philippe Mathieu-Daudé
Quoted 40 lines · Ilya Leoshkevich
Quoted 38 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Pierrick Bouvier
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Quoted 2 lines
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
PierrickFWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
Have a look at these job failures:
https://gitlab.com/philmd/qemu/-/pipelines/2376819801Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7e085b4b1fff
Error occurred in Python: Cannot access memory at address0x7e085b4b1fff
qemu-aarch64: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-aarch64-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x40802fff
Error occurred in Python: Cannot access memory at address0x40802fff
qemu-arm: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-arm-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7d742025efff
Error occurred in Python: Cannot access memory at address0x7d742025efff
qemu-alpha: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-alpha-linux-user] Error 2
Quoted 7 lines
So at least Alpha / ARM / Aarch64 / HPPA.
(I haven't checked whether the test is run for other targets).
We also run these on GitHub runners where the tests pass, and apparently when running on k8s private runner on GitLab they also pass. The problem is with public runner on GitLab.
Also another test we ran was to pull GitLab docker image and run the same tests locally within that GitLab-generated image and they passed. So we believe the issue is related to some container restriction with GitLab.
Quoted 5 lines
Quoted 4 lines
I'm asking because it may have something to do with
/proc/self/memor with the architecture.
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 102 lines · Philippe Mathieu-Daudé
Quoted 101 lines · Philippe Mathieu-Daudé
Quoted 40 lines · Ilya Leoshkevich
Quoted 38 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Pierrick Bouvier
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Quoted 2 lines
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
PierrickFWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
Have a look at these job failures:
https://gitlab.com/philmd/qemu/-/pipelines/2376819801Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7e085b4b1fff
Error occurred in Python: Cannot access memory at address0x7e085b4b1fff
qemu-aarch64: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-aarch64-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x40802fff
Error occurred in Python: Cannot access memory at address0x40802fff
qemu-arm: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-arm-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7d742025efff
Error occurred in Python: Cannot access memory at address0x7d742025efff
qemu-alpha: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-alpha-linux-user] Error 2So at least Alpha / ARM / Aarch64 / HPPA.
(I haven't checked whether the test is run for other targets).
Quoted 8 lines
Quoted 3 lines
We also run these on GitHub runners where the tests pass, and apparently when running on k8s private runner on GitLab they also pass. The problem is with public runner on GitLab.
Also another test we ran was to pull GitLab docker image and run the same tests locally within that GitLab-generated image and they passed. So we believe the issue is related to some container restriction with GitLab.
Most likely because the ptrace settings are tighter - ptrace is the mechanism we use to access the memory we can't normally.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
I'm asking because it may have something to do with
/proc/self/memor with the architecture.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 98 lines · Alex Bennée
Quoted 96 lines · Philippe Mathieu-Daudé
Quoted 95 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ilya Leoshkevich
Quoted 33 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Pierrick Bouvier
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Quoted 2 lines
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
PierrickFWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
Have a look at these job failures:
https://gitlab.com/philmd/qemu/-/pipelines/2376819801Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7e085b4b1fff
Error occurred in Python: Cannot access memory at address0x7e085b4b1fff
qemu-aarch64: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-aarch64-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x40802fff
Error occurred in Python: Cannot access memory at address0x40802fff
qemu-arm: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-arm-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7d742025efff
Error occurred in Python: Cannot access memory at address0x7d742025efff
qemu-alpha: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-alpha-linux-user] Error 2So at least Alpha / ARM / Aarch64 / HPPA.
(I haven't checked whether the test is run for other targets).
We also run these on GitHub runners where the tests pass, and apparently when running on k8s private runner on GitLab they also pass. The problem is with public runner on GitLab.
Quoted 6 lines
Quoted 4 lines
Also another test we ran was to pull GitLab docker image and run the same tests locally within that GitLab-generated image and they passed. So we believe the issue is related to some container restriction with GitLab.
Most likely because the ptrace settings are tighter - ptrace is the mechanism we use to access the memory we can't normally.
I thought about this, but then probe_proc_self_mem() that guards the test would fail.
I don't think cpu_memory_rw_debug() does anything in addition to what we probe for.
[...]
Re: [PATCH 1/7] tests/docker: add gdb-multiarch to all-test-cross
Quoted 107 lines · Ilya Leoshkevich
Quoted 98 lines · Alex Bennée
Quoted 96 lines · Philippe Mathieu-Daudé
Quoted 95 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ilya Leoshkevich
Quoted 33 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Pierrick Bouvier
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
This allows the gdb integration tests to be run as well.
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/lcitool/refresh | 1 + 2 files changed, 2 insertions(+)Reviewed-by Philippe Mathieu-Daudé <[email protected]>I'm getting:
Quoted 14 lines
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
warning: Could not load shared library symbols for linux-vdso32.so.1. Do you need "set solib-search-path" or "set sysroot"?
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Quoted 2 lines
To add more information, we tested it on GitHub, our machines and GitLab, and for an unknown reason, it only fails on GitLab runners.
Also we tested on our local Linux machines, where this test pass for all our targets ;)
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Which is unfortunate since it is where QEMU run its CI.
Regards,
PierrickFWIW it passes on my laptop as well.
Does this test fail only for hppa, or for other architectures as well?
Have a look at these job failures:
https://gitlab.com/philmd/qemu/-/pipelines/2376819801Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7e085b4b1fff
Error occurred in Python: Cannot access memory at address0x7e085b4b1fff
qemu-aarch64: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-aarch64-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x40802fff
Error occurred in Python: Cannot access memory at address0x40802fff
qemu-arm: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-arm-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x45001fff
Error occurred in Python: Cannot access memory at address0x45001fff
qemu-hppa: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make[1]: *** Waiting for unfinished jobs....
qemu-hppa: QEMU: Terminated via GDBstub
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-hppa-linux-user] Error 2Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address
0x7d742025efff
Error occurred in Python: Cannot access memory at address0x7d742025efff
qemu-alpha: QEMU: Terminated via GDBstub
make[1]: *** [/builds/philmd/qemu/tests/tcg/multiarch/Makefile.target:121:
run-gdbstub-prot-none] Error 1
make: *** [/builds/philmd/qemu/tests/Makefile.include:66:
run-tcg-tests-alpha-linux-user] Error 2So at least Alpha / ARM / Aarch64 / HPPA.
(I haven't checked whether the test is run for other targets).
We also run these on GitHub runners where the tests pass, and apparently when running on k8s private runner on GitLab they also pass. The problem is with public runner on GitLab.
Quoted 6 lines
Quoted 4 lines
Also another test we ran was to pull GitLab docker image and run the same tests locally within that GitLab-generated image and they passed. So we believe the issue is related to some container restriction with GitLab.
Most likely because the ptrace settings are tighter - ptrace is the mechanism we use to access the memory we can't normally.
Quoted 5 lines
I thought about this, but then
probe_proc_self_mem()that guards the test would fail.I don't think
cpu_memory_rw_debug()does anything in addition to what we probe for.
The probe only checks for read access. Could there be a difference between read and write?
Quoted 3 lines
[...]
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH 2/7 tests/tcg: allow filtering of TCG tests
In reply to Alex BennéeWe have a lot of TCG tests now which can be fiddly if we just want to check one particular test type across the targets. Introduce TCG_TEST_FILTER to allow this:
make check-tcg TCG_TEST_FILTER=gdb
to run all the gdb tests across the suites.
--- tests/Makefile.include | 8 +++++--- tests/tcg/Makefile.target | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-)
tests/Makefile.include +5 -3
@@ -16,9 +16,11 @@ check-help: @echo " $(MAKE) check-tracetool Run tracetool generator 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) run-tcg-tests-TARGET-softmmu Run TCG tests for a given target" + @echo " $(MAKE) check-tcg Run TCG tests" + @echo " $(MAKE) run-tcg-tests-TARGET Run TCG tests for a given target" + @echo + @echo "The variable TCG_TEST_FILTER will select the subset of matching tests." endif @echo @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report"
@@ -64,7 +66,7 @@ $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/ .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \ + $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) TCG_TEST_FILTER=$(TCG_TEST_FILTER) run, \ "RUN", "$* guest-tests") .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
tests/tcg/Makefile.target +11 -1
@@ -254,8 +254,15 @@ endif gdb-%: % gdb --args $(QEMU) $(QEMU_OPTS) $< +# Filter tests based on TCG_TEST_FILTER if set +ifdef TCG_TEST_FILTER +FILTERED_RUN_TESTS=$(foreach test,$(RUN_TESTS),$(if $(findstring $(TCG_TEST_FILTER),$(test)),$(test))) +else +FILTERED_RUN_TESTS=$(RUN_TESTS) +endif + .PHONY: run -run: $(RUN_TESTS) +run: $(FILTERED_RUN_TESTS) clean: rm -f $(TESTS) *.o $(CLEANFILES)
@@ -269,3 +276,6 @@ help: @echo "Built with $(CC)" @echo "Available tests:" @$(foreach t,$(RUN_TESTS),echo " $t";) + @echo "" + @echo "Environment variables:" + @echo " TCG_TEST_FILTER=<pattern> Filter tests matching pattern"
Signature · 1 line
2.47.3
Re: [PATCH 2/7] tests/tcg: allow filtering of TCG tests
Quoted 6 lines · Alex Bennée
We have a lot of TCG tests now which can be fiddly if we just want to check one particular test type across the targets. Introduce
TCG_TEST_FILTERto allow this:make check-tcg TCG_TEST_FILTER=gdb
Quoted 8 lines
to run all the gdb tests across the suites.
Signed-off-by Alex Bennée <[email protected]>--- tests/Makefile.include | 8 +++++--- tests/tcg/Makefile.target | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-)
Ideally, we should have a list command available also, so we don't have to guess what magic pattern names follow.
Re: [PATCH 2/7] tests/tcg: allow filtering of TCG tests
Quoted 13 lines · Pierrick Bouvier
Quoted 11 lines · Alex Bennée
We have a lot of TCG tests now which can be fiddly if we just want to check one particular test type across the targets. Introduce
TCG_TEST_FILTERto allow this:
make check-tcg TCG_TEST_FILTER=gdb
to run all the gdb tests across the suites.Signed-off-by Alex Bennée <[email protected]>--- tests/Makefile.include | 8 +++++--- tests/tcg/Makefile.target | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-)
Quoted 4 lines
Ideally, we should have a list command available also, so we don't have to guess what magic pattern names follow.
Reviewed-by Pierrick Bouvier <[email protected]>
If you run "make help" in one of the TCG test dirs you will get a list:
➜ cd tests/tcg/aarch64-softmmu/
🕙18:35:48 alex@draig:tests/tcg/aarch64-softmmu on pr/060326-11.0-virtio-gpu-updates-1:master [$?⇡] ➜ make help
tests/tcg/aarch64-softmmu: -march=armv8.3-a detected
tests/tcg/aarch64-softmmu: -march=armv8.5-a+memtag detected
TCG tests help aarch64
Built with aarch64-linux-gnu-gcc
Available tests:
run-asid2
run-feat-xs
run-pauth-3
run-semiconsole
run-semiheap
run-vtimer
run-mte
run-hello
run-interrupt
run-memory-sve
run-plugin-hello-with-libdiscons.so
run-plugin-interrupt-with-libempty.so
run-gdbstub-memory
run-gdbstub-interrupt
run-gdbstub-untimely-packet
run-gdbstub-registers
run-memory-replay
run-gdbstub-mte
run-plugin-memory-with-libmem.soSignature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH 2/7] tests/tcg: allow filtering of TCG tests
Quoted 41 lines · Alex Bennée
Quoted 13 lines · Pierrick Bouvier
Quoted 11 lines · Alex Bennée
We have a lot of TCG tests now which can be fiddly if we just want to check one particular test type across the targets. Introduce
TCG_TEST_FILTERto allow this:
make check-tcg TCG_TEST_FILTER=gdb
to run all the gdb tests across the suites.Signed-off-by Alex Bennée <[email protected]>--- tests/Makefile.include | 8 +++++--- tests/tcg/Makefile.target | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-)Quoted 4 lines
Ideally, we should have a list command available also, so we don't have to guess what magic pattern names follow.
Reviewed-by Pierrick Bouvier <[email protected]>If you run "make help" in one of the TCG test dirs you will get a list:
➜ cd tests/tcg/aarch64-softmmu/
🕙18:35:48 alex@draig:tests/tcg/aarch64-softmmu on pr/060326-11.0-virtio-gpu-updates-1:master [$?⇡] ➜ make help
tests/tcg/aarch64-softmmu: -march=armv8.3-a detected
tests/tcg/aarch64-softmmu: -march=armv8.5-a+memtag detected
TCG tests help aarch64
Built with aarch64-linux-gnu-gcc
Available tests:run-asid2 run-feat-xs run-pauth-3 run-semiconsole run-semiheap run-vtimer run-mte run-hello run-interrupt run-memory-sve run-plugin-hello-with-libdiscons.so
Quoted 9 lines
run-plugin-interrupt-with-libempty.so
run-gdbstub-memory
run-gdbstub-interrupt
run-gdbstub-untimely-packet
run-gdbstub-registers
run-memory-replay
run-gdbstub-mte
run-plugin-memory-with-libmem.soYes, but I was more thinking at something from the top, without needing to dive into every arch.
PATCH 3/7 tests/tcg/multiarch/linux-test: use portable alternative for dirent64
In reply to Alex BennéeFrom: Matheus Tavares Bernardino <[email protected]>
dirent64 and readdir64 are glibc-specific and not portable to other C libraries such as musl. Define _FILE_OFFSET_BITS=64 instead, which portably instructs all libc implementations to use 64-bit file offsets, making readdir() and struct dirent equivalent to their 64-bit variants.
Message-ID: <af31d21c4d668cfb940ba4159f584fa6454c3d82.1772107448.git.matheus.bernardino@oss.qualcomm.com>
--- tests/tcg/multiarch/linux/linux-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/tcg/multiarch/linux/linux-test.c +3 -2
@@ -16,6 +16,7 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#define _FILE_OFFSET_BITS 64#define _GNU_SOURCE#include <stdarg.h> #include <stdlib.h>
@@ -83,7 +84,7 @@ static void test_file(void)struct utimbuf tbuf;struct iovec vecs[2 ];DIR *dir; -struct dirent64 *de; +struct dirent *de;/* TODO: make common tempdir creation for tcg tests */ char template[] ="/tmp/linux-test-XXXXXX" ;char *tmpdir =mkdtemp (template);
@@ -191,7 +192,7 @@ static void test_file(void)error ("opendir" ); len =0 ;for (;;) { - de =readdir64 (dir); + de =readdir (dir);if (!de)break ; if (strcmp(de->d_name, ".") != 0 &&
Signature · 1 line
2.47.3
Re: [PATCH 3/7] tests/tcg/multiarch/linux-test: use portable alternative for dirent64
Quoted 7 lines · Alex Bennée
From: Matheus Tavares Bernardino <[email protected]>
dirent64 and readdir64 are glibc-specific and not portable to other C libraries such as musl. Define _FILE_OFFSET_BITS=64 instead, which portably instructs all libc implementations to use 64-bit file offsets, making
readdir()and struct dirent equivalent to their 64-bit variants.
Quoted 8 lines
Signed-off-by Matheus Tavares Bernardino <[email protected]>Reviewed-by Brian Cain <[email protected]>Message-ID: <af31d21c4d668cfb940ba4159f584fa6454c3d82.1772107448.git.matheus.bernardino@oss.qualcomm.com>
Signed-off-by Alex Bennée <[email protected]>--- tests/tcg/multiarch/linux/linux-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
PATCH 4/7 tests/functional: teach uncompress about zip files
In reply to Alex BennéeYes people still use them.
--- tests/functional/qemu_test/uncompress.py | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
tests/functional/qemu_test/uncompress.py +25 -0
@@ -12,6 +12,7 @@ import os import stat import shutil +import zipfile from urllib.parse import urlparse from subprocess import run, CalledProcessError
@@ -58,6 +59,26 @@ def zstd_uncompress(zstd_path, output_path): os.chmod(output_path, stat.S_IRUSR | stat.S_IWUSR) +def zip_uncompress(zip_path, output_path): + if os.path.exists(output_path): + return + with zipfile.ZipFile(zip_path, 'r') as zip_in: + try: + # Get the first file from the archive + names = zip_in.namelist() + if len(names) != 1: + raise Exception( + f"Zip file {zip_path} should contain exactly one file, " + f"but contains {len(names)}") + with zip_in.open(names[0], 'r') as archived_file: + with open(output_path, 'wb') as raw_out: + shutil.copyfileobj(archived_file, raw_out) + except: + if os.path.exists(output_path): + os.remove(output_path) + raise + + def uncompress(compressed, uncompressed, format=None): ''' @params compressed: filename, Asset, or file-like object to uncompress
@@ -81,6 +102,8 @@ def uncompress(compressed, uncompressed, format=None): gzip_uncompress(str(compressed), uncompressed) elif format == "zstd": zstd_uncompress(str(compressed), uncompressed) + elif format == "zip": + zip_uncompress(str(compressed), uncompressed) else: raise Exception(f"Unknown compression format {format}")
@@ -103,5 +126,7 @@ def guess_uncompress_format(compressed): return "gz" elif ext in [".zstd", ".zst"]: return 'zstd' + elif ext == ".zip": + return 'zip' else: raise Exception(f"Unknown compression format for {compressed}")
Signature · 1 line
2.47.3
Re: [PATCH 4/7] tests/functional: teach uncompress about zip files
Quoted 7 lines · Alex Bennée
Yes people still use them.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/qemu_test/uncompress.py | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
Re: [PATCH 4/7] tests/functional: teach uncompress about zip files
In reply to Alex BennéeQuoted 47 lines · Alex Bennée
Yes people still use them.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/qemu_test/uncompress.py | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+)tests/functional/qemu_test/uncompress.py +21
-0@@ -12,6 +12,7 @@ import os import stat import shutil +import zipfile from urllib.parse import urlparse from subprocess import run, CalledProcessError@@ -58,6 +59,26 @@ def zstd_uncompress(zstd_path, output_path): os.chmod(output_path, stat.S_IRUSR | stat.S_IWUSR) +def zip_uncompress(zip_path, output_path): + if os.path.exists(output_path): + return + with zipfile.ZipFile(zip_path, 'r') as zip_in: + try: + # Get the first file from the archive + names = zip_in.namelist() + if len(names) != 1: + raise Exception( + f"Zip file {zip_path} should contain exactly one file, " + f"but contains {len(names)}") + with zip_in.open(names[0], 'r') as archived_file: + with open(output_path, 'wb') as raw_out: + shutil.copyfileobj(archived_file, raw_out) + except: + if os.path.exists(output_path): + os.remove(output_path) + raise + + def uncompress(compressed, uncompressed, format=None): ''' @params compressed: filename, Asset, or file-like object to uncompress
tests/functional/qemu_test/uncompress.py def uncompress(compressed, uncompressed, format=None): · line 108
Quoted 7 lines
tests/functional/qemu_test/uncompress.py +2
-0@@ -81,6 +102,8 @@ def uncompress(compressed, uncompressed, format=None): gzip_uncompress(str(compressed), uncompressed) elif format == "zstd": zstd_uncompress(str(compressed), uncompressed) + elif format == "zip": + zip_uncompress(str(compressed), uncompressed) else: raise Exception(f"Unknown compression format {format}")
I think you should rather use archive_extract() instead of uncompress() for zip files, shouldn't you? ... and if I've got that right, support for zip is already included in there.
Thomas
PATCH 5/7 tests/functional: allow tests to define decompression target
In reply to Alex BennéeWhen dealing with multi-stage decompression we want to specify the target file name lest we just overload the cache name. It also allows for something is little more friendly than the cache hash.
--- tests/functional/qemu_test/testcase.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tests/functional/qemu_test/testcase.py +6 -3
@@ -35,7 +35,7 @@ class QemuBaseTest(unittest.TestCase): - def uncompress(self, compressed, format=None): + def uncompress(self, compressed, target=None, format=None): ''' @params compressed: filename, Asset, or file-like object to uncompress @params format: optional compression format (gzip, lzma)
@@ -52,8 +52,11 @@ def uncompress(self, compressed, format=None): if isinstance(compressed, Asset): compressed.fetch() - (name, _ext) = os.path.splitext(str(compressed)) - uncompressed = self.scratch_file(os.path.basename(name)) + if target is not None: + uncompressed = self.scratch_file(target) + else: + (name, _ext) = os.path.splitext(str(compressed)) + uncompressed = self.scratch_file(os.path.basename(name)) uncompress(compressed, uncompressed, format)
Signature · 1 line
2.47.3
Re: [PATCH 5/7] tests/functional: allow tests to define decompression target
Quoted 9 lines · Alex Bennée
When dealing with multi-stage decompression we want to specify the target file name lest we just overload the cache name. It also allows for something is little more friendly than the cache hash.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/qemu_test/testcase.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
PATCH 6/7 tests/functional: add the ability to send keys
In reply to Alex BennéeTo navigate things like grub we need to send individual keys without trying to look for success messages.
--- tests/functional/qemu_test/__init__.py | 3 ++- tests/functional/qemu_test/cmd.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
tests/functional/qemu_test/__init__.py +2 -1
@@ -10,7 +10,8 @@ from .config import BUILD_DIR, dso_suffix from .cmd import is_readable_executable_file, \ interrupt_interactive_console_until_pattern, wait_for_console_pattern, \ - exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which + exec_command, exec_command_and_wait_for_pattern, get_qemu_img, \ + which, send_key from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest from .linuxkernel import LinuxKernelTest from .decorators import skipIfMissingCommands, skipIfNotMachine, \
tests/functional/qemu_test/cmd.py +15 -0
@@ -142,6 +142,21 @@ def _console_interaction(test, success_message, failure_message, return out +def send_key(test, key, delay=0.2, vm=None): + """ + Send a single key to the console. + + :key: key to send + :delay: debounce delay to wait + :vm: the vm to send to, defaults to test.vm + """ + if vm is None: + vm = test.vm + + test.log.debug(f"Sending key: {key}") + vm.console_socket.sendall(key.encode()) + + def interrupt_interactive_console_until_pattern(test, success_message, failure_message=None, interrupt_string='\r',
Signature · 1 line
2.47.3
Re: [PATCH 6/7] tests/functional: add the ability to send keys
Quoted 9 lines · Alex Bennée
To navigate things like grub we need to send individual keys without trying to look for success messages.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/qemu_test/__init__.py | 3 ++- tests/functional/qemu_test/cmd.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
PATCH 7/7 tests/functional: add VBSA linux tests
In reply to Alex BennéeThis extends the VBSA test to run the linux tests. The sysarch-acs test suite does provide some pre-built images which is good because the tests require a patched kernel. However due to the structure of the image we need to jump one or two hoops to get something useful:
- download and double decompress (zip then xz) the image
- navigate grub to launch the Linux Execution Environment
- shutdown the system once tests are done
- extract the logs from the MSDOS file system and parse them
It does make the code a bit ugly but it works for me at least. So far the subset of tests run is limited but that might be solved by adding some more devices to the PCIe bus to exercise the SMMU behaviour.
--- tests/functional/aarch64/test_virt_vbsa.py | 123 +++++++++++++++++++-- 1 file changed, 112 insertions(+), 11 deletions(-)
tests/functional/aarch64/test_virt_vbsa.py +112 -11
@@ -10,12 +10,15 @@ # SPDX-License-Identifier: GPL-2.0-or-later import shutil -from subprocess import check_call, DEVNULL +import re +from subprocess import check_call, check_output, DEVNULL from qemu_test import QemuSystemTest, Asset from qemu_test import get_qemu_img, skipIfMissingCommands from qemu_test import wait_for_console_pattern +from qemu_test import interrupt_interactive_console_until_pattern as int_until from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait +from qemu_test import send_key @skipIfMissingCommands("mformat", "mcopy", "mmd")
@@ -28,6 +31,20 @@ def wait_for_console_pattern(self, success_message, vm=None): failure_message='FAILED', vm=vm) + def append_firmware_blobs(self): + """ + Setup QEMU firmware blobs for boot. + """ + code_path = self.build_file('pc-bios', 'edk2-aarch64-code.fd') + vars_source = self.build_file('pc-bios', 'edk2-arm-vars.fd') + vars_path = self.scratch_file('vars.fd') + shutil.copy(vars_source, vars_path) + + self.vm.add_args('-drive', + f'if=pflash,format=raw,readonly=on,file={code_path}') + self.vm.add_args('-drive', f'if=pflash,format=raw,file={vars_path}') + + ASSET_VBSA_EFI = Asset( 'https://github.com/ARM-software/sysarch-acs/raw/refs/heads/main' '/prebuilt_images/VBSA/v25.12_VBSA_0.7.0/Vbsa.efi',
@@ -45,20 +62,12 @@ def test_aarch64_vbsa_uefi_tests(self): self.vm.set_console() - # virt machine wi + # virt machine self.set_machine('virt') self.vm.add_args('-M', 'virt,gic-version=max,virtualization=on') self.vm.add_args('-cpu', 'max', '-m', '1024') - # We will use the QEMU firmware blobs to boot - code_path = self.build_file('pc-bios', 'edk2-aarch64-code.fd') - vars_source = self.build_file('pc-bios', 'edk2-arm-vars.fd') - vars_path = self.scratch_file('vars.fd') - shutil.copy(vars_source, vars_path) - - self.vm.add_args('-drive', - f'if=pflash,format=raw,readonly=on,file={code_path}') - self.vm.add_args('-drive', f'if=pflash,format=raw,file={vars_path}') + self.append_firmware_blobs() # Build an EFI FAT32 file-system for the UEFI tests vbsa_efi = self.ASSET_VBSA_EFI.fetch()
@@ -102,5 +111,97 @@ def test_aarch64_vbsa_uefi_tests(self): self.wait_for_console_pattern('VBSA tests complete. Reset the system.') + ASSET_SYSREADY_IMAGE = Asset( + 'https://github.com/ARM-software/arm-systemready/' + 'releases/download/v25.10_SR_3.1.0/systemready_acs_live_image.img.xz.zip', + 'df2c359de15784b1da6a8e6f3c98a053ee38ac0b3f241ccea62e17db092eb03a') + + ROOT_PROMPT = '/ # ' + DOWN_KEY = "\x1b[B" + + @skipIfMissingCommands("sfdisk", "jq") + def test_aarch64_vbsa_linux_tests(self): + """ + Launch the Linux based VBSA test from the ACS prebuilt images. + + We can use the pre-built images and then trigger the Linux + build and run the tests. We then need to slurp the results + from the partition. + """ + + self.vm.set_console() + + # virt machine with SMMU + self.set_machine('virt') + self.vm.add_args('-M', 'virt,gic-version=max,virtualization=on,iommu=smmuv3') + self.vm.add_args('-cpu', 'max', '-m', '1024', '-smp', '4') + + self.append_firmware_blobs() + + # First fetch, decompress (twice) and prepare the disk image + # on an NVME device (the kernel only has drivers for that). + disk_image_zip = self.ASSET_SYSREADY_IMAGE.fetch() + disk_image_xz = self.uncompress(disk_image_zip, + target="sysacs.xz", format="zip") + disk_image = self.uncompress(disk_image_xz, + target="sysacs.img", format="xz") + + self.vm.add_args('-device', + 'nvme,drive=hd,serial=QEMU_ROOT_SSD') + self.vm.add_args('-blockdev', + f'driver=raw,node-name=hd,file.driver=file,file.filename={disk_image}') + + # Launch QEMU and wait for grub and select the "Linux + # Execution Environment" so we can launch the test. + + self.vm.launch() + self.wait_for_console_pattern('Use the ^ and v keys to select which entry is highlighted') + + # 3 down arrows then return to select entry + send_key(self, self.DOWN_KEY) + send_key(self, self.DOWN_KEY) + send_key(self, self.DOWN_KEY) + + ec_and_wait(self, "\n", self.ROOT_PROMPT) + + ec_and_wait(self, "/usr/bin/bsa.sh --skip B_REP_1,B_IEP_1,B_PCIe_11,B_MEM_06", + self.ROOT_PROMPT) + + # Now we can shutdown + ec_and_wait(self, "halt -f", "reboot: System halted") + self.vm.shutdown() + + # and extract the test logs + offset = int(check_output(f"sfdisk --json {disk_image} |" + "jq '.partitiontable.partitions[0].start * 512'", + shell = True)) + bsa_app_res = self.scratch_file("BsaResultsApp.log") + bsa_kern_res = self.scratch_file("BsaResultsKernel.log") + + check_call(["mcopy", "-i", f"{disk_image}@@{offset}", + f"::acs_results/Linux/BsaResultsApp.log", bsa_app_res]) + check_call(["mcopy", "-i", f"{disk_image}@@{offset}", + f"::acs_results/Linux/BsaResultsKernel.log", bsa_kern_res]) + + # for now just check the kernel log for the result summary + test_result_re = re.compile(r"\[.*\]\s+(.+): Result:\s+(\w+)") + summary_re = re.compile(r"Total Tests Run =\s*(\d+), Tests Passed =\s*(\d+), Tests Failed =\s*(\d+)") + + with open(bsa_kern_res, 'r') as f: + for line in f: + test_match = test_result_re.search(line) + if test_match: + desc = test_match.group(1) + status = test_match.group(2) + self.log.info(f"Test: {desc} status: {status}") + + match = summary_re.search(line) + if match: + total, passed, failed = match.groups() + + if int(failed) > 0: + self.fail(f"{failed} tests failed ({total})") + + if __name__ == '__main__': QemuSystemTest.main()
Signature · 1 line
2.47.3
Re: [PATCH 7/7] tests/functional: add VBSA linux tests
Quoted 129 lines · Alex Bennée
This extends the VBSA test to run the linux tests. The sysarch-acs test suite does provide some pre-built images which is good because the tests require a patched kernel. However due to the structure of the image we need to jump one or two hoops to get something useful:
- download and double decompress (zip then xz) the image
- navigate grub to launch the Linux Execution Environment
- shutdown the system once tests are done
- extract the logs from the MSDOS file system and parse themIt does make the code a bit ugly but it works for me at least. So far the subset of tests run is limited but that might be solved by adding some more devices to the PCIe bus to exercise the SMMU behaviour.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/aarch64/test_virt_vbsa.py | 123 +++++++++++++++++++-- 1 file changed, 112 insertions(+), 11 deletions(-)tests/functional/aarch64/test_virt_vbsa.py +61
-11@@ -10,12 +10,15 @@ # SPDX-License-Identifier: GPL-2.0-or-later import shutil -from subprocess import check_call, DEVNULL +import re +from subprocess import check_call, check_output, DEVNULL from qemu_test import QemuSystemTest, Asset from qemu_test import get_qemu_img, skipIfMissingCommands from qemu_test import wait_for_console_pattern +from qemu_test import interrupt_interactive_console_until_pattern as int_until from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait +from qemu_test import send_key @skipIfMissingCommands("mformat", "mcopy", "mmd")@@ -28,6 +31,20 @@ def wait_for_console_pattern(self, success_message, vm=None): failure_message='FAILED', vm=vm) + def append_firmware_blobs(self): + """ + Setup QEMU firmware blobs for boot. + """ + code_path = self.build_file('pc-bios', 'edk2-aarch64-code.fd') + vars_source = self.build_file('pc-bios', 'edk2-arm-vars.fd') + vars_path = self.scratch_file('vars.fd') + shutil.copy(vars_source, vars_path) + + self.vm.add_args('-drive', + f'if=pflash,format=raw,readonly=on,file={code_path}') + self.vm.add_args('-drive', f'if=pflash,format=raw,file={vars_path}') + + ASSET_VBSA_EFI = Asset( 'https://github.com/ARM-software/sysarch-acs/raw/refs/heads/main' '/prebuilt_images/VBSA/v25.12_VBSA_0.7.0/Vbsa.efi',@@ -45,20 +62,12 @@ def test_aarch64_vbsa_uefi_tests(self): self.vm.set_console() - # virt machine wi + # virt machine self.set_machine('virt') self.vm.add_args('-M', 'virt,gic-version=max,virtualization=on') self.vm.add_args('-cpu', 'max', '-m', '1024') - # We will use the QEMU firmware blobs to boot - code_path = self.build_file('pc-bios', 'edk2-aarch64-code.fd') - vars_source = self.build_file('pc-bios', 'edk2-arm-vars.fd') - vars_path = self.scratch_file('vars.fd') - shutil.copy(vars_source, vars_path) - - self.vm.add_args('-drive', - f'if=pflash,format=raw,readonly=on,file={code_path}') - self.vm.add_args('-drive', f'if=pflash,format=raw,file={vars_path}') + self.append_firmware_blobs() # Build an EFI FAT32 file-system for the UEFI tests vbsa_efi = self.ASSET_VBSA_EFI.fetch()@@ -102,5 +111,97 @@ def test_aarch64_vbsa_uefi_tests(self): self.wait_for_console_pattern('VBSA tests complete. Reset the system.') + ASSET_SYSREADY_IMAGE = Asset( + 'https://github.com/ARM-software/arm-systemready/' + 'releases/download/v25.10_SR_3.1.0/systemready_acs_live_image.img.xz.zip', + 'df2c359de15784b1da6a8e6f3c98a053ee38ac0b3f241ccea62e17db092eb03a') + + ROOT_PROMPT = '/ # ' + DOWN_KEY = "\x1b[B" + + @skipIfMissingCommands("sfdisk", "jq") + def test_aarch64_vbsa_linux_tests(self): + """ + Launch the Linux based VBSA test from the ACS prebuilt images. + + We can use the pre-built images and then trigger the Linux + build and run the tests. We then need to slurp the results + from the partition. + """ + + self.vm.set_console() + + # virt machine with SMMU + self.set_machine('virt') + self.vm.add_args('-M', 'virt,gic-version=max,virtualization=on,iommu=smmuv3') + self.vm.add_args('-cpu', 'max', '-m', '1024', '-smp', '4') + + self.append_firmware_blobs() + + # First fetch, decompress (twice) and prepare the disk image + # on an NVME device (the kernel only has drivers for that). + disk_image_zip = self.ASSET_SYSREADY_IMAGE.fetch() + disk_image_xz = self.uncompress(disk_image_zip, + target="sysacs.xz", format="zip") + disk_image = self.uncompress(disk_image_xz, + target="sysacs.img", format="xz") + + self.vm.add_args('-device', + 'nvme,drive=hd,serial=QEMU_ROOT_SSD') + self.vm.add_args('-blockdev', + f'driver=raw,node-name=hd,file.driver=file,file.filename={disk_image}') + + # Launch QEMU and wait for grub and select the "Linux
tests/functional/aarch64/test_virt_vbsa.py def test_aarch64_vbsa_uefi_tests(self): · line 164
Quoted 10 lines
tests/functional/aarch64/test_virt_vbsa.py +10
-0+ # Execution Environment" so we can launch the test. + + self.vm.launch() + self.wait_for_console_pattern('Use the ^ and v keys to select which entry is highlighted') + + # 3 down arrows then return to select entry + send_key(self, self.DOWN_KEY) + send_key(self, self.DOWN_KEY) + send_key(self, self.DOWN_KEY) +
As a suggestion,
Alternatively, is it possible to modify the image to select a different kind of command?
I have no idea which bootloader they use, but if it's grub or simply a UEFI shell script, it should be quite easy to generate the right entry.
Quoted 33 lines
tests/functional/aarch64/test_virt_vbsa.py +33
-0+ ec_and_wait(self, "\n", self.ROOT_PROMPT) + + ec_and_wait(self, "/usr/bin/bsa.sh --skip B_REP_1,B_IEP_1,B_PCIe_11,B_MEM_06", + self.ROOT_PROMPT) + + # Now we can shutdown + ec_and_wait(self, "halt -f", "reboot: System halted") + self.vm.shutdown() + + # and extract the test logs + offset = int(check_output(f"sfdisk --json {disk_image} |" + "jq '.partitiontable.partitions[0].start * 512'", + shell = True)) + bsa_app_res = self.scratch_file("BsaResultsApp.log") + bsa_kern_res = self.scratch_file("BsaResultsKernel.log") + + check_call(["mcopy", "-i", f"{disk_image}@@{offset}", + f"::acs_results/Linux/BsaResultsApp.log", bsa_app_res]) + check_call(["mcopy", "-i", f"{disk_image}@@{offset}", + f"::acs_results/Linux/BsaResultsKernel.log", bsa_kern_res]) + + # for now just check the kernel log for the result summary + test_result_re = re.compile(r"\[.*\]\s+(.+): Result:\s+(\w+)") + summary_re = re.compile(r"Total Tests Run =\s*(\d+), Tests Passed =\s*(\d+), Tests Failed =\s*(\d+)") + + with open(bsa_kern_res, 'r') as f: + for line in f: + test_match = test_result_re.search(line) + if test_match: + desc = test_match.group(1) + status = test_match.group(2) + self.log.info(f"Test: {desc} status: {status}") +
tests/functional/aarch64/test_virt_vbsa.py def test_aarch64_vbsa_uefi_tests(self): · line 207
Quoted 10 lines
tests/functional/aarch64/test_virt_vbsa.py +8
-0+ match = summary_re.search(line) + if match: + total, passed, failed = match.groups() + + if int(failed) > 0: + self.fail(f"{failed} tests failed ({total})") + + if __name__ == '__main__': QemuSystemTest.main()