mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-request-2024-09-11' of https://gitlab.com/thuth/qemu into staging
* Split --enable-sanitizers to --enable-{asan, ubsan}
* Build MSYS2 job using multiple CPUs
* Fix "make distclean" wrt contrib/plugins/
* Convert more Avocado tests to plain standalone functional tests
* Fix bug that breaks "make check-functional" when tesseract is missing
* Use builtin hashlib of Python in the functional tests
* Update the FreeBSD CI jobs to 14.1
# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmbhY4YRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbU/aw/9HXl9H8BUDn8lnoEmxuuQSk8F19n/l5pt
# en3L8pMBt4dGFe/9KaGes2GFfid+cp2zlx+qQhA4HW35ntMJorF/qinOH/JGDtoM
# 3O6RGZrQPn60zD9P2EbFVCrVYysVYCEu0U3Uglj6tf33bE0L7SJsQxqcbIciyIj5
# aq3Te0yMM2lqzCdMqNpWHGn3VMZRvbRaGBPDU4RLP8V2Bpz1iiRE+6HCH9Kg7HzS
# OmleeXtvcyInG+54onjfTcn4/XA27pl1UU04KFv5PrRPB3M2FspHn7oOT2yyQ+ls
# 79mqIcd8PvycCT+3ch9p8KhVtbVBgZGmeemALLvk5FxysaWnl4KtSqmQNdqSvvpV
# waDDKlLaSnjEHDUse3bCJX0m4d7/vTBY5fOYxqZ4z5dl63csDtgPY4/VF4XR08sP
# tR1mW+2qEH9eygsxuKcBjx/j7Etpy+jL9pX2ii1V3ElhjjYuEnpEiURa+TaqPjpZ
# jmPtBEszzUdPbrD707tDkW3/ezT7VAnASQeYneJXB/JQG6K6Z//05iX6oCzCbRm3
# ceW/fem3UaeGYpzbMdoZToTuNlXEyS7NDcr39xJjH4LyRTPJAX4zeqUEdzces9g/
# u4Dw6rJ0Yhj4rscKxRvGl3/BH6CTI+8IAsbju2B/CnVLTqaABB0q/MDB90aB44xX
# bAVsl4P03Uk=
# =5TR0
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 11 Sep 2024 10:31:50 BST
# gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg: issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg: aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5
* tag 'pull-request-2024-09-11' of https://gitlab.com/thuth/qemu: (24 commits)
Update FreeBSD CI jobs FreeBSD 14.1
tests/functional/qemu_test: Use Python hashlib instead of external programs
tests/functional: Fix bad usage of has_cmd
tests/functional: Convert the multiprocess avocado test into a standalone test
tests/functional: Convert the or1k-sim Avocado test
tests/functional: Convert the m68k MCF5208EVB Avocado test
tests/functional: Convert the Alpha Clipper Avocado test
tests/functional: Convert Aarch64 Raspi4 avocado tests
tests/functional: Convert Aarch64 Raspi3 avocado tests
tests/functional: Convert ARM Raspi2 avocado tests
tests/functional: Convert mips32eb 4Kc Malta avocado tests
tests/functional: Convert nanomips Malta avocado tests
tests/functional: Convert mips32el Malta YAMON avocado test
tests/functional: Convert mips64el 5KEc Malta avocado tests
tests/functional: Convert mips64el I6400 Malta avocado tests
tests/functional: Convert mips64el Fuloong2e avocado test (2/2)
tests/functional: Convert the m68k Q800 Avocado test into a functional test
tests/functional: Add the LinuxKernelTest for testing the Linux boot process
MAINTAINERS: Remove myself from the Meson section
MAINTAINERS: Remove myself as reviewer
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -353,6 +353,8 @@ build-tcg-disabled:
|
||||
124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
|
||||
208 209 216 218 227 234 246 247 248 250 254 255 257 258
|
||||
260 261 262 263 264 270 272 273 277 279 image-fleecing
|
||||
- cd ../..
|
||||
- make distclean
|
||||
|
||||
build-user:
|
||||
extends: .native_build_job_template
|
||||
@@ -436,9 +438,8 @@ clang-system:
|
||||
job: amd64-fedora-container
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++
|
||||
--extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
|
||||
--extra-cflags=-fno-sanitize=function
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
|
||||
--extra-cflags=-fno-sanitize-recover=undefined
|
||||
TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
|
||||
MAKE_CHECK_ARGS: check-qtest check-tcg
|
||||
|
||||
@@ -449,10 +450,9 @@ clang-user:
|
||||
timeout: 70m
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system --enable-ubsan
|
||||
--target-list-exclude=alpha-linux-user,microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
|
||||
--extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
|
||||
--extra-cflags=-fno-sanitize=function
|
||||
--extra-cflags=-fno-sanitize-recover=undefined
|
||||
MAKE_CHECK_ARGS: check-unit check-tcg
|
||||
|
||||
# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
|
||||
|
||||
@@ -46,13 +46,13 @@
|
||||
variables:
|
||||
QEMU_JOB_CIRRUS: 1
|
||||
|
||||
x64-freebsd-13-build:
|
||||
x64-freebsd-14-build:
|
||||
extends: .cirrus_build_job
|
||||
variables:
|
||||
NAME: freebsd-13
|
||||
NAME: freebsd-14
|
||||
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
|
||||
CIRRUS_VM_IMAGE_SELECTOR: image_family
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-13-3
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-14-1
|
||||
CIRRUS_VM_CPUS: 8
|
||||
CIRRUS_VM_RAM: 8G
|
||||
UPDATE_COMMAND: pkg update; pkg upgrade -y
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# THIS FILE WAS AUTO-GENERATED
|
||||
#
|
||||
# $ lcitool variables freebsd-13 qemu
|
||||
# $ lcitool variables freebsd-14 qemu
|
||||
#
|
||||
# https://gitlab.com/libvirt/libvirt-ci
|
||||
|
||||
@@ -103,7 +103,7 @@ ubuntu-22.04-aarch64-clang:
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers
|
||||
- ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-ubsan
|
||||
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
@@ -80,7 +80,7 @@ ubuntu-22.04-s390x-clang:
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --cc=clang --cxx=clang++ --enable-sanitizers
|
||||
- ../configure --cc=clang --cxx=clang++ --enable-ubsan
|
||||
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- make --output-sync -j`nproc`
|
||||
- make --output-sync -j`nproc` check
|
||||
|
||||
@@ -88,6 +88,7 @@ msys2-64bit:
|
||||
mingw-w64-x86_64-python
|
||||
mingw-w64-x86_64-zstd"
|
||||
- Write-Output "Running build at $(Get-Date -Format u)"
|
||||
- $env:JOBS = $(.\msys64\usr\bin\bash -lc nproc)
|
||||
- $env:CHERE_INVOKING = 'yes' # Preserve the current working directory
|
||||
- $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
|
||||
- $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
|
||||
@@ -99,7 +100,7 @@ msys2-64bit:
|
||||
- cd build
|
||||
- ..\msys64\usr\bin\bash -lc "ccache --zero-stats"
|
||||
- ..\msys64\usr\bin\bash -lc "../configure $CONFIGURE_ARGS"
|
||||
- ..\msys64\usr\bin\bash -lc "make"
|
||||
- ..\msys64\usr\bin\bash -lc "make -j$env:JOBS"
|
||||
- ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;"
|
||||
- ..\msys64\usr\bin\bash -lc "ccache --show-stats"
|
||||
- Write-Output "Finished build at $(Get-Date -Format u)"
|
||||
|
||||
+7
-5
@@ -911,6 +911,9 @@ F: hw/*/bcm283*
|
||||
F: include/hw/arm/rasp*
|
||||
F: include/hw/*/bcm283*
|
||||
F: docs/system/arm/raspi.rst
|
||||
F: tests/functional/test_arm_raspi2.py
|
||||
F: tests/functional/test_aarch64_raspi3.py
|
||||
F: tests/functional/test_aarch64_raspi4.py
|
||||
|
||||
Real View
|
||||
M: Peter Maydell <peter.maydell@linaro.org>
|
||||
@@ -1310,6 +1313,7 @@ F: include/hw/m68k/q800-glue.h
|
||||
F: include/hw/misc/djmemc.h
|
||||
F: include/hw/misc/iosb.h
|
||||
F: include/hw/audio/asc.h
|
||||
F: tests/functional/test_m68k_q800.py
|
||||
|
||||
virt
|
||||
M: Laurent Vivier <laurent@vivier.eu>
|
||||
@@ -1369,7 +1373,9 @@ F: hw/mips/malta.c
|
||||
F: hw/pci-host/gt64120.c
|
||||
F: include/hw/southbridge/piix.h
|
||||
F: tests/avocado/linux_ssh_mips_malta.py
|
||||
F: tests/avocado/machine_mips_malta.py
|
||||
F: tests/functional/test_mips_malta.py
|
||||
F: tests/functional/test_mipsel_malta.py
|
||||
F: tests/functional/test_mips64el_malta.py
|
||||
|
||||
Mipssim
|
||||
R: Aleksandar Rikalo <arikalo@gmail.com>
|
||||
@@ -3188,7 +3194,6 @@ F: qapi/cryptodev.json
|
||||
Python library
|
||||
M: John Snow <jsnow@redhat.com>
|
||||
M: Cleber Rosa <crosa@redhat.com>
|
||||
R: Beraldo Leal <bleal@redhat.com>
|
||||
S: Maintained
|
||||
F: python/
|
||||
T: git https://gitlab.com/jsnow/qemu.git python
|
||||
@@ -4135,7 +4140,6 @@ M: Alex Bennée <alex.bennee@linaro.org>
|
||||
M: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||||
M: Thomas Huth <thuth@redhat.com>
|
||||
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
|
||||
R: Beraldo Leal <bleal@redhat.com>
|
||||
S: Maintained
|
||||
F: .github/workflows/lockdown.yml
|
||||
F: .gitlab-ci.yml
|
||||
@@ -4181,7 +4185,6 @@ W: https://trello.com/b/6Qi1pxVn/avocado-qemu
|
||||
R: Cleber Rosa <crosa@redhat.com>
|
||||
R: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||||
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
|
||||
R: Beraldo Leal <bleal@redhat.com>
|
||||
S: Odd Fixes
|
||||
F: tests/avocado/
|
||||
|
||||
@@ -4215,7 +4218,6 @@ Meson
|
||||
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||
R: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
R: Daniel P. Berrange <berrange@redhat.com>
|
||||
R: Thomas Huth <thuth@redhat.com>
|
||||
R: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||||
S: Maintained
|
||||
F: meson.build
|
||||
|
||||
@@ -77,7 +77,7 @@ lib%$(SO_SUFFIX): %.o
|
||||
endif
|
||||
|
||||
|
||||
clean:
|
||||
clean distclean:
|
||||
rm -f *.o *$(SO_SUFFIX) *.d
|
||||
rm -Rf .libs
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ Configure with (substitute the clang binaries with the version you installed).
|
||||
Here, enable-sanitizers, is optional but it allows us to reliably detect bugs
|
||||
such as out-of-bounds accesses, use-after-frees, double-frees etc.::
|
||||
|
||||
CC=clang-8 CXX=clang++-8 /path/to/configure --enable-fuzzing \
|
||||
--enable-sanitizers
|
||||
CC=clang-8 CXX=clang++-8 /path/to/configure \
|
||||
--enable-fuzzing --enable-asan --enable-ubsan
|
||||
|
||||
Fuzz targets are built similarly to system targets::
|
||||
|
||||
|
||||
+20
-6
@@ -479,24 +479,38 @@ if get_option('safe_stack') and coroutine_backend != 'ucontext'
|
||||
error('SafeStack is only supported with the ucontext coroutine backend')
|
||||
endif
|
||||
|
||||
if get_option('sanitizers')
|
||||
if get_option('asan')
|
||||
if cc.has_argument('-fsanitize=address')
|
||||
qemu_cflags = ['-fsanitize=address'] + qemu_cflags
|
||||
qemu_ldflags = ['-fsanitize=address'] + qemu_ldflags
|
||||
else
|
||||
error('Your compiler does not support -fsanitize=address')
|
||||
endif
|
||||
endif
|
||||
|
||||
# Detect static linking issue with ubsan - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
|
||||
if get_option('ubsan')
|
||||
# Detect static linking issue with ubsan:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
|
||||
if cc.links('int main(int argc, char **argv) { return argc + 1; }',
|
||||
args: [qemu_ldflags, '-fsanitize=undefined'])
|
||||
qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
|
||||
qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
|
||||
qemu_cflags += ['-fsanitize=undefined']
|
||||
qemu_ldflags += ['-fsanitize=undefined']
|
||||
|
||||
# Suppress undefined behaviour from function call to mismatched type.
|
||||
# In addition, tcg prologue does not emit function type prefix
|
||||
# required by function call sanitizer.
|
||||
if cc.has_argument('-fno-sanitize=function')
|
||||
qemu_cflags += ['-fno-sanitize=function']
|
||||
endif
|
||||
else
|
||||
error('Your compiler does not support -fsanitize=undefined')
|
||||
endif
|
||||
endif
|
||||
|
||||
# Thread sanitizer is, for now, much noisier than the other sanitizers;
|
||||
# keep it separate until that is not the case.
|
||||
if get_option('tsan')
|
||||
if get_option('sanitizers')
|
||||
if get_option('asan') or get_option('ubsan')
|
||||
error('TSAN is not supported with other sanitizers')
|
||||
endif
|
||||
if not cc.has_function('__tsan_create_fiber',
|
||||
@@ -2525,7 +2539,7 @@ if rdma.found()
|
||||
endif
|
||||
|
||||
have_asan_fiber = false
|
||||
if get_option('sanitizers') and \
|
||||
if get_option('asan') and \
|
||||
not cc.has_function('__sanitizer_start_switch_fiber',
|
||||
args: '-fsanitize=address',
|
||||
prefix: '#include <sanitizer/asan_interface.h>')
|
||||
|
||||
+4
-2
@@ -91,8 +91,10 @@ option('tcg_interpreter', type: 'boolean', value: false,
|
||||
description: 'TCG with bytecode interpreter (slow)')
|
||||
option('safe_stack', type: 'boolean', value: false,
|
||||
description: 'SafeStack Stack Smash Protection (requires clang/llvm and coroutine backend ucontext)')
|
||||
option('sanitizers', type: 'boolean', value: false,
|
||||
description: 'enable default sanitizers')
|
||||
option('asan', type: 'boolean', value: false,
|
||||
description: 'enable address sanitizer')
|
||||
option('ubsan', type: 'boolean', value: false,
|
||||
description: 'enable undefined behaviour sanitizer')
|
||||
option('tsan', type: 'boolean', value: false,
|
||||
description: 'enable thread sanitizer')
|
||||
option('stack_protector', type: 'feature', value: 'auto',
|
||||
|
||||
@@ -21,6 +21,7 @@ meson_options_help() {
|
||||
printf "%s\n" ' --disable-relocatable toggle relocatable install'
|
||||
printf "%s\n" ' --docdir=VALUE Base directory for documentation installation'
|
||||
printf "%s\n" ' (can be empty) [share/doc]'
|
||||
printf "%s\n" ' --enable-asan enable address sanitizer'
|
||||
printf "%s\n" ' --enable-block-drv-whitelist-in-tools'
|
||||
printf "%s\n" ' use block whitelist also in tools instead of only'
|
||||
printf "%s\n" ' QEMU'
|
||||
@@ -46,13 +47,13 @@ meson_options_help() {
|
||||
printf "%s\n" ' getrandom()'
|
||||
printf "%s\n" ' --enable-safe-stack SafeStack Stack Smash Protection (requires'
|
||||
printf "%s\n" ' clang/llvm and coroutine backend ucontext)'
|
||||
printf "%s\n" ' --enable-sanitizers enable default sanitizers'
|
||||
printf "%s\n" ' --enable-strip Strip targets on install'
|
||||
printf "%s\n" ' --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
|
||||
printf "%s\n" ' --enable-trace-backends=CHOICES'
|
||||
printf "%s\n" ' Set available tracing backends [log] (choices:'
|
||||
printf "%s\n" ' dtrace/ftrace/log/nop/simple/syslog/ust)'
|
||||
printf "%s\n" ' --enable-tsan enable thread sanitizer'
|
||||
printf "%s\n" ' --enable-ubsan enable undefined behaviour sanitizer'
|
||||
printf "%s\n" ' --firmwarepath=VALUES search PATH for firmware files [share/qemu-'
|
||||
printf "%s\n" ' firmware]'
|
||||
printf "%s\n" ' --iasl=VALUE Path to ACPI disassembler'
|
||||
@@ -231,6 +232,8 @@ _meson_option_parse() {
|
||||
--disable-af-xdp) printf "%s" -Daf_xdp=disabled ;;
|
||||
--enable-alsa) printf "%s" -Dalsa=enabled ;;
|
||||
--disable-alsa) printf "%s" -Dalsa=disabled ;;
|
||||
--enable-asan) printf "%s" -Dasan=true ;;
|
||||
--disable-asan) printf "%s" -Dasan=false ;;
|
||||
--enable-attr) printf "%s" -Dattr=enabled ;;
|
||||
--disable-attr) printf "%s" -Dattr=disabled ;;
|
||||
--audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
|
||||
@@ -459,8 +462,6 @@ _meson_option_parse() {
|
||||
--disable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=disabled ;;
|
||||
--enable-safe-stack) printf "%s" -Dsafe_stack=true ;;
|
||||
--disable-safe-stack) printf "%s" -Dsafe_stack=false ;;
|
||||
--enable-sanitizers) printf "%s" -Dsanitizers=true ;;
|
||||
--disable-sanitizers) printf "%s" -Dsanitizers=false ;;
|
||||
--enable-sdl) printf "%s" -Dsdl=enabled ;;
|
||||
--disable-sdl) printf "%s" -Dsdl=disabled ;;
|
||||
--enable-sdl-image) printf "%s" -Dsdl_image=enabled ;;
|
||||
@@ -508,6 +509,8 @@ _meson_option_parse() {
|
||||
--disable-u2f) printf "%s" -Du2f=disabled ;;
|
||||
--enable-uadk) printf "%s" -Duadk=enabled ;;
|
||||
--disable-uadk) printf "%s" -Duadk=disabled ;;
|
||||
--enable-ubsan) printf "%s" -Dubsan=true ;;
|
||||
--disable-ubsan) printf "%s" -Dubsan=false ;;
|
||||
--enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
|
||||
--disable-usb-redir) printf "%s" -Dusb_redir=disabled ;;
|
||||
--enable-vde) printf "%s" -Dvde=enabled ;;
|
||||
|
||||
@@ -307,16 +307,6 @@ class QemuSystemTest(QemuBaseTest):
|
||||
if netdevhelp.find('\n' + netdevname + '\n') < 0:
|
||||
self.cancel('no support for user networking')
|
||||
|
||||
def require_multiprocess(self):
|
||||
"""
|
||||
Test for the presence of the x-pci-proxy-dev which is required
|
||||
to support multiprocess.
|
||||
"""
|
||||
devhelp = run_cmd([self.qemu_bin,
|
||||
'-M', 'none', '-device', 'help'])[0];
|
||||
if devhelp.find('x-pci-proxy-dev') < 0:
|
||||
self.cancel('no support for multiprocess device emulation')
|
||||
|
||||
def _new_vm(self, name, *args):
|
||||
self._sd = tempfile.TemporaryDirectory(prefix="qemu_")
|
||||
vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,162 +0,0 @@
|
||||
# Functional tests for the MIPS Malta board
|
||||
#
|
||||
# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
#
|
||||
# This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import gzip
|
||||
import logging
|
||||
|
||||
from avocado import skipUnless
|
||||
from avocado import skipUnless
|
||||
from avocado.utils import archive
|
||||
from avocado_qemu import QemuSystemTest
|
||||
from avocado_qemu import exec_command_and_wait_for_pattern
|
||||
from avocado_qemu import interrupt_interactive_console_until_pattern
|
||||
from avocado_qemu import wait_for_console_pattern
|
||||
|
||||
|
||||
NUMPY_AVAILABLE = True
|
||||
try:
|
||||
import numpy as np
|
||||
except ImportError:
|
||||
NUMPY_AVAILABLE = False
|
||||
|
||||
CV2_AVAILABLE = True
|
||||
try:
|
||||
import cv2
|
||||
except ImportError:
|
||||
CV2_AVAILABLE = False
|
||||
|
||||
|
||||
@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
|
||||
@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
|
||||
class MaltaMachineFramebuffer(QemuSystemTest):
|
||||
|
||||
timeout = 30
|
||||
|
||||
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
|
||||
|
||||
def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
|
||||
"""
|
||||
Boot Linux kernel and check Tux logo is displayed on the framebuffer.
|
||||
"""
|
||||
screendump_path = os.path.join(self.workdir, 'screendump.pbm')
|
||||
|
||||
kernel_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
|
||||
'a5966ca4b5/mips/malta/mips64el/'
|
||||
'vmlinux-4.7.0-rc1.I6400.gz')
|
||||
kernel_hash = '096f50c377ec5072e6a366943324622c312045f6'
|
||||
kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
||||
kernel_path = self.workdir + "vmlinux"
|
||||
archive.gzip_uncompress(kernel_path_gz, kernel_path)
|
||||
|
||||
tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
|
||||
'drivers/video/logo/logo_linux_vga16.ppm')
|
||||
tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
|
||||
tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)
|
||||
|
||||
self.vm.set_console()
|
||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||
'clocksource=GIC console=tty0 console=ttyS0')
|
||||
self.vm.add_args('-kernel', kernel_path,
|
||||
'-smp', '%u' % cpu_cores_count,
|
||||
'-vga', 'std',
|
||||
'-append', kernel_command_line)
|
||||
self.vm.launch()
|
||||
framebuffer_ready = 'Console: switching to colour frame buffer device'
|
||||
wait_for_console_pattern(self, framebuffer_ready,
|
||||
failure_message='Kernel panic - not syncing')
|
||||
self.vm.cmd('human-monitor-command', command_line='stop')
|
||||
self.vm.cmd('human-monitor-command',
|
||||
command_line='screendump %s' % screendump_path)
|
||||
logger = logging.getLogger('framebuffer')
|
||||
|
||||
match_threshold = 0.95
|
||||
screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
|
||||
tuxlogo_bgr = cv2.imread(tuxlogo_path, cv2.IMREAD_COLOR)
|
||||
result = cv2.matchTemplate(screendump_bgr, tuxlogo_bgr,
|
||||
cv2.TM_CCOEFF_NORMED)
|
||||
loc = np.where(result >= match_threshold)
|
||||
tuxlogo_count = 0
|
||||
h, w = tuxlogo_bgr.shape[:2]
|
||||
debug_png = os.getenv('AVOCADO_CV2_SCREENDUMP_PNG_PATH')
|
||||
for tuxlogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
|
||||
logger.debug('found Tux at position (x, y) = %s', pt)
|
||||
cv2.rectangle(screendump_bgr, pt,
|
||||
(pt[0] + w, pt[1] + h), (0, 0, 255), 2)
|
||||
if debug_png:
|
||||
cv2.imwrite(debug_png, screendump_bgr)
|
||||
self.assertGreaterEqual(tuxlogo_count, cpu_cores_count)
|
||||
|
||||
def test_mips_malta_i6400_framebuffer_logo_1core(self):
|
||||
"""
|
||||
:avocado: tags=arch:mips64el
|
||||
:avocado: tags=machine:malta
|
||||
:avocado: tags=cpu:I6400
|
||||
"""
|
||||
self.do_test_i6400_framebuffer_logo(1)
|
||||
|
||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
||||
def test_mips_malta_i6400_framebuffer_logo_7cores(self):
|
||||
"""
|
||||
:avocado: tags=arch:mips64el
|
||||
:avocado: tags=machine:malta
|
||||
:avocado: tags=cpu:I6400
|
||||
:avocado: tags=mips:smp
|
||||
:avocado: tags=flaky
|
||||
"""
|
||||
self.do_test_i6400_framebuffer_logo(7)
|
||||
|
||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
||||
def test_mips_malta_i6400_framebuffer_logo_8cores(self):
|
||||
"""
|
||||
:avocado: tags=arch:mips64el
|
||||
:avocado: tags=machine:malta
|
||||
:avocado: tags=cpu:I6400
|
||||
:avocado: tags=mips:smp
|
||||
:avocado: tags=flaky
|
||||
"""
|
||||
self.do_test_i6400_framebuffer_logo(8)
|
||||
|
||||
class MaltaMachine(QemuSystemTest):
|
||||
|
||||
def do_test_yamon(self):
|
||||
rom_url = ('https://s3-eu-west-1.amazonaws.com/'
|
||||
'downloads-mips/mips-downloads/'
|
||||
'YAMON/yamon-bin-02.22.zip')
|
||||
rom_hash = '8da7ecddbc5312704b8b324341ee238189bde480'
|
||||
zip_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
|
||||
|
||||
archive.extract(zip_path, self.workdir)
|
||||
yamon_path = os.path.join(self.workdir, 'yamon-02.22.bin')
|
||||
|
||||
self.vm.set_console()
|
||||
self.vm.add_args('-bios', yamon_path)
|
||||
self.vm.launch()
|
||||
|
||||
prompt = 'YAMON>'
|
||||
pattern = 'YAMON ROM Monitor'
|
||||
interrupt_interactive_console_until_pattern(self, pattern, prompt)
|
||||
wait_for_console_pattern(self, prompt)
|
||||
self.vm.shutdown()
|
||||
|
||||
def test_mipsel_malta_yamon(self):
|
||||
"""
|
||||
:avocado: tags=arch:mipsel
|
||||
:avocado: tags=machine:malta
|
||||
:avocado: tags=endian:little
|
||||
"""
|
||||
self.do_test_yamon()
|
||||
|
||||
def test_mips64el_malta_yamon(self):
|
||||
"""
|
||||
:avocado: tags=arch:mips64el
|
||||
:avocado: tags=machine:malta
|
||||
:avocado: tags=endian:little
|
||||
"""
|
||||
self.do_test_yamon()
|
||||
@@ -1,102 +0,0 @@
|
||||
# Test for multiprocess qemu
|
||||
#
|
||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
# later. See the COPYING file in the top-level directory.
|
||||
|
||||
|
||||
import os
|
||||
import socket
|
||||
|
||||
from avocado_qemu import QemuSystemTest
|
||||
from avocado_qemu import wait_for_console_pattern
|
||||
from avocado_qemu import exec_command
|
||||
from avocado_qemu import exec_command_and_wait_for_pattern
|
||||
|
||||
class Multiprocess(QemuSystemTest):
|
||||
"""
|
||||
:avocado: tags=multiprocess
|
||||
"""
|
||||
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
|
||||
|
||||
def do_test(self, kernel_url, kernel_hash, initrd_url, initrd_hash,
|
||||
kernel_command_line, machine_type):
|
||||
"""Main test method"""
|
||||
self.require_accelerator('kvm')
|
||||
self.require_multiprocess()
|
||||
|
||||
# Create socketpair to connect proxy and remote processes
|
||||
proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,
|
||||
socket.SOCK_STREAM)
|
||||
os.set_inheritable(proxy_sock.fileno(), True)
|
||||
os.set_inheritable(remote_sock.fileno(), True)
|
||||
|
||||
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
||||
initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
||||
|
||||
# Create remote process
|
||||
remote_vm = self.get_vm()
|
||||
remote_vm.add_args('-machine', 'x-remote')
|
||||
remote_vm.add_args('-nodefaults')
|
||||
remote_vm.add_args('-device', 'lsi53c895a,id=lsi1')
|
||||
remote_vm.add_args('-object', 'x-remote-object,id=robj1,'
|
||||
'devid=lsi1,fd='+str(remote_sock.fileno()))
|
||||
remote_vm.launch()
|
||||
|
||||
# Create proxy process
|
||||
self.vm.set_console()
|
||||
self.vm.add_args('-machine', machine_type)
|
||||
self.vm.add_args('-accel', 'kvm')
|
||||
self.vm.add_args('-cpu', 'host')
|
||||
self.vm.add_args('-object',
|
||||
'memory-backend-memfd,id=sysmem-file,size=2G')
|
||||
self.vm.add_args('--numa', 'node,memdev=sysmem-file')
|
||||
self.vm.add_args('-m', '2048')
|
||||
self.vm.add_args('-kernel', kernel_path,
|
||||
'-initrd', initrd_path,
|
||||
'-append', kernel_command_line)
|
||||
self.vm.add_args('-device',
|
||||
'x-pci-proxy-dev,'
|
||||
'id=lsi1,fd='+str(proxy_sock.fileno()))
|
||||
self.vm.launch()
|
||||
wait_for_console_pattern(self, 'as init process',
|
||||
'Kernel panic - not syncing')
|
||||
exec_command(self, 'mount -t sysfs sysfs /sys')
|
||||
exec_command_and_wait_for_pattern(self,
|
||||
'cat /sys/bus/pci/devices/*/uevent',
|
||||
'PCI_ID=1000:0012')
|
||||
|
||||
def test_multiprocess_x86_64(self):
|
||||
"""
|
||||
:avocado: tags=arch:x86_64
|
||||
"""
|
||||
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
||||
'/linux/releases/31/Everything/x86_64/os/images'
|
||||
'/pxeboot/vmlinuz')
|
||||
kernel_hash = '5b6f6876e1b5bda314f93893271da0d5777b1f3c'
|
||||
initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
||||
'/linux/releases/31/Everything/x86_64/os/images'
|
||||
'/pxeboot/initrd.img')
|
||||
initrd_hash = 'dd0340a1b39bd28f88532babd4581c67649ec5b1'
|
||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||
'console=ttyS0 rdinit=/bin/bash')
|
||||
machine_type = 'pc'
|
||||
self.do_test(kernel_url, kernel_hash, initrd_url, initrd_hash,
|
||||
kernel_command_line, machine_type)
|
||||
|
||||
def test_multiprocess_aarch64(self):
|
||||
"""
|
||||
:avocado: tags=arch:aarch64
|
||||
"""
|
||||
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
||||
'/linux/releases/31/Everything/aarch64/os/images'
|
||||
'/pxeboot/vmlinuz')
|
||||
kernel_hash = '3505f2751e2833c681de78cee8dda1e49cabd2e8'
|
||||
initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
||||
'/linux/releases/31/Everything/aarch64/os/images'
|
||||
'/pxeboot/initrd.img')
|
||||
initrd_hash = '519a1962daf17d67fc3a9c89d45affcb399607db'
|
||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||
'rdinit=/bin/bash console=ttyAMA0')
|
||||
machine_type = 'virt,gic-version=3'
|
||||
self.do_test(kernel_url, kernel_hash, initrd_url, initrd_hash,
|
||||
kernel_command_line, machine_type)
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Compile and check with clang & --enable-debug --enable-sanitizers.
|
||||
# Compile and check with clang & debug & sanitizers
|
||||
#
|
||||
# Copyright (c) 2016-2018 Red Hat Inc.
|
||||
#
|
||||
@@ -19,7 +19,7 @@ requires_binary clang
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
|
||||
OPTS="--enable-debug --enable-sanitizers $OPTS"
|
||||
OPTS="--enable-debug --enable-asan --enable-ubsan $OPTS"
|
||||
|
||||
export ASAN_OPTIONS=detect_leaks=0
|
||||
build_qemu $OPTS
|
||||
|
||||
@@ -35,13 +35,21 @@ tests_generic_bsduser = [
|
||||
]
|
||||
|
||||
tests_aarch64_system_thorough = [
|
||||
'aarch64_raspi3',
|
||||
'aarch64_raspi4',
|
||||
'aarch64_sbsaref',
|
||||
'aarch64_virt',
|
||||
'multiprocess',
|
||||
]
|
||||
|
||||
tests_alpha_system_thorough = [
|
||||
'alpha_clipper',
|
||||
]
|
||||
|
||||
tests_arm_system_thorough = [
|
||||
'arm_canona1100',
|
||||
'arm_integratorcp',
|
||||
'arm_raspi2',
|
||||
]
|
||||
|
||||
tests_arm_linuxuser_thorough = [
|
||||
@@ -57,7 +65,9 @@ tests_loongarch64_system_thorough = [
|
||||
]
|
||||
|
||||
tests_m68k_system_thorough = [
|
||||
'm68k_nextcube'
|
||||
'm68k_mcf5208evb',
|
||||
'm68k_nextcube',
|
||||
'm68k_q800',
|
||||
]
|
||||
|
||||
tests_microblaze_system_thorough = [
|
||||
@@ -68,12 +78,25 @@ tests_microblazeel_system_thorough = [
|
||||
'microblazeel_s3adsp1800'
|
||||
]
|
||||
|
||||
tests_mips_system_thorough = [
|
||||
'mips_malta',
|
||||
]
|
||||
|
||||
tests_mipsel_system_thorough = [
|
||||
'mipsel_malta',
|
||||
]
|
||||
|
||||
tests_mips64el_system_quick = [
|
||||
'mips64el_fuloong2e',
|
||||
]
|
||||
|
||||
tests_mips64el_system_thorough = [
|
||||
'mips64el_loongson3v',
|
||||
'mips64el_malta',
|
||||
]
|
||||
|
||||
tests_or1k_system_quick = [
|
||||
'or1k_sim',
|
||||
]
|
||||
|
||||
tests_ppc_system_quick = [
|
||||
@@ -119,6 +142,7 @@ tests_x86_64_system_quick = [
|
||||
tests_x86_64_system_thorough = [
|
||||
'acpi_bits',
|
||||
'linux_initrd',
|
||||
'multiprocess',
|
||||
'netdev_ethtool',
|
||||
'virtio_gpu',
|
||||
]
|
||||
|
||||
@@ -12,3 +12,4 @@ from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \
|
||||
interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
|
||||
exec_command, exec_command_and_wait_for_pattern, get_qemu_img
|
||||
from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
|
||||
from .linuxkernel import LinuxKernelTest
|
||||
|
||||
@@ -43,15 +43,21 @@ class Asset:
|
||||
if self.hash is None:
|
||||
return True
|
||||
if len(self.hash) == 64:
|
||||
sum_prog = 'sha256sum'
|
||||
hl = hashlib.sha256()
|
||||
elif len(self.hash) == 128:
|
||||
sum_prog = 'sha512sum'
|
||||
hl = hashlib.sha512()
|
||||
else:
|
||||
raise Exception("unknown hash type")
|
||||
|
||||
checksum = subprocess.check_output(
|
||||
[sum_prog, str(cache_file)]).split()[0]
|
||||
return self.hash == checksum.decode("utf-8")
|
||||
# Calculate the hash of the file:
|
||||
with open(cache_file, 'rb') as file:
|
||||
while True:
|
||||
chunk = file.read(1 << 20)
|
||||
if not chunk:
|
||||
break
|
||||
hl.update(chunk)
|
||||
|
||||
return hl.hexdigest()
|
||||
|
||||
def valid(self):
|
||||
return self.cache_file.exists() and self._check(self.cache_file)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user