tests/acceptance: Queue for 4.2
cover tests/acceptance: Queue for 4.2
Hi,
These Avocado-related patches were posted some weeks/months ago but got lost in the mailing list traffic.
Please review,
Phil.
Cleber Rosa (1):
Acceptance tests: refactor wait_for_console_pattern
Philippe Mathieu-Daudé (25):
python/qemu/machine: Allow to use other serial consoles than default tests/acceptance: Fixe wait_for_console_pattern() hangs tests/acceptance: Send <carriage return> on serial lines tests/acceptance: Refactor exec_command_and_wait_for_pattern() tests/acceptance: Rename avocado_qemu.Test as MachineTest tests/acceptance: Make pick_default_qemu_bin() more generic tests/acceptance: Introduce LinuxUserTest base class tests/acceptance: Add bFLT loader linux-user test tests/acceptance: Add test that boots the HelenOS microkernel on Leon3 tests/acceptance: Add test that boots Linux up to BusyBox on Leon3 .travis.yml: Let the avocado job run the Leon3 test tests/acceptance: Add test that runs NetBSD 4.0 installer on PRep/40p tests/acceptance: Test Open Firmware on the PReP/40p tests/acceptance: Test OpenBIOS on the PReP/40p tests/acceptance: Test Sandalfoot initrd on the PReP/40p .travis.yml: Let the avocado job run the 40p tests tests/boot_console: Test booting HP-UX firmware upgrade tests/boot_linux_console: Use Avocado archive::gzip_uncompress() tests/boot_linux_console: Add a test for the Raspberry Pi 2 tests/boot_linux_console: Test the raspi2 UART1 (16550 based) tests/boot_linux_console: Boot Linux and run few commands on raspi3 tests/boot_linux_console: Test SDHCI and termal sensor on raspi3 tests/boot_linux_console: Add initrd test for the Exynos4210 tests/boot_linux_console: Add sdcard test for the Exynos4210 tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
.travis.yml | 2 +- MAINTAINERS | 2 + docs/devel/testing.rst | 8 +- python/qemu/machine.py | 9 +- tests/acceptance/avocado_qemu/__init__.py | 71 ++++- tests/acceptance/boot_linux_console.py | 348 +++++++++++++++++++--- tests/acceptance/cpu_queries.py | 4 +- tests/acceptance/empty_cpu_model.py | 4 +- tests/acceptance/linux_initrd.py | 4 +- tests/acceptance/linux_ssh_mips_malta.py | 22 +- tests/acceptance/load_bflt.py | 52 ++++ tests/acceptance/machine_sparc_leon3.py | 65 ++++ tests/acceptance/migration.py | 4 +- tests/acceptance/ppc_prep_40p.py | 134 +++++++++ tests/acceptance/version.py | 4 +- tests/acceptance/virtio_version.py | 4 +- tests/acceptance/vnc.py | 4 +- 17 files changed, 660 insertions(+), 81 deletions(-) create mode 100644 tests/acceptance/load_bflt.py create mode 100644 tests/acceptance/machine_sparc_leon3.py create mode 100644 tests/acceptance/ppc_prep_40p.py
Signature · 1 line
2.21.0
PATCH 5/26 tests/acceptance: Refactor exec_command_and_wait_for_pattern()
Refactor the exec_command_and_wait_for_pattern() utility method so we can reuse it in other files.
---
v2: fix self -> test, failure_message is optional, added doc
v3: reword because after rebasing only 1 file has to be modified
--- tests/acceptance/avocado_qemu/__init__.py | 19 +++++++++++++++++++ tests/acceptance/boot_linux_console.py | 18 +++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +19 -0
@@ -79,6 +79,25 @@ def wait_for_console_pattern(test, success_message, failure_message=None): test.fail(fail) +def exec_command_and_wait_for_pattern(test, command, + success_message, failure_message=None): + """ + Send a command to a console (appending CRLF characters), then wait + for success_message to appear on the console, while logging the. + content. Mark the test as failed if failure_message is found instead. + + :param test: an Avocado test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`avocado_qemu.Test` + :param command: the command to send + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + command += '\r' + test.vm.console_socket.sendall(command.encode()) + wait_for_console_pattern(test, success_message, failure_message) + + class Test(avocado.Test): def setUp(self): self._vms = {}
tests/acceptance/boot_linux_console.py +7 -11
@@ -14,6 +14,7 @@ import gzip import shutil from avocado_qemu import Test +from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive
@@ -33,11 +34,6 @@ class BootLinuxConsole(Test): wait_for_console_pattern(self, success_message, failure_message='Kernel panic - not syncing') - def exec_command_and_wait_for_pattern(self, command, success_message): - command += '\r' - self.vm.console_socket.sendall(command.encode()) - wait_for_console_pattern(self, success_message) - def extract_from_deb(self, deb, path): """ Extracts a file from a deb package into the test workdir
@@ -166,12 +162,12 @@ class BootLinuxConsole(Test): self.vm.launch() self.wait_for_console_pattern('Boot successful.') - self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', - 'BogoMIPS') - self.exec_command_and_wait_for_pattern('uname -a', - 'Debian') - self.exec_command_and_wait_for_pattern('reboot', - 'reboot: Restarting system') + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'BogoMIPS') + exec_command_and_wait_for_pattern(self, 'uname -a', + 'Debian') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash): kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
Signature · 1 line
2.21.0
PATCH 8/26 tests/acceptance: Introduce LinuxUserTest base class
In reply to Philippe Mathieu-DaudéSimilarly to the MachineTest base class, this class contains methods common to linux-user tests.
--- tests/acceptance/avocado_qemu/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+)
tests/acceptance/avocado_qemu/__init__.py +9 -0
@@ -14,6 +14,7 @@ import sys import uuid import avocado +from avocado.utils import process SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..') sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
@@ -138,3 +139,11 @@ class MachineTest(Test): def tearDown(self): for vm in self._vms.values(): vm.shutdown() + + +class LinuxUserTest(Test): + def setUp(self): + self.base_setUp("%s-linux-user", "qemu-%s") + + def run(self, cmd): + return process.run("%s %s" % (self.qemu_bin, cmd))
Signature · 1 line
2.21.0
PATCH 1/26 python/qemu/machine: Allow to use other serial consoles than default
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Currently the QEMU Python module limits the QEMUMachine class to use the first serial console.
Some machines/guest might use another console than the first one as the 'boot console'. For example the Raspberry Pi uses the second (AUX) console.
To be able to use the Nth console as default, we simply need to connect all the N - 1 consoles to the null chardev.
Add an index argument, so we can use a specific serial console as default.
---
v2:
- renamed 'console_index', added docstring (Cleber)
- reworded description (pm215)
--- python/qemu/machine.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
python/qemu/machine.py +8 -1
@@ -235,6 +235,8 @@ class QEMUMachine(object): '-display', 'none', '-vga', 'none'] if self._machine is not None: args.extend(['-machine', self._machine]) + for i in range(self._console_index): + args.extend(['-serial', 'null']) if self._console_set: self._console_address = os.path.join(self._temp_dir, self._name + "-console.sock")
@@ -495,7 +497,7 @@ class QEMUMachine(object): """ self._machine = machine_type - def set_console(self, device_type=None): + def set_console(self, device_type=None, console_index=0): """ Sets the device type for a console device
@@ -516,9 +518,14 @@ class QEMUMachine(object): chardev:console" command line argument will be used instead, resorting to the machine's default device type. + @param console_index: the index of the console device to use. + If not zero, the command line will create + 'index - 1' consoles and connect them to + the 'null' backing character device. """ self._console_set = True self._console_device_type = device_type + self._console_index = console_index @property def console_socket(self):
Signature · 1 line
2.21.0
PATCH 10/26 tests/acceptance: Add test that boots the HelenOS microkernel on Leon3
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Release notes:
http://www.helenos.org/wiki/Download#HelenOS0.6.0
--- MAINTAINERS | 1 + tests/acceptance/machine_sparc_leon3.py | 37 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/acceptance/machine_sparc_leon3.py
MAINTAINERS +1 -0
@@ -1173,6 +1173,7 @@ S: Maintained F: hw/sparc/leon3.c F: hw/*/grlib* F: include/hw/*/grlib* +F: tests/acceptance/machine_sparc_leon3.py S390 Machines -------------
tests/acceptance/machine_sparc_leon3.py new file +37 -0
@@ -0,0 +1,37 @@ +# Functional test that boots a Leon3 machine and checks its serial console. +# +# Copyright (c) Philippe Mathieu-Daudé <[email protected]> +# +# 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 logging + +from avocado import skipIf +from avocado_qemu import MachineTest + + +class Leon3Machine(MachineTest): + + timeout = 60 + + def test_leon3_helenos_uimage(self): + """ + :avocado: tags=arch:sparc + :avocado: tags=machine:leon3 + :avocado: tags=binfmt:uimage + """ + kernel_url = ('http://www.helenos.org/releases/' + 'HelenOS-0.6.0-sparc32-leon3.bin') + kernel_hash = 'a88c9cfdb8430c66650e5290a08765f9bf049a30' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('leon3_generic') + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path) + + self.vm.launch() + + wait_for_console_pattern(self,'Copyright (c) 2001-2014 HelenOS project') + wait_for_console_pattern(self,'Booting the kernel ...')
Signature · 1 line
2.21.0
PATCH 7/26 tests/acceptance: Make pick_default_qemu_bin() more generic
In reply to Philippe Mathieu-DaudéMake pick_default_qemu_bin() generic to find qemu-system or qemu-user binaries.
--- tests/acceptance/avocado_qemu/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +6 -6
@@ -24,7 +24,7 @@ def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) -def pick_default_qemu_bin(arch=None): +def pick_default_qemu_bin(path_fmt, bin_fmt, arch=None): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory.
@@ -43,8 +43,7 @@ def pick_default_qemu_bin(arch=None): # qemu binary path does not match arch for powerpc, handle it if 'ppc64le' in arch: arch = 'ppc64' - qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, - "qemu-system-%s" % arch) + qemu_bin_relative_path = os.path.join(path_fmt % arch, bin_fmt % arch) if is_readable_executable_file(qemu_bin_relative_path): return qemu_bin_relative_path
@@ -99,14 +98,15 @@ def exec_command_and_wait_for_pattern(test, command, class Test(avocado.Test): - def setUp(self): + def base_setUp(self, path_fmt, bin_fmt): arches = self.tags.get('arch', []) if len(arches) == 1: arch = arches.pop() else: arch = None self.arch = self.params.get('arch', default=arch) - default_qemu_bin = pick_default_qemu_bin(arch=self.arch) + default_qemu_bin = pick_default_qemu_bin(path_fmt, bin_fmt, + arch=self.arch) self.qemu_bin = self.params.get('qemu_bin', default=default_qemu_bin) if self.qemu_bin is None:
@@ -116,7 +116,7 @@ class Test(avocado.Test): class MachineTest(Test): def setUp(self): self._vms = {} - super().setUp() + self.base_setUp("%s-softmmu", "qemu-system-%s") def _new_vm(self, *args): vm = QEMUMachine(self.qemu_bin)
Signature · 1 line
2.21.0
PATCH 17/26 .travis.yml: Let the avocado job run the 40p tests
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
--- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
@@ -267,7 +267,7 @@ matrix: # Acceptance (Functional) tests - env: - - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu" + - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu" - TEST_CMD="make check-acceptance" after_failure: - cat tests/results/latest/job.log
Signature · 1 line
2.21.0
PATCH 2/26 Acceptance tests: refactor wait_for_console_pattern
In reply to Philippe Mathieu-DaudéFrom: Cleber Rosa <[email protected]>
The same utility method is already present in two different test files, so let's consolidate it into a single utility function.
Message-Id: <[email protected]>
--- tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++++++++++++ tests/acceptance/boot_linux_console.py | 27 +++++------------------ tests/acceptance/linux_ssh_mips_malta.py | 18 +++------------ 3 files changed, 33 insertions(+), 37 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +25 -0
@@ -8,6 +8,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. +import logging import os import sys import uuid
@@ -53,6 +54,30 @@ def pick_default_qemu_bin(arch=None): return qemu_bin_from_src_dir_path +def wait_for_console_pattern(test, success_message, failure_message=None): + """ + Waits for messages to appear on the console, while logging the content + + :param test: an Avocado test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`avocado_qemu.Test` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + console = test.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline().strip() + if not msg: + continue + console_logger.debug(msg) + if success_message in msg: + break + if failure_message and failure_message in msg: + fail = 'Failure message found in console: %s' % failure_message + test.fail(fail) + + class Test(avocado.Test): def setUp(self): self._vms = {}
tests/acceptance/boot_linux_console.py +5 -22
@@ -9,12 +9,12 @@ # later. See the COPYING file in the top-level directory. import os -import logging import lzma import gzip import shutil from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive
@@ -29,31 +29,14 @@ class BootLinuxConsole(Test): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' - def wait_for_console_pattern(self, success_message, - failure_message='Kernel panic - not syncing'): - """ - Waits for messages to appear on the console, while logging the content - - :param success_message: if this message appears, test succeeds - :param failure_message: if this message appears, test fails - """ - console = self.vm.console_socket.makefile() - console_logger = logging.getLogger('console') - while True: - msg = console.readline().strip() - if not msg: - continue - console_logger.debug(msg) - if success_message in msg: - break - if failure_message in msg: - fail = 'Failure message found in console: %s' % failure_message - self.fail(fail) + def wait_for_console_pattern(self, success_message): + wait_for_console_pattern(self, success_message, + failure_message='Kernel panic - not syncing') def exec_command_and_wait_for_pattern(self, command, success_message): command += '\n' self.vm.console_socket.sendall(command.encode()) - self.wait_for_console_pattern(success_message) + wait_for_console_pattern(self, success_message) def extract_from_deb(self, deb, path): """
tests/acceptance/linux_ssh_mips_malta.py +3 -15
@@ -13,6 +13,7 @@ import time from avocado import skipUnless from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive from avocado.utils import ssh
@@ -69,19 +70,6 @@ class LinuxSSH(Test): def setUp(self): super(LinuxSSH, self).setUp() - def wait_for_console_pattern(self, success_message, - failure_message='Oops'): - console = self.vm.console_socket.makefile() - console_logger = logging.getLogger('console') - while True: - msg = console.readline() - console_logger.debug(msg.strip()) - if success_message in msg: - break - if failure_message in msg: - fail = 'Failure message found in console: %s' % failure_message - self.fail(fail) - def get_portfwd(self): res = self.vm.command('human-monitor-command', command_line='info usernet')
@@ -137,7 +125,7 @@ class LinuxSSH(Test): self.log.info('VM launched, waiting for sshd') console_pattern = 'Starting OpenBSD Secure Shell server: sshd' - self.wait_for_console_pattern(console_pattern) + wait_for_console_pattern(self, console_pattern, 'Oops') self.log.info('sshd ready') self.ssh_connect('root', 'root')
@@ -145,7 +133,7 @@ class LinuxSSH(Test): def shutdown_via_ssh(self): self.ssh_command('poweroff') self.ssh_disconnect_vm() - self.wait_for_console_pattern('Power down') + wait_for_console_pattern(self, 'Power down', 'Oops') def ssh_command_output_contains(self, cmd, exp): stdout, _ = self.ssh_command(cmd)
Signature · 1 line
2.21.0
PATCH 11/26 tests/acceptance: Add test that boots Linux up to BusyBox on Leon3
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Gaisler provides convenient images:
https://www.gaisler.com/index.php/downloads/linux
HOWTO build:
https://www.gaisler.com/index.php/products/operating-systems/linux
--- tests/acceptance/machine_sparc_leon3.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
tests/acceptance/machine_sparc_leon3.py +28 -0
@@ -10,6 +10,8 @@ import logging from avocado import skipIf from avocado_qemu import MachineTest +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command_and_wait_for_pattern class Leon3Machine(MachineTest):
@@ -35,3 +37,29 @@ class Leon3Machine(MachineTest): wait_for_console_pattern(self,'Copyright (c) 2001-2014 HelenOS project') wait_for_console_pattern(self,'Booting the kernel ...') + + def test_leon3_linux_kernel_4_9_busybox(self): + """ + :avocado: tags=arch:sparc + :avocado: tags=machine:leon3 + """ + kernel_url = ('https://www.gaisler.com/anonftp/linux/linux-4/images/' + 'leon-linux-4.9/leon-linux-4.9-1.0/up/image.ram') + kernel_hash = '289bd1bcca10cda76d0ef2264a8657adc251f5f5' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('leon3_generic') + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path) + + self.vm.launch() + + wait_for_console_pattern(self, 'TYPE: Leon3 System-on-a-Chip') + + wait_for_console_pattern(self, 'Welcome to Buildroot') + + wait_for_console_pattern(self, 'buildroot login:') + exec_command_and_wait_for_pattern(self, 'root', '#') + uname = 'Linux buildroot 4.9.54-00018-g62dab2c #2 ' \ + 'Wed Oct 18 09:45:51 CEST 2017 sparc GNU/Linux' + exec_command_and_wait_for_pattern(self, 'uname -a', uname)
Signature · 1 line
2.21.0
PATCH 14/26 tests/acceptance: Test Open Firmware on the PReP/40p
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://tyom.blogspot.com/2019/04/aixprep-under-qemu-how-to.html
---
v3: use avocado_qemu.wait_for_console_pattern (Cleber)
--- tests/acceptance/ppc_prep_40p.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tests/acceptance/ppc_prep_40p.py +21 -0
@@ -48,3 +48,24 @@ class IbmPrep40pMachine(MachineTest): os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007' wait_for_console_pattern(self, os_banner) wait_for_console_pattern(self, 'Model: IBM PPS Model 6015') + + def test_openfirmware(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + bios_url = ('https://github.com/artyom-tarasenko/openfirmware/' + 'releases/download/40p-20190413/q40pofw-serial.rom') + bios_hash = '880c80172ea5b2247c0ac2a8bf36bbe385192c72' + bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash) + + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-bios', bios_path) + + self.vm.launch() + wait_for_console_pattern(self, 'QEMU PReP/40p') + fw_banner = 'Open Firmware, built April 13, 2019 09:29:23' + wait_for_console_pattern(self, fw_banner) + prompt_msg = 'Type any key to interrupt automatic startup' + wait_for_console_pattern(self, prompt_msg)
Signature · 1 line
2.21.0
PATCH 20/26 tests/boot_linux_console: Add a test for the Raspberry Pi 2
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Similar to the x86_64/pc test, it boots a Linux kernel on a raspi2 board and verify the serial is working.
The kernel image and DeviceTree blob are built by the Raspbian project (based on Debian):
https://www.raspbian.org/RaspbianImages
as recommended by the Raspberry Pi project:
https://www.raspberrypi.org/downloads/raspbian/
If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:arm tests/acceptance
$ avocado run -t machine:raspi2 tests/acceptance---
v2: removed debug printf (Cleber)
use serial_kernel_cmdline dict
--- tests/acceptance/boot_linux_console.py | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
tests/acceptance/boot_linux_console.py +36 -0
@@ -293,6 +293,42 @@ class BootLinuxConsole(MachineTest): self.vm.launch() self.wait_for_console_pattern('init started: BusyBox') + def do_test_arm_raspi2(self, uart_id): + """ + The kernel can be rebuilt using the kernel source referenced + and following the instructions on the on: + https://www.raspberrypi.org/documentation/linux/kernel/building.md + """ + serial_kernel_cmdline = { + 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0', + } + deb_url = ('http://archive.raspberrypi.org/debian/' + 'pool/main/r/raspberrypi-firmware/' + 'raspberrypi-kernel_1.20190215-1_armhf.deb') + deb_hash = 'cd284220b32128c5084037553db3c482426f3972' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img') + dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') + + self.vm.set_machine('raspi2') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + serial_kernel_cmdline[uart_id]) + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + + def test_arm_raspi2_uart0(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi2 + :avocado: tags=device:pl011 + """ + self.do_test_arm_raspi2(0) + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 3/26 tests/acceptance: Fixe wait_for_console_pattern() hangs
In reply to Philippe Mathieu-DaudéBecause of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket as soon as we stop to use it.
--- tests/acceptance/avocado_qemu/__init__.py | 1 + 1 file changed, 1 insertion(+)
tests/acceptance/avocado_qemu/__init__.py +1 -0
@@ -74,6 +74,7 @@ def wait_for_console_pattern(test, success_message, failure_message=None): if success_message in msg: break if failure_message and failure_message in msg: + console.close() fail = 'Failure message found in console: %s' % failure_message test.fail(fail)
Signature · 1 line
2.21.0
PATCH 12/26 .travis.yml: Let the avocado job run the Leon3 test
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
---
If this list continues to grow we can
- split it (as other jobs)
- move them to GitLab where we can have multi-stage jobs, avocado tests run on top of build jobs.
--- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
@@ -267,7 +267,7 @@ matrix: # Acceptance (Functional) tests - env: - - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc64-softmmu,m68k-softmmu" + - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu" - TEST_CMD="make check-acceptance" after_failure: - cat tests/results/latest/job.log
Signature · 1 line
2.21.0
PATCH 22/26 tests/boot_linux_console: Boot Linux and run few commands on raspi3
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add a test which boots Linux and run basic commands using the serial port console.
The kernel image is built by the Debian project:
https://wiki.debian.org/RaspberryPi
The DeviceTree blob comes from the official Raspberry Pi project:
https://www.raspberrypi.org/
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
This test can be run using:
$ avocado run --show=console,app run -t machine:raspi3 tests/acceptance console: [ 0.000000] Linux version 4.14.0-3-arm64 ([email protected]) (gcc version 7.2.0 (Debian 7.2.0-18)) #1 SMP Debian 4.14.12-2 (2018-01-06) console: [ 0.000000] Boot CPU: AArch64 Processor [410fd034] console: [ 0.000000] Machine model: Raspberry Pi 3 Model B console: [ 0.000000] earlycon: pl11 at MMIO 0x000000003f201000 (options '') console: [ 0.000000] bootconsole [pl11] enabled [...] console: Starting network: OK console: Found console ttyAMA0 console: Boot successful. console: / # cat /proc/cpuinfo console: processor : 0 console: BogoMIPS : 125.00 console: r : 0x41 console: CPU architecture: 8 console: CPU variant console: : 0x0 console: CPU part : 0xd03 console: CPU revision : 4 console: / # uname -a console: Linux buildroot 4.14.0-3-arm64 #1 SMP Debian 4.14.12-2 (2018-01-06) aarch64 GNU/Linux console: reboot console: / # reboot console: / # Found console ttyAMA0 console: Stopping network: OK console: Saving random seed... done. console: Stopping logging: OK console: umount: devtmpfs busy - remounted read-only console: umount: can't unmount /: Invalid argument console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: kvm: exiting hardware virtualization console: reboot: Restarting system PASS (11.08 s)
---
v2: Use archive.gzip_uncompress (Cleber)
some chars are scrambled on the console? Cleber ran this 100 times and doesn't have issue.
--- tests/acceptance/boot_linux_console.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
tests/acceptance/boot_linux_console.py +48 -0
@@ -338,6 +338,54 @@ class BootLinuxConsole(MachineTest): """ self.do_test_arm_raspi2(1) + def test_arm_raspi3_initrd_uart0(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi3 + """ + deb_url = ('https://snapshot.debian.org/archive/debian/' + '20180106T174014Z/pool/main/l/linux/' + 'linux-image-4.14.0-3-arm64_4.14.12-2_arm64.deb') + deb_hash = 'e71c995de57921921895c1162baea5df527d1c6b' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.14.0-3-arm64') + + dtb_url = ('https://github.com/raspberrypi/firmware/raw/' + '1.20180313/boot/bcm2710-rpi-3-b.dtb') + dtb_hash = 'eb14d67133401ef2f93523be7341456d38bfc077' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '9b6b392ea7bc15f0d6632328d429d31c9c6273da/rootfs/' + 'arm64/rootfs.cpio.gz') + initrd_hash = '6fd05324f17bb950196b5ad9d3a0fa996339f4cd' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = self.workdir + "rootfs.cpio" + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_machine('raspi3') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,0x3f201000 console=ttyAMA0 ' + + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.', + failure_message='-----[ cut here ]-----') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'BogoMIPS') + exec_command_and_wait_for_pattern(self, 'uname -a', + 'Debian') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 13/26 tests/acceptance: Add test that runs NetBSD 4.0 installer on PRep/40p
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
As of this commit, NetBSD 4.0 is very old. However it is enough to test the PRep/40p machine.
User case from:
http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html
---
Installers after 4.0 doesn't work anymore, not sure if this is a problem from the QEMU model or from NetBSD.
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- check getenv(AVOCADO_ALLOW_UNTRUSTED_CODE) (pm215)
--- MAINTAINERS | 1 + tests/acceptance/ppc_prep_40p.py | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/acceptance/ppc_prep_40p.py
MAINTAINERS +1 -0
@@ -1068,6 +1068,7 @@ F: hw/rtc/m48t59-isa.c F: include/hw/isa/pc87312.h F: include/hw/rtc/m48t59.h F: pc-bios/ppc_rom.bin +F: tests/acceptance/machine_ppc_prep_40p.py sPAPR M: David Gibson <[email protected]>
tests/acceptance/ppc_prep_40p.py new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 4/26 tests/acceptance: Send <carriage return> on serial lines
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Some firmwares don't parse the <Newline> control character and expect a <carriage return>.
---
since previous: do not send NewLine
--- tests/acceptance/boot_linux_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/acceptance/boot_linux_console.py +1 -1
@@ -34,7 +34,7 @@ class BootLinuxConsole(Test): failure_message='Kernel panic - not syncing') def exec_command_and_wait_for_pattern(self, command, success_message): - command += '\n' + command += '\r' self.vm.console_socket.sendall(command.encode()) wait_for_console_pattern(self, success_message)
Signature · 1 line
2.21.0
PATCH 24/26 tests/boot_linux_console: Add initrd test for the Exynos4210
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a smdkc210 board and verify the serial output is working.
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
This test can be run using:
$ IGNORE_AVOCADO_CONSOLE_BUG=yes \
avocado --show=app,console run -t machine:smdkc210 \
tests/acceptance/boot_linux_console.py
console: Booting Linux on physical CPU 0x900
console: Linux version 4.19.0-6-armmp ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
console: CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
console: OF: fdt: Machine model: Samsung smdkv310 evaluation board based on Exynos4210
[...]
console: Samsung CPU ID: 0x43210211
console: random: get_random_bytes called from start_kernel+0xa0/0x504 with crng_init=0
console: percpu: Embedded 17 pages/cpu s39756 r8192 d21684 u69632
console: Built 1 zonelists, mobility grouping on. Total pages: 249152
console: Kernel command line: printk.time=0 console=ttySAC0,115200n8 earlyprintk random.trust_cpu=off cryptomgr.notests cpuidle.off=1 panic=-1 noreboot
[...]
console: L2C: platform modifies aux control register: 0x02020000 -> 0x3e420001
console: L2C: platform provided aux values permit register corruption.
console: L2C: DT/platform modifies aux control register: 0x02020000 -> 0x3e420001
console: L2C-310 erratum 769419 enabled
console: L2C-310 enabling early BRESP for Cortex-A9
console: L2C-310: enabling full line of zeros but not enabled in Cortex-A9
console: L2C-310 ID prefetch enabled, offset 1 lines
console: L2C-310 dynamic clock gating disabled, standby mode disabled
console: L2C-310 cache controller enabled, 8 ways, 128 kB
console: L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x7e420001
console: Exynos4210 clocks: sclk_apll = 12000000, sclk_mpll = 12000000
console: sclk_epll = 12000000, sclk_vpll = 12000000, arm_clk = 12000000
[...]
console: s3c-i2c 13860000.i2c: slave address 0x00
console: s3c-i2c 13860000.i2c: bus frequency set to 93 KHz
console: s3c-i2c 13860000.i2c: i2c-0: S3C I2C adapter
[...]
console: dma-pl330 12680000.pdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12680000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
console: dma-pl330 12690000.pdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12690000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
console: dma-pl330 12850000.mdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12850000.mdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-1 Num_Events-16
console: dma-pl330 12850000.mdma: PM domain LCD0 will not be powered off
console: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console: Serial: AMBA driver
console: 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 40, base_baud = 0) is a S3C6400/10
console: console [ttySAC0] enabled
console: 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 41, base_baud = 0) is a S3C6400/10
console: 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 42, base_baud = 0) is a S3C6400/10
console: 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 43, base_baud = 0) is a S3C6400/10
[...]
console: Freeing unused kernel memory: 2048K
console: Run /init as init process
console: mount: mounting devtmpfs on /dev failed: Device or resource busy
console: Starting logging: OK
console: Initializing random number generator... random: dd: uninitialized urandom read (512 bytes read)
console: done.
console: Starting network: OK
console: Found console ttySAC0
console: Linux version 4.19.0-6-armmp ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
console: Boot successful.
PASS (37.98 s)---
v2: use archive.gzip_uncompress (Cleber)
serial input is not working :(
I sometime get (not always):
Starting network: OK
[ 70.403690] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: [ 70.423212] rcu: 0-...!: (36 GPs behind) idle=c7a/1/0x40000000 softirq=287/288 fqs=1 [ 70.428209] rcu: (detected by 1, t=2602 jiffies, g=-443, q=2209) [ 70.432826] Sending NMI from CPU 1 to CPUs 0: [ 70.473866] NMI backtrace for cpu 0 [ 70.476621] CPU: 0 PID: 112 Comm: cat Not tainted 4.19.0 #1 [ 70.476711] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 70.476916] PC is at mntput_no_expire+0x88/0x464 [ 70.476996] LR is at rcu_is_watching+0x24/0x78 [ 70.477074] pc : [<c02b256c>] lr : [<c01a2fb4>] psr: a0000013 [ 70.477150] sp : ee2afdb0 ip : 9dff9a2f fp : ee2aff70 [ 70.477225] r10: 00000142 r9 : ee219dc0 r8 : ee2afec0 [ 70.477302] r7 : ee2afec0 r6 : c0298d6c r5 : ef02c400 r4 : ef018200 [ 70.477385] r3 : c0f99274 r2 : 00000031 r1 : 2e87c000 r0 : a0000013 [ 70.477461] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 70.477537] Control: 10c5387d Table: 6e30806a DAC: 00000051 [ 70.477613] CPU: 0 PID: 112 Comm: cat Not tainted 4.19.0 #1 [ 70.477688] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 70.477765] [<c01128f4>] (unwind_backtrace) from [<c010e5b4>] (show_stack+0x10/0x14) [ 70.477847] [<c010e5b4>] (show_stack) from [<c0a36160>] (dump_stack+0x98/0xc4) [ 70.477925] [<c0a36160>] (dump_stack) from [<c0a3cc90>] (nmi_cpu_backtrace+0x6c/0xb4) [ 70.478000] [<c0a3cc90>] (nmi_cpu_backtrace) from [<c0111530>] (handle_IPI+0x108/0x420) [ 70.478076] [<c0111530>] (handle_IPI) from [<c04950a8>] (gic_handle_irq+0x98/0x9c) [ 70.478151] [<c04950a8>] (gic_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0xb0) [ 70.478226] Exception stack(0xee2afd60 to 0xee2afda8) [ 70.478303] fd60: a0000013 2e87c000 00000031 c0f99274 ef018200 ef02c400 c0298d6c ee2afec0 [ 70.478378] fd80: ee2afec0 ee219dc0 00000142 ee2aff70 9dff9a2f ee2afdb0 c01a2fb4 c02b256c [ 70.478453] fda0: a0000013 ffffffff [ 70.478529] [<c01019f0>] (__irq_svc) from [<c02b256c>] (mntput_no_expire+0x88/0x464) [ 70.478605] [<c02b256c>] (mntput_no_expire) from [<c0298d6c>] (terminate_walk+0x154/0x160) [ 70.478681] [<c0298d6c>] (terminate_walk) from [<c029ce3c>] (path_openat+0x324/0xfe4) [ 70.478759] [<c029ce3c>] (path_openat) from [<c029ea9c>] (do_filp_open+0x70/0xdc) [ 70.478835] [<c029ea9c>] (do_filp_open) from [<c028b36c>] (do_sys_open+0x134/0x1e4) [ 70.478911] [<c028b36c>] (do_sys_open) from [<c0101000>] (ret_fast_syscall+0x0/0x28) [ 70.478989] Exception stack(0xee2affa8 to 0xee2afff0) [ 70.479064] ffa0: b6fc7d6c 0000000a ffffff9c bebbf268 000a0000 00000000 [ 70.479139] ffc0: b6fc7d6c 0000000a 00000050 00000142 bebbf268 b6fc6970 b6fc6b28 bebbf254 [ 70.479214] ffe0: b6fc6970 bebbf1e0 b6f9dd94 b6fb0c0c [ 70.484892] rcu: rcu_preempt kthread starved for 2600 jiffies! g-443 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=0 [ 70.514943] rcu: RCU grace-period kthread stack dump: [ 70.516687] rcu_preempt I 0 10 2 0x00000000 [ 70.523711] [<c0a4caac>] (__schedule) from [<c0a4d28c>] (schedule+0x4c/0xac) [ 70.525103] [<c0a4d28c>] (schedule) from [<c0a52c34>] (schedule_timeout+0x230/0x564) [ 70.526472] [<c0a52c34>] (schedule_timeout) from [<c01a7818>] (rcu_gp_kthread+0x6e4/0xbf0) [ 70.527784] [<c01a7818>] (rcu_gp_kthread) from [<c014d7f0>] (kthread+0x138/0x168) [ 70.528989] [<c014d7f0>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20) [ 70.530387] Exception stack(0xef111fb0 to 0xef111ff8) [ 70.532556] 1fa0: 00000000 00000000 00000000 00000000 [ 70.534904] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 70.536920] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Found console ttySAC0
Linux version 4.19.0 (root@591d0a36fd03) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #1 SMP PREEMPT Fri Oct 4 19:53:43 UTC 2019 Boot successful.
/ #
Also:
[ 73.000405] [<c01128f4>] (unwind_backtrace) from [<c010e5b4>] (show_stack+0x10/0x14) [ 73.000537] [<c010e5b4>] (show_stack) from [<c0a36160>] (dump_stack+0x98/0xc4) [ 73.000631] [<c0a36160>] (dump_stack) from [<c0a3cc90>] (nmi_cpu_backtrace+0x6c/0xb4) [ 73.000701] [<c0a3cc90>] (nmi_cpu_backtrace) from [<c0111530>] (handle_IPI+0x108/0x420) [ 73.000823] [<c0111530>] (handle_IPI) from [<c04950a8>] (gic_handle_irq+0x98/0x9c) [ 73.000924] [<c04950a8>] (gic_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0xb0) [ 73.000990] Exception stack(0xef123f80 to 0xef123fc8) [ 73.001064] 3f80: 00000001 00000001 00000000 ef11b300 ef122000 c1007470 c10074b4 00000002 [ 73.001131] 3fa0: 4000406a 410fc090 00000000 00000000 00000000 ef123fd0 c018759c c010a4c8 [ 73.001196] 3fc0: 20000013 ffffffff [ 73.001262] [<c01019f0>] (__irq_svc) from [<c010a4c8>] (arch_cpu_idle+0x24/0x3c) [ 73.001328] [<c010a4c8>] (arch_cpu_idle) from [<c015f1f0>] (do_idle+0xcc/0x168) [ 73.001394] [<c015f1f0>] (do_idle) from [<c015f60c>] (cpu_startup_entry+0x18/0x1c) [ 73.001462] [<c015f60c>] (cpu_startup_entry) from [<4010276c>] (0x4010276c)
Based-on: [email protected] "tests/boot_linux_console: Extract the gunzip() helper"
--- tests/acceptance/boot_linux_console.py | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
tests/acceptance/boot_linux_console.py +42 -0
@@ -432,6 +432,48 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + @skipUnless(os.getenv('IGNORE_AVOCADO_CONSOLE_BUG'), 'Console buggy') + def test_arm_exynos4210_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:smdkc210 + """ + deb_url = ('https://snapshot.debian.org/archive/debian/' + '20190928T224601Z/pool/main/l/linux/' + 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb') + deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.19.0-6-armmp') + dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv5.cpio.gz') + initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_machine('smdkc210') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=exynos4210,0x13800000 earlyprintk ' + + 'console=ttySAC0,115200n8 ' + + 'random.trust_cpu=off cryptomgr.notests ' + + 'cpuidle.off=1 panic=-1 noreboot') + + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.') + # TODO user command, for now the uart is stuck + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 26/26 tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
This tests boots a Linux kernel on a Malta machine up to a busybox shell on the serial console. Few commands are executed before halting the machine (via reboot).
We use the Fedora 24 kernel extracted from the image at:
https://fedoraproject.org/wiki/Architectures/MIPS
and the initrd cpio image from the kerneltests project:
https://kerneltests.org/
If MIPS is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:mips" tags.
Alternatively, this test can be run using:
$ AVOCADO_ALLOW_UNTRUSTED_CODE=yes \
avocado --show=console run -t arch:mips64el \
tests/acceptance/boot_linux_console.py
console: [ 0.000000] Linux version 3.19.3.mtoman.20150408 (mtoman@debian-co3-1) (gcc version 5.0.0 20150316 (Red Hat 5.0.0-0.20) (GCC) ) #3 Wed Apr 8 14:32:50 UTC 2015
console: [ 0.000000] Early serial console at I/O port 0x3f8 (options '38400n8')
console: [ 0.000000] bootconsole [uart0] enabled
console: [ 0.000000] CPU0 revision is: 00018900 (MIPS 5KE)
console: [ 0.000000] Checking for the multiply/shift bug... no.
console: [ 0.000000] Checking for the daddiu bug... no.
[...]
console: Boot successful.
console: cat /proc/cpuinfo
console: / # cat /proc/cpuinfo
console: system type : MIPS Malta
console: machine : Unknown
console: processor : 0
console: cpu model : MIPS 5KE V0.0
console: : 1616.89
console: wait instruction : nouname -a
console: microsecond timers : yes
console: tlb_entries : 32
console: extra interrupt vector : yes
console: hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8]
console: isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
console: ASEs implemented :
console: shadow register sets : 1
console: kscratch registers : 0
console: package : 0
console: core : 0
console: VCED exceptions : not available
console: VCEI exceptions : not available
console: / #
console: / # uname -a
console: Linux buildroot 3.19.3.mtoman.20150408 #3 Wed Apr 8 14:32:50 UTC 2015 mips64 GNU/Linux
console: reboot
console: / #
console: / # reboot
console: / #
console: / # reboot: Restarting system
PASS (7.04 s)
JOB TIME : 7.20 s--- tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
tests/acceptance/boot_linux_console.py +41 -0
@@ -168,6 +168,47 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_mips64el_malta_5KEc_cpio(self): + """ + :avocado: tags=arch:mips64el + :avocado: tags=machine:malta + :avocado: tags=endian:little + """ + kernel_url = ('https://github.com/philmd/qemu-testing-blob/' + 'raw/9ad2df38/mips/malta/mips64el/' + 'vmlinux-3.19.3.mtoman.20150408') + kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + initrd_url = ('https://github.com/groeck/linux-build-test/' + 'raw/8584a59e/rootfs/' + 'mipsel64/rootfs.mipsel64r1.cpio.gz') + initrd_hash = '1dbb8a396e916847325284dbe2151167' + initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5', + asset_hash=initrd_hash) + initrd_path = self.workdir + "rootfs.cpio" + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_machine('malta') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 console=tty ' + + 'rdinit=/sbin/init noreboot') + self.vm.add_args('-cpu', '5KEc', + '-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + wait_for_console_pattern(self, 'Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'MIPS 5KE') + exec_command_and_wait_for_pattern(self, 'uname -a', + '3.19.3.mtoman.20150408') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash): kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) kernel_path = self.workdir + "kernel"
Signature · 1 line
2.21.0
PATCH 6/26 tests/acceptance: Rename avocado_qemu.Test as MachineTest
In reply to Philippe Mathieu-DaudéThis class is used to test QEMU machines, rename it as MachineTest. This will allow us to add a UserTest class for qemu-user tests.
--- docs/devel/testing.rst | 8 ++++---- tests/acceptance/avocado_qemu/__init__.py | 7 ++++++- tests/acceptance/boot_linux_console.py | 4 ++-- tests/acceptance/cpu_queries.py | 4 ++-- tests/acceptance/empty_cpu_model.py | 4 ++-- tests/acceptance/linux_initrd.py | 4 ++-- tests/acceptance/linux_ssh_mips_malta.py | 4 ++-- tests/acceptance/migration.py | 4 ++-- tests/acceptance/version.py | 4 ++-- tests/acceptance/virtio_version.py | 4 ++-- tests/acceptance/vnc.py | 4 ++-- 11 files changed, 28 insertions(+), 23 deletions(-)
docs/devel/testing.rst +4 -4
@@ -601,7 +601,7 @@ class. Here's a simple usage example: from avocado_qemu import Test - class Version(Test): + class Version(MachineTest): """ :avocado: tags=quick """
@@ -625,7 +625,7 @@ in the current directory, tagged as "quick", run: avocado run -t quick . -The ``avocado_qemu.Test`` base test class +The ``avocado_qemu.MachineTest`` base test class ----------------------------------------- The ``avocado_qemu.Test`` class has a number of characteristics that
@@ -646,10 +646,10 @@ and hypothetical example follows: .. code:: - from avocado_qemu import Test + from avocado_qemu import MachineTest - class MultipleMachines(Test): + class MultipleMachines(MachineTest): """ :avocado: enable """
tests/acceptance/avocado_qemu/__init__.py +6 -1
@@ -100,7 +100,6 @@ def exec_command_and_wait_for_pattern(test, command, class Test(avocado.Test): def setUp(self): - self._vms = {} arches = self.tags.get('arch', []) if len(arches) == 1: arch = arches.pop()
@@ -113,6 +112,12 @@ class Test(avocado.Test): if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") + +class MachineTest(Test): + def setUp(self): + self._vms = {} + super().setUp() + def _new_vm(self, *args): vm = QEMUMachine(self.qemu_bin) if args:
tests/acceptance/boot_linux_console.py +2 -2
@@ -13,14 +13,14 @@ import lzma import gzip import shutil -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive -class BootLinuxConsole(Test): +class BootLinuxConsole(MachineTest): """ Boots a Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kernel
tests/acceptance/cpu_queries.py +2 -2
@@ -10,9 +10,9 @@ import logging -from avocado_qemu import Test +from avocado_qemu import MachineTest -class QueryCPUModelExpansion(Test): +class QueryCPUModelExpansion(MachineTest): """ Run query-cpu-model-expansion for each CPU model, and validate results """
tests/acceptance/empty_cpu_model.py +2 -2
@@ -8,9 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. import subprocess -from avocado_qemu import Test +from avocado_qemu import MachineTest -class EmptyCPUModel(Test): +class EmptyCPUModel(MachineTest): def test(self): cmd = [self.qemu_bin, '-S', '-display', 'none', '-machine', 'none', '-cpu', ''] r = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
tests/acceptance/linux_initrd.py +2 -2
@@ -12,10 +12,10 @@ import logging import tempfile from avocado.utils.process import run -from avocado_qemu import Test +from avocado_qemu import MachineTest -class LinuxInitrd(Test): +class LinuxInitrd(MachineTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option.
tests/acceptance/linux_ssh_mips_malta.py +2 -2
@@ -12,14 +12,14 @@ import logging import time from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive from avocado.utils import ssh -class LinuxSSH(Test): +class LinuxSSH(MachineTest): timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg'
tests/acceptance/migration.py +2 -2
@@ -10,13 +10,13 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado.utils import network from avocado.utils import wait -class Migration(Test): +class Migration(MachineTest): timeout = 10
tests/acceptance/version.py +2 -2
@@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest -class Version(Test): +class Version(MachineTest): """ :avocado: tags=quick """
tests/acceptance/virtio_version.py +2 -2
@@ -13,7 +13,7 @@ import os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import MachineTest # Virtio Device IDs: VIRTIO_NET = 1
@@ -55,7 +55,7 @@ def get_pci_interfaces(vm, devtype): interfaces = ('pci-express-device', 'conventional-pci-device') return [i for i in interfaces if devtype_implements(vm, devtype, i)] -class VirtioVersionCheck(Test): +class VirtioVersionCheck(MachineTest): """ Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and
tests/acceptance/vnc.py +2 -2
@@ -8,10 +8,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest -class Vnc(Test): +class Vnc(MachineTest): """ :avocado: tags=vnc,quick """
Signature · 1 line
2.21.0
PATCH 18/26 tests/boot_console: Test booting HP-UX firmware upgrade
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add a test which boots a HP-UX firmware upgrade CD-ROM. It exercise the PCI LSI53C895A SCSI controller.
The ISO image comes from:
https://web.archive.org/web/20101204061612/http://ftp.parisc-linux.org/kernels/712/PF_C7120023
This test is very quick, less than 3s:
$ AVOCADO_ALLOW_UNTRUSTED_CODE=yes \
avocado --show=app,console run -t arch:hppa \
tests/acceptance/boot_linux_console.py
console: Firmware Version 6.1
console: Duplex Console IO Dependent Code (IODC) revision 1
console: Memory Test/Initialization Completed
console: ------------------------------------------------------------------------------
console: (c) Copyright 2017-2018 Helge Deller <[email protected]> and SeaBIOS developers.
console: ------------------------------------------------------------------------------
console: Processor Speed State Coprocessor State Cache Size
console: --------- -------- --------------------- ----------------- ----------
console: 0 250 MHz Active Functional 0 KB
console: Available memory: 512 MB
console: Good memory required: 16 MB
console: Primary boot path: FWSCSI.0.0
console: Alternate boot path: FWSCSI.2.0
console: Console path: SERIAL_1.9600.8.none
console: Keyboard path: PS2
console: Available boot devices:
console: 1. DVD/CD [lsi 00:00.0 2:0 Drive QEMU QEMU CD-ROM 2.5+]
console: Booting from DVD/CD [lsi 00:00.0 2:0 Drive QEMU QEMU CD-ROM 2.5+]
console: Booting...
console: Boot IO Dependent Code (IODC) revision 153
console: HARD Booted.
console: ISL Revision A.00.25 November 18, 1992
console: ISL booting ODE UPDATE ; stable off ; RUN
console: Loading...
console: ***************************************************************************
console: ****** ******
console: ****** Offline Diagnostic Environment ******
console: ****** ******
console: ****** (C) Copyright Hewlett-Packard Co 1993 ******
console: ****** All Rights Reserved ******
console: ****** ******
console: ****** HP shall not be liable for any damages resulting from the ******
console: ****** use of this program. ******
console: ****** ******
console: ****** TC Version A.00.15 ******
console: ****** SysLib Version A.00.44 ******
console: ****** ******
console: ***************************************************************************
console: Type HELP for command information.
console: ISL_CMD> UPDATE ; stable off ; RUN
console: ***************************************************************************
console: ****** ******
console: ****** PDC UPDATER ******
console: ****** ******
console: ****** Copyright (C) 1993, 1994, 1995 by Hewlett-Packard Company ******
console: ****** Version A.00.19 ******
console: ****** ******
console: ***************************************************************************
console: Type HELP for command information.
console: Stable Storage will NOT be updated
console: STARTING EXECUTION OF UPDATE
console: Unrecognized MODEL TYPE = 502
console: ERROR 0001
console: UPDATE PAUSED> exit
console: UPDATE>
console: UPDATE> ls
console: Modules on this boot media are:
console: filename type size created description
console: -----------------------------------------------------------------------------
console: DAGGER DATA 118 96/02/15 ?
console: IMAGE1A DATA 512 96/02/15 ?
console: IMAGE1B DATA 388 96/02/15 ?
console: UPDATE> exit
console: THIS UTILITY WILL NOW RESET THE SYSTEM.....
PASS (2.39 s)
JOB TIME : 2.54 s---
v2:
- check getenv(AVOCADO_ALLOW_UNTRUSTED_CODE) (pm215)
I know this is not a 'Linux' test, but all our console functions reside in this file and I don't want to duplicate again. Maybe we could rename this file as 'boot_console_tests.py' or extract the console related functions.
--- tests/acceptance/boot_linux_console.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
tests/acceptance/boot_linux_console.py +27 -0
@@ -13,6 +13,7 @@ import lzma import gzip import shutil +from avocado import skipUnless from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern
@@ -357,3 +358,29 @@ class BootLinuxConsole(MachineTest): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_hppa_fwupdate(self): + """ + :avocado: tags=arch:hppa + :avocado: tags=device:lsi53c895a + """ + cdrom_url = ('https://github.com/philmd/qemu-testing-blob/raw/ec1b741/' + 'hppa/hp9000/712/C7120023.frm') + cdrom_hash = '17944dee46f768791953009bcda551be5ab9fac9' + cdrom_path = self.fetch_asset(cdrom_url, asset_hash=cdrom_hash) + + self.vm.set_console() + self.vm.add_args('-cdrom', cdrom_path, + '-boot', 'd', + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Unrecognized MODEL TYPE = 502') + + exec_command_and_wait_for_pattern(self, 'exit', + 'UPDATE>') + exec_command_and_wait_for_pattern(self, 'ls', + 'IMAGE1B') + exec_command_and_wait_for_pattern(self, 'exit', + 'THIS UTILITY WILL NOW ' + 'RESET THE SYSTEM.....')
Signature · 1 line
2.21.0
PATCH 9/26 tests/acceptance: Add bFLT loader linux-user test
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add a very quick test that runs a busybox binary in bFLT format:
$ avocado --show=app run tests/acceptance/load_bflt.py JOB ID : db94d5960ce564c50904d666a7e259148c27e88f JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 0.54 s
---
This test currently fails on Aarch64 host, see LP#1833668
https://bugs.launchpad.net/qemu/+bug/1833668
--- tests/acceptance/load_bflt.py | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/acceptance/load_bflt.py
tests/acceptance/load_bflt.py new file +52 -0
@@ -0,0 +1,52 @@ +# Test the bFLT format +# +# Copyright (C) 2019 Philippe Mathieu-Daudé <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import bz2 +import subprocess + +from avocado_qemu import LinuxUserTest + + +class LoadBFLT(LinuxUserTest): + + def extract_cpio(self, cpio_path): + """ + Extracts a cpio archive into the test workdir + + :param cpio_path: path to the cpio archive + """ + cwd = os.getcwd() + os.chdir(self.workdir) + with bz2.open(cpio_path, 'rb') as archive_cpio: + subprocess.run(['cpio', '-i'], input=archive_cpio.read(), + stderr=subprocess.DEVNULL) + os.chdir(cwd) + + def test_stm32(self): + """ + :avocado: tags=arch:arm + :avocado: tags=linux_user + :avocado: tags=quick + """ + # See https://elinux.org/STM32#User_Space + rootfs_url = ('https://elinux.org/images/5/51/' + 'Stm32_mini_rootfs.cpio.bz2') + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6' + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + busybox_path = self.workdir + "/bin/busybox" + + self.extract_cpio(rootfs_path_bz2) + + cmd = '' + res = self.run("%s %s" % (busybox_path, cmd)) + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.' + self.assertIn(ver, res.stdout_text) + + cmd = 'uname -a' + res = self.run("%s %s" % (busybox_path, cmd)) + unm = 'armv7l GNU/Linux' + self.assertIn(unm, res.stdout_text)
Signature · 1 line
2.21.0
PATCH 23/26 tests/boot_linux_console: Test SDHCI and termal sensor on raspi3
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add a test which loads the root filesystem on a SD card. Use a kernel recent enough to also test the thermal sensor.
The kernel image comes from:
https://github.com/sakaki-/bcmrpi3-kernel#description
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
---
v2: Use archive.gzip_uncompress (Cleber)
--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tests/acceptance/boot_linux_console.py +46 -0
@@ -386,6 +386,52 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + def test_arm_raspi3_initrd_sd_temp(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi3 + """ + tarball_url = ('https://github.com/sakaki-/bcmrpi3-kernel/releases/' + 'download/4.19.71.20190910/' + 'bcmrpi3-kernel-4.19.71.20190910.tar.xz') + tarball_hash = '844f117a1a6de0532ba92d2a7bceb5b2acfbb298' + tarball_path = self.fetch_asset(tarball_url, asset_hash=tarball_hash) + archive.extract(tarball_path, self.workdir) + dtb_path = self.workdir + "/boot/bcm2837-rpi-3-b.dtb" + kernel_path = self.workdir + "/boot/kernel8.img" + + rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' + '9b6b392ea7bc15f0d6632328d429d31c9c6273da/rootfs/' + 'arm64/rootfs.ext2.gz') + rootfs_hash = 'dbe4136f0b4a0d2180b93fd2a3b9a784f9951d10' + rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = self.workdir + "rootfs.ext2" + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + + self.vm.set_machine('raspi3') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,0x3f201000 console=ttyAMA0 ' + + 'root=/dev/mmcblk0 rootwait rw ' + + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line, + '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.', + failure_message='-----[ cut here ]-----') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Raspberry Pi 3 Model B') + exec_command_and_wait_for_pattern(self, ('cat /sys/devices/virtual/' + 'thermal/thermal_zone0/temp'), + '25178') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 15/26 tests/acceptance: Test OpenBIOS on the PReP/40p
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.html
---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- use MD5 hash
--- tests/acceptance/ppc_prep_40p.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
tests/acceptance/ppc_prep_40p.py +32 -0
@@ -69,3 +69,35 @@ class IbmPrep40pMachine(MachineTest): wait_for_console_pattern(self, fw_banner) prompt_msg = 'Type any key to interrupt automatic startup' wait_for_console_pattern(self, prompt_msg) + + def test_openbios_192m(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-m', '192') # test fw_cfg + + self.vm.launch() + wait_for_console_pattern(self, '>> OpenBIOS') + wait_for_console_pattern(self, '>> Memory: 192M') + wait_for_console_pattern(self, '>> CPU type PowerPC,604') + + def test_openbios_and_netbsd(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + drive_url = ('https://ftp.netbsd.org/pub/NetBSD/iso/7.1.2/' + 'NetBSD-7.1.2-prep.iso') + drive_hash = 'ac6fa2707d888b36d6fa64de6e7fe48e' + drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash, + algorithm='md5') + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-cdrom', drive_path, + '-boot', 'd') + + self.vm.launch() + wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9')
Signature · 1 line
2.21.0
PATCH 16/26 tests/acceptance: Test Sandalfoot initrd on the PReP/40p
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.html
Sandalfoot info:
http://www.juneau-lug.org/sandalfoot.php
---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- use exec_command_and_wait_for_pattern
- check getenv(AVOCADO_ALLOW_UNTRUSTED_CODE) (pm215)
--- tests/acceptance/ppc_prep_40p.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
tests/acceptance/ppc_prep_40p.py +31 -0
@@ -11,6 +11,7 @@ import logging from avocado import skipIf from avocado import skipUnless from avocado_qemu import MachineTest +from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern
@@ -101,3 +102,33 @@ class IbmPrep40pMachine(MachineTest): self.vm.launch() wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_sandalfoot_busybox(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + drive_url = ('http://www.juneau-lug.org/zImage.initrd.sandalfoot') + drive_hash = 'dacacfc4085ea51d34d99ef70e972b849e2c6949' + drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash) + + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-cdrom', drive_path, + '-boot', 'd') + + self.vm.launch() + wait_for_console_pattern(self, 'Now booting the kernel') + + msg = 'Please press Enter to activate this console.' + wait_for_console_pattern(self, msg) + + version = 'BusyBox v0.60.0 (2001.08.19-09:26+0000) Built-in shell (ash)' + exec_command_and_wait_for_pattern(self, '', version) + + uname = 'Linux ppc 2.4.18 #5 Wed May 21 23:50:43 AKDT 2003 ppc unknown' + exec_command_and_wait_for_pattern(self, 'uname -a', uname) + + cpu = 'PReP IBM 6015/7020 (Sandalfoot/Sandalbow)' + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', cpu)
Signature · 1 line
2.21.0
PATCH 19/26 tests/boot_linux_console: Use Avocado archive::gzip_uncompress()
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Avocado 67.0 [*] introduced the avocado.utils.archive module which provides handling of gzip files. Use the gzip_uncompress() method.
---
v2: New patch replacing the gunzip() refactor
--- tests/acceptance/boot_linux_console.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tests/acceptance/boot_linux_console.py +1 -4
@@ -146,10 +146,7 @@ class BootLinuxConsole(MachineTest): initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99' initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) initrd_path = self.workdir + "rootfs.cpio" - - with gzip.open(initrd_path_gz, 'rb') as f_in: - with open(initrd_path, 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) + archive.gzip_uncompress(initrd_path_gz, initrd_path) self.vm.set_machine('malta') self.vm.set_console()
Signature · 1 line
2.21.0
Re: [PATCH 03/26] tests/acceptance: Fixe wait_for_console_pattern() hangs
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
Because of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket as soon as we stop to use it.
Suggested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/avocado_qemu/__init__.py | 1 + 1 file changed, 1 insertion(+)
Fixe -> Fix
You missed my r-b again, given in:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg06376.html
A.
Quoted 20 lines
tests/acceptance/avocado_qemu/__init__.py +0
-0@@ -74,6 +74,7 @@ def wait_for_console_pattern(test, success_message,failure_message=None):
ifsuccess_messagein msg:
break
iffailure_messageandfailure_messagein msg:
+console.close()
fail = 'Failure message found in console: %s' %failure_message
test.fail(fail)--
2.21.0
PATCH 21/26 tests/boot_linux_console: Test the raspi2 UART1 (16550 based)
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
The current do_test_arm_raspi2() case tests the PL011 UART0. Our model also supports the AUX UART (16550 based). We can very simply test the UART1 with Linux, modifying the kernel command line.
Add few lines to expand our previous test and cover the AUX UART.
--- tests/acceptance/boot_linux_console.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tests/acceptance/boot_linux_console.py +10 -1
@@ -301,6 +301,7 @@ class BootLinuxConsole(MachineTest): """ serial_kernel_cmdline = { 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0', + 1: 'earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200' } deb_url = ('http://archive.raspberrypi.org/debian/' 'pool/main/r/raspberrypi-firmware/'
@@ -311,7 +312,7 @@ class BootLinuxConsole(MachineTest): dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') self.vm.set_machine('raspi2') - self.vm.set_console() + self.vm.set_console(console_index=uart_id) kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + serial_kernel_cmdline[uart_id]) self.vm.add_args('-kernel', kernel_path,
@@ -329,6 +330,14 @@ class BootLinuxConsole(MachineTest): """ self.do_test_arm_raspi2(0) + def test_arm_raspi2_uart1(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi2 + :avocado: tags=device:bcm2835_aux + """ + self.do_test_arm_raspi2(1) + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 25/26 tests/boot_linux_console: Add sdcard test for the Exynos4210
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a smdkc210 board and verify the serial output is working.
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
Since this test is not reliable due to clock timing issues, it is disabled with the 'skip' property.
---
v2:
- use archive.gzip_uncompress (Cleber)
- check getenv(AVOCADO_ALLOW_UNTRUSTED_CODE) (pm215)
--- tests/acceptance/boot_linux_console.py | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
tests/acceptance/boot_linux_console.py +47 -0
@@ -13,6 +13,7 @@ import lzma import gzip import shutil +from avocado import skip from avocado import skipUnless from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern
@@ -474,6 +475,52 @@ class BootLinuxConsole(MachineTest): self.wait_for_console_pattern('Boot successful.') # TODO user command, for now the uart is stuck + @skip("unstable clock timings") + def test_arm_exynos4210_sdcard(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:smdkc210 + """ + deb_url = ('https://snapshot.debian.org/archive/debian/' + '20190928T224601Z/pool/main/l/linux/' + 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb') + deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.19.0-6-armmp') + dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) + + rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv5.ext2.gz') + rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93' + rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = os.path.join(self.workdir, 'rootfs.ext2') + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + + self.vm.set_machine('smdkc210') + self.vm.set_console(console_index=1) + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=exynos4210,0x13810000 earlyprintk ' + + 'console=ttySAC1,115200n8 ' + + 'random.trust_cpu=off cryptomgr.notests ' + + 'root=/dev/mmcblk0 rootwait rw ' + + 'cpuidle.off=1 panic=-1 noreboot') + + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line, + # The external MMC is on the 3rd slot + '-drive', 'if=sd,driver=null-co', + '-drive', 'if=sd,driver=null-co', + '-drive', 'if=sd,file=' + rootfs_path + ',format=raw', + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.') + # TODO user command, for now the uart is stuck + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.21.0
PATCH 2/26 Acceptance tests: refactor wait_for_console_pattern
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
From: Cleber Rosa <[email protected]>
The same utility method is already present in two different test files, so let's consolidate it into a single utility function.
Signed-off-by Cleber Rosa <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>[PMD: failure_message is optional]Reviewed-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 7 lines
--- tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++++++++++++ tests/acceptance/boot_linux_console.py | 27 +++++------------------ tests/acceptance/linux_ssh_mips_malta.py | 18 +++------------ 3 files changed, 33 insertions(+), 37 deletions(-)
You missed my r-b, that I gave here:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg06378.html
A.
Quoted 163 lines
tests/acceptance/avocado_qemu/__init__.py +6
-0@@ -8,6 +8,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. +import logging import os import sys import uuid@@ -53,6 +54,30 @@ def pick_default_qemu_bin(arch=None): return qemu_bin_from_src_dir_path +def wait_for_console_pattern(test, success_message, failure_message=None): + """ + Waits for messages to appear on the console, while logging the content + + :param test: an Avocado test containing a VM that will have itsconsole
tests/acceptance/avocado_qemu/__init__.py +16
-0+ read and probed for a success or failure message + :type test: :class:`avocado_qemu.Test` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + console = test.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline().strip() + if not msg: + continue + console_logger.debug(msg) + if success_message in msg: + break + if failure_message and failure_message in msg: + fail = 'Failure message found in console: %s' %
failure_messagetests/acceptance/avocado_qemu/__init__.py +3
-0+ test.fail(fail) + + class Test(avocado.Test): def setUp(self): self._vms = {}tests/acceptance/boot_linux_console.py +1
-3@@ -9,12 +9,12 @@ # later. See the COPYING file in the top-level directory. import os -import logging import lzma import gzip import shutil from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive@@ -29,31 +29,14 @@ class BootLinuxConsole(Test): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' - def wait_for_console_pattern(self, success_message, - failure_message='Kernel panic - notsyncing'):
tests/acceptance/boot_linux_console.py +0
-2- """ - Waits for messages to appear on the console, while logging thecontent
tests/acceptance/boot_linux_console.py +0
-15- - :param success_message: if this message appears, test succeeds - :param failure_message: if this message appears, test fails - """ - console = self.vm.console_socket.makefile() - console_logger = logging.getLogger('console') - while True: - msg = console.readline().strip() - if not msg: - continue - console_logger.debug(msg) - if success_message in msg: - break - if failure_message in msg: - fail = 'Failure message found in console: %s' %
failure_messagetests/acceptance/boot_linux_console.py +3
-1- self.fail(fail) + def wait_for_console_pattern(self, success_message): + wait_for_console_pattern(self, success_message, + failure_message='Kernel panic - notsyncing')
def exec_command_and_wait_for_pattern(self, command,
success_message):command += '\n' self.vm.console_socket.sendall(command.encode())tests/acceptance/boot_linux_console.py +1
-1- self.wait_for_console_pattern(success_message) + wait_for_console_pattern(self, success_message) def extract_from_deb(self, deb, path): """tests/acceptance/linux_ssh_mips_malta.py +1
-11@@ -13,6 +13,7 @@ import time from avocado import skipUnless from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive from avocado.utils import ssh@@ -69,19 +70,6 @@ class LinuxSSH(Test): def setUp(self): super(LinuxSSH, self).setUp() - def wait_for_console_pattern(self, success_message, - failure_message='Oops'): - console = self.vm.console_socket.makefile() - console_logger = logging.getLogger('console') - while True: - msg = console.readline() - console_logger.debug(msg.strip()) - if success_message in msg: - break - if failure_message in msg: - fail = 'Failure message found in console: %s' %
failure_messagetests/acceptance/linux_ssh_mips_malta.py +2
-5- self.fail(fail) - def get_portfwd(self): res = self.vm.command('human-monitor-command', command_line='info usernet')@@ -137,7 +125,7 @@ class LinuxSSH(Test): self.log.info('VM launched, waiting for sshd') console_pattern = 'Starting OpenBSD Secure Shell server: sshd' - self.wait_for_console_pattern(console_pattern) + wait_for_console_pattern(self, console_pattern, 'Oops') self.log.info('sshd ready') self.ssh_connect('root', 'root')@@ -145,7 +133,7 @@ class LinuxSSH(Test): def shutdown_via_ssh(self): self.ssh_command('poweroff') self.ssh_disconnect_vm() - self.wait_for_console_pattern('Power down') + wait_for_console_pattern(self, 'Power down', 'Oops') def ssh_command_output_contains(self, cmd, exp): stdout, _ = self.ssh_command(cmd) --2.21.0
PATCH 26/26 tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
This tests boots a Linux kernel on a Malta machine up to a busybox shell on the serial console. Few commands are executed before halting the machine (via reboot).
A very nice test.
Quoted 125 lines
We use the Fedora 24 kernel extracted from the image at:
https://fedoraproject.org/wiki/Architectures/MIPS
and the initrd cpio image from the kerneltests project:
https://kerneltests.org/If MIPS is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:mips" tags.
Alternatively, this test can be run using:
$ AVOCADO_ALLOW_UNTRUSTED_CODE=yes \ avocado --show=console run -t arch:mips64el \ tests/acceptance/boot_linux_console.py console: [ 0.000000] Linux version 3.19.3.mtoman.20150408 (mtoman@debian-co3-1) (gcc version 5.0.0 20150316 (Red Hat 5.0.0-0.20) (GCC) ) #3 Wed Apr 8 14:32:50 UTC 2015 console: [ 0.000000] Early serial console at I/O port 0x3f8 (options '38400n8') console: [ 0.000000] bootconsole [uart0] enabled console: [ 0.000000] CPU0 revision is: 00018900 (MIPS 5KE) console: [ 0.000000] Checking for the multiply/shift bug... no. console: [ 0.000000] Checking for the daddiu bug... no. [...] console: Boot successful. console: cat /proc/cpuinfo console: / # cat /proc/cpuinfo console: system type : MIPS Malta console: machine : Unknown console: processor : 0 console: cpu model : MIPS 5KE V0.0 console: : 1616.89 console: wait instruction : nouname -a console: microsecond timers : yes console: tlb_entries : 32 console: extra interrupt vector : yes console: hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8] console: isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 console: ASEs implemented : console: shadow register sets : 1 console: kscratch registers : 0 console: package : 0 console: core : 0 console: VCED exceptions : not available console: VCEI exceptions : not available console: / # console: / # uname -a console: Linux buildroot 3.19.3.mtoman.20150408 #3 Wed Apr 8 14:32:50 UTC 2015 mips64 GNU/Linux console: reboot console: / # console: / # reboot console: / # console: / # reboot: Restarting system PASS (7.04 s) JOB TIME : 7.20 sSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)tests/acceptance/boot_linux_console.py +41
-0@@ -168,6 +168,47 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_mips64el_malta_5KEc_cpio(self): + """ + :avocado: tags=arch:mips64el + :avocado: tags=machine:malta + :avocado: tags=endian:little + """ + kernel_url = ('https://github.com/philmd/qemu-testing-blob/' + 'raw/9ad2df38/mips/malta/mips64el/' + 'vmlinux-3.19.3.mtoman.20150408') + kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + initrd_url = ('https://github.com/groeck/linux-build-test/' + 'raw/8584a59e/rootfs/' + 'mipsel64/rootfs.mipsel64r1.cpio.gz') + initrd_hash = '1dbb8a396e916847325284dbe2151167' + initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5', + asset_hash=initrd_hash) + initrd_path = self.workdir + "rootfs.cpio" + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_machine('malta') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 console=tty ' + + 'rdinit=/sbin/init noreboot') + self.vm.add_args('-cpu', '5KEc', + '-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + wait_for_console_pattern(self, 'Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'MIPS 5KE') + exec_command_and_wait_for_pattern(self, 'uname -a', + '3.19.3.mtoman.20150408') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') +def
do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
kernel_path_xz= self.fetch_asset(kernel_url,
asset_hash=kernel_hash)
kernel_path= self.workdir + "kernel"
--
2.21.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===
CC block/dmg.o
CC block/qcow2.o
Warning, treated as error:
/tmp/qemu-test/src/docs/devel/testing.rst:629:Title underline too short.
The ``avocado_qemu.MachineTest`` base test class
---
CC block/snapshot.o CC block/file-win32.o CC block/win32-aio.o
make: *** [Makefile:1001: docs/devel/index.html] Error 2
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "./tests/docker/docker.py", line 662, in <module>
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=593cd395ff074aafb34318dfd0384f18', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-md60jpt3/src/docker-src.2019-10-28-04.16.54.10533:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=593cd395ff074aafb34318dfd0384f18
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-md60jpt3/src'
make: *** [docker-run-test-mingw@fedora] Error 2
real 1m51.219s
user 0m7.414s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===
CC qapi/qapi-types-qom.o
CC qapi/qapi-types-rdma.o
Warning, treated as error:
/tmp/qemu-test/src/docs/devel/testing.rst:629:Title underline too short.
The ``avocado_qemu.MachineTest`` base test class
-----------------------------------------
CC qapi/qapi-types-rocker.o
CC qapi/qapi-types-run-state.o
make: *** [Makefile:1001: docs/devel/index.html] Error 2
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "./tests/docker/docker.py", line 662, in <module>
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=3d206adaa6b645de8a108a2dcc3ab458', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-b7lu53ds/src/docker-src.2019-10-28-05.45.44.5615:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=3d206adaa6b645de8a108a2dcc3ab458
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-b7lu53ds/src'
make: *** [docker-run-test-mingw@fedora] Error 2
real 1m52.008s
user 0m7.962s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Re: [PATCH 01/26] python/qemu/machine: Allow to use other serial consoles than default
In reply to Philippe Mathieu-DaudéQuoted 29 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Currently the QEMU Python module limits the QEMUMachine class to use the first serial console.
Some machines/guest might use another console than the first one as the 'boot console'. For example the Raspberry Pi uses the second (AUX) console.
To be able to use the Nth console as default, we simply need to connect all the N - 1 consoles to the null chardev.
Add an index argument, so we can use a specific serial console as default.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2:
- renamed 'console_index', added docstring (Cleber)
- reworded description (pm215)--- python/qemu/machine.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)python/qemu/machine.py +0
-0
python/qemu/machine.py class QEMUMachine(object): · line 239
Quoted 5 lines
python/qemu/machine.py +2
-0@@ -235,6 +235,8 @@ class QEMUMachine(object): '-display', 'none', '-vga', 'none'] if self._machine is not None: args.extend(['-machine', self._machine]) + for i in range(self._console_index): + args.extend(['-serial', 'null'])
This will get executed even when set_console() is never called, so it will result in an AttributeError because 'self._console_index' does not exist.
It's also a good practice to define all attributes on __init__(), so I'd suggest that as a fix.
- Cleber.
Re: [PATCH 02/26] Acceptance tests: refactor wait_for_console_pattern
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
From: Cleber Rosa <[email protected]>
The same utility method is already present in two different test files, so let's consolidate it into a single utility function.
Signed-off-by Cleber Rosa <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>[PMD: failure_message is optional]Reviewed-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 02/26] Acceptance tests: refactor wait_for_console_pattern
In reply to Aleksandar MarkovicQuoted 22 lines · Aleksandar Markovic
Quoted 11 lines · Philippe Mathieu-Daudé
From: Cleber Rosa <[email protected]>
The same utility method is already present in two different test files, so let's consolidate it into a single utility function.
Signed-off-by Cleber Rosa <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>[PMD: failure_message is optional]Reviewed-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Quoted 7 lines
--- tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++++++++++++ tests/acceptance/boot_linux_console.py | 27 +++++------------------ tests/acceptance/linux_ssh_mips_malta.py | 18 +++------------ 3 files changed, 33 insertions(+), 37 deletions(-)
Quoted 6 lines
You missed my r-b, that I gave here:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg06378.html
A.
Hi Aleksandar,
I've collected your review, it'll be on my PR.
Thanks!
- Cleber.
Re: [PATCH 03/26] tests/acceptance: Fixe wait_for_console_pattern() hangs
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Because of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket as soon as we stop to use it.
Suggested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 04/26] tests/acceptance: Send <carriage return> on serial lines
In reply to Philippe Mathieu-DaudéQuoted 28 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Some firmwares don't parse the <Newline> control character and expect a <carriage return>.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
since previous: do not send NewLine--- tests/acceptance/boot_linux_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/acceptance/boot_linux_console.py +1
-1@@ -34,7 +34,7 @@ class BootLinuxConsole(Test): failure_message='Kernel panic - not syncing') def exec_command_and_wait_for_pattern(self, command, success_message): - command += '\n' + command += '\r' self.vm.console_socket.sendall(command.encode()) wait_for_console_pattern(self, success_message)Signature · 1 line
2.21.0
Given the discussion on <[email protected]>, this LGTM.
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 03/26] tests/acceptance: Fixe wait_for_console_pattern() hangs
In reply to Aleksandar MarkovicQuoted 14 lines · Aleksandar Markovic
Quoted 11 lines · Philippe Mathieu-Daudé
Because of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket as soon as we stop to use it.
Suggested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/avocado_qemu/__init__.py | 1 + 1 file changed, 1 insertion(+)
Quoted 8 lines
Fixe -> Fix
You missed my r-b again, given in:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg06376.html
A.
I've collected your review and I'm queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 05/26] tests/acceptance: Refactor exec_command_and_wait_for_pattern()
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
Refactor the
exec_command_and_wait_for_pattern()utility method so we can reuse it in other files.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: fix self -> test,failure_messageis optional, added doc
v3: reword because after rebasing only 1 file has to be modified--- tests/acceptance/avocado_qemu/__init__.py | 19 +++++++++++++++++++ tests/acceptance/boot_linux_console.py | 18 +++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-)
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 10/26] tests/acceptance: Add test that boots the HelenOS microkernel on Leon3
In reply to Philippe Mathieu-DaudéQuoted 30 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Release notes:
http://www.helenos.org/wiki/Download#HelenOS0.6.0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 1 + tests/acceptance/machine_sparc_leon3.py | 37 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/acceptance/machine_sparc_leon3.pyMAINTAINERS +1
-0@@ -1173,6 +1173,7 @@ S: Maintained F: hw/sparc/leon3.c F: hw/*/grlib* F: include/hw/*/grlib* +F: tests/acceptance/machine_sparc_leon3.py S390 Machines -------------tests/acceptance/machine_sparc_leon3.py new file +0
-0
tests/acceptance/machine_sparc_leon3.py line 10
Quoted 10 lines
tests/acceptance/machine_sparc_leon3.py new file +10
-0@@ -0,0 +1,37 @@ +# Functional test that boots a Leon3 machine and checks its serial console. +# +# Copyright (c) Philippe Mathieu-Daudé <[email protected]> +# +# 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 logging +
Those imports are not needed.
tests/acceptance/machine_sparc_leon3.py line 15
Quoted 5 lines
tests/acceptance/machine_sparc_leon3.py new file +5
-0+from avocado import skipIf +from avocado_qemu import MachineTest + + +class Leon3Machine(MachineTest):
I have some diverging opinions on the test class rename (which I'll address as responses to the respective patches), so I've tested this using the original name and implementation (from avocado_qemu import Test).
Quoted 12 lines
tests/acceptance/machine_sparc_leon3.py new file +12
-0+ + timeout = 60 + + def test_leon3_helenos_uimage(self): + """ + :avocado: tags=arch:sparc + :avocado: tags=machine:leon3 + :avocado: tags=binfmt:uimage + """ + kernel_url = ('http://www.helenos.org/releases/' + 'HelenOS-0.6.0-sparc32-leon3.bin') + kernel_hash = 'a88c9cfdb8430c66650e5290a08765f9bf049a30'
tests/acceptance/machine_sparc_leon3.py line 37
Quoted 10 lines
tests/acceptance/machine_sparc_leon3.py new file +10
-0+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('leon3_generic') + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path) + + self.vm.launch() + + wait_for_console_pattern(self,'Copyright (c) 2001-2014 HelenOS project') + wait_for_console_pattern(self,'Booting the kernel ...')
But this needs an import:
from avocado_qemu import wait_for_console_pattern
Quoted 3 lines
Signature · 1 line
2.21.0
The core of the test is good, and I've tested it with the changes listed above, and it runs reliably.
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 12/26] .travis.yml: Let the avocado job run the Leon3 test
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 11/26] tests/acceptance: Add test that boots Linux up to BusyBox on Leon3
In reply to Philippe Mathieu-DaudéQuoted 43 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Gaisler provides convenient images:
https://www.gaisler.com/index.php/downloads/linuxHOWTO build:
https://www.gaisler.com/index.php/products/operating-systems/linuxSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/machine_sparc_leon3.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+)tests/acceptance/machine_sparc_leon3.py +15
-0@@ -10,6 +10,8 @@ import logging from avocado import skipIf from avocado_qemu import MachineTest +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command_and_wait_for_pattern class Leon3Machine(MachineTest):@@ -35,3 +37,29 @@ class Leon3Machine(MachineTest): wait_for_console_pattern(self,'Copyright (c) 2001-2014 HelenOS project') wait_for_console_pattern(self,'Booting the kernel ...') + + def test_leon3_linux_kernel_4_9_busybox(self): + """ + :avocado: tags=arch:sparc + :avocado: tags=machine:leon3 + """ + kernel_url = ('https://www.gaisler.com/anonftp/linux/linux-4/images/' + 'leon-linux-4.9/leon-linux-4.9-1.0/up/image.ram') + kernel_hash = '289bd1bcca10cda76d0ef2264a8657adc251f5f5' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('leon3_generic') + self.vm.set_console()
tests/acceptance/machine_sparc_leon3.py class Leon3Machine(MachineTest): · line 62
Quoted 10 lines
tests/acceptance/machine_sparc_leon3.py +10
-0+ self.vm.add_args('-kernel', kernel_path) + + self.vm.launch() + + wait_for_console_pattern(self, 'TYPE: Leon3 System-on-a-Chip') + + wait_for_console_pattern(self, 'Welcome to Buildroot') + + wait_for_console_pattern(self, 'buildroot login:') + exec_command_and_wait_for_pattern(self, 'root', '#')
On my testing, I never got passed this point (the prompt after the username is never received/acknowledged).
tests/acceptance/machine_sparc_leon3.py class Leon3Machine(MachineTest): · line 64
Quoted 2 lines
tests/acceptance/machine_sparc_leon3.py +2
-0+ uname = 'Linux buildroot 4.9.54-00018-g62dab2c #2 ' \ + 'Wed Oct 18 09:45:51 CEST 2017 sparc GNU/Linux'
A matter of style, certainly, but I find this better:
uname = ('Linux buildroot 4.9.54-00018-g62dab2c #2 '
'Wed Oct 18 09:45:51 CEST 2017 sparc GNU/Linux')- Cleber.
Quoted 4 lines
tests/acceptance/machine_sparc_leon3.py +1
-0+ exec_command_and_wait_for_pattern(self, 'uname -a', uname)Signature · 1 line
2.21.0
Re: [PATCH 14/26] tests/acceptance: Test Open Firmware on the PReP/40p
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://tyom.blogspot.com/2019/04/aixprep-under-qemu-how-to.htmlAcked-by David Gibson <[email protected]>Acked-by Artyom Tarasenko <[email protected]>Tested-by Cleber Rosa <[email protected]>Reviewed-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines
---
v3: use avocado_qemu.wait_for_console_pattern (Cleber)--- tests/acceptance/ppc_prep_40p.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 13/26] tests/acceptance: Add test that runs NetBSD 4.0 installer on PRep/40p
In reply to Philippe Mathieu-DaudéQuoted 30 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
As of this commit, NetBSD 4.0 is very old. However it is enough to test the PRep/40p machine.
User case from:
http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.htmlReviewed-by Hervé Poussineau <[email protected]>Acked-by David Gibson <[email protected]>Acked-by Artyom Tarasenko <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Installers after 4.0 doesn't work anymore, not sure if this is a problem from the QEMU model or from NetBSD.v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- checkgetenv(AVOCADO_ALLOW_UNTRUSTED_CODE)(pm215)--- MAINTAINERS | 1 + tests/acceptance/ppc_prep_40p.py | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/acceptance/ppc_prep_40p.pyMAINTAINERS +0
-0
MAINTAINERS F: hw/rtc/m48t59-isa.c · line 1071
Quoted 4 lines
MAINTAINERS +1
-0@@ -1068,6 +1068,7 @@ F: hw/rtc/m48t59-isa.c F: include/hw/isa/pc87312.h F: include/hw/rtc/m48t59.h F: pc-bios/ppc_rom.bin +F: tests/acceptance/machine_ppc_prep_40p.py
File name in patch is ppc_prep_40p.py.
Quoted 9 lines
MAINTAINERS +0
-0sPAPR M: David Gibson <[email protected]>tests/acceptance/ppc_prep_40p.py new file +0
-0
tests/acceptance/ppc_prep_40p.py line 10
Quoted 10 lines
tests/acceptance/ppc_prep_40p.py new file +10
-0@@ -0,0 +1,50 @@ +# Functional test that boots a PReP/40p machine and checks its serial console. +# +# Copyright (c) Philippe Mathieu-Daudé <[email protected]> +# +# 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 logging +
logging module is not used here.
Quoted 43 lines
tests/acceptance/ppc_prep_40p.py new file +40
-0+from avocado import skipIf +from avocado import skipUnless +from avocado_qemu import MachineTest +from avocado_qemu import wait_for_console_pattern + + +class IbmPrep40pMachine(MachineTest): + + timeout = 60 + + # 12H0455 PPS Firmware Licensed Materials + # Property of IBM (C) Copyright IBM Corp. 1994. + # All rights reserved. + # U.S. Government Users Restricted Rights - Use, duplication or disclosure + # restricted by GSA ADP Schedule Contract with IBM Corp. + @skipIf(os.getenv('CONTINUOUS_INTEGRATION'), 'Running on Travis-CI') + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_factory_firmware_and_netbsd(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + :avocado: tags=slowness:high + """ + bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/' + '7020-40p/P12H0456.IMG') + bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03' + bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash) + drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/' + 'NetBSD-4.0/prep/installation/floppy/generic_com0.fs') + drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb' + drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash) + + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-bios', bios_path, + '-fda', drive_path) + self.vm.launch() + os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007' + wait_for_console_pattern(self, os_banner) + wait_for_console_pattern(self, 'Model: IBM PPS Model 6015')Signature · 1 line
2.21.0
With the import and name changes above:
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 15/26] tests/acceptance: Test OpenBIOS on the PReP/40p
In reply to Philippe Mathieu-DaudéQuoted 5 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.html
Quoted 7 lines
Acked-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- use MD5 hash
---
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 14/26] tests/acceptance: Test Open Firmware on the PReP/40p
In reply to Cleber RosaQuoted 18 lines · Cleber Rosa
Quoted 10 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://tyom.blogspot.com/2019/04/aixprep-under-qemu-how-to.htmlAcked-by David Gibson <[email protected]>Acked-by Artyom Tarasenko <[email protected]>Tested-by Cleber Rosa <[email protected]>Reviewed-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Quoted 6 lines
---
v3: use avocado_qemu.wait_for_console_pattern (Cleber)--- tests/acceptance/ppc_prep_40p.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
Quoted 4 lines
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Actually, this test is (now?) failing once every 3 times on my system. I'm pulling this one for now.
Sorry about the noise.
- Cleber.
Re: [PATCH 16/26] tests/acceptance: Test Sandalfoot initrd on the PReP/40p
In reply to Philippe Mathieu-DaudéQuoted 43 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.htmlSandalfoot info:
http://www.juneau-lug.org/sandalfoot.phpAcked-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- useexec_command_and_wait_for_pattern
- checkgetenv(AVOCADO_ALLOW_UNTRUSTED_CODE)(pm215)--- tests/acceptance/ppc_prep_40p.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)tests/acceptance/ppc_prep_40p.py +9
-0@@ -11,6 +11,7 @@ import logging from avocado import skipIf from avocado import skipUnless from avocado_qemu import MachineTest +from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern@@ -101,3 +102,33 @@ class IbmPrep40pMachine(MachineTest): self.vm.launch() wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_sandalfoot_busybox(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + drive_url = ('http://www.juneau-lug.org/zImage.initrd.sandalfoot')
tests/acceptance/ppc_prep_40p.py class IbmPrep40pMachine(MachineTest): · line 122
Quoted 10 lines
tests/acceptance/ppc_prep_40p.py +10
-0+ drive_hash = 'dacacfc4085ea51d34d99ef70e972b849e2c6949' + drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash) + + self.vm.set_machine('40p') + self.vm.set_console() + self.vm.add_args('-cdrom', drive_path, + '-boot', 'd') + + self.vm.launch() + wait_for_console_pattern(self, 'Now booting the kernel')
I could never get past this point. Any ideas?
- Cleber.
Quoted 15 lines
tests/acceptance/ppc_prep_40p.py +12
-0+ + msg = 'Please press Enter to activate this console.' + wait_for_console_pattern(self, msg) + + version = 'BusyBox v0.60.0 (2001.08.19-09:26+0000) Built-in shell (ash)' + exec_command_and_wait_for_pattern(self, '', version) + + uname = 'Linux ppc 2.4.18 #5 Wed May 21 23:50:43 AKDT 2003 ppc unknown' + exec_command_and_wait_for_pattern(self, 'uname -a', uname) + + cpu = 'PReP IBM 6015/7020 (Sandalfoot/Sandalbow)' + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', cpu)Signature · 1 line
2.21.0
Re: [PATCH 18/26] tests/boot_console: Test booting HP-UX firmware upgrade
In reply to Philippe Mathieu-DaudéQuoted 121 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Add a test which boots a HP-UX firmware upgrade CD-ROM. It exercise the PCI LSI53C895A SCSI controller.
The ISO image comes from:
https://web.archive.org/web/20101204061612/http://ftp.parisc-linux.org/kernels/712/PF_C7120023This test is very quick, less than 3s:
$ AVOCADO_ALLOW_UNTRUSTED_CODE=yes \ avocado --show=app,console run -t arch:hppa \ tests/acceptance/boot_linux_console.py console: Firmware Version 6.1 console: Duplex Console IO Dependent Code (IODC) revision 1 console: Memory Test/Initialization Completed console: ------------------------------------------------------------------------------ console: (c) Copyright 2017-2018 Helge Deller <[email protected]> and SeaBIOS developers. console: ------------------------------------------------------------------------------ console: Processor Speed State Coprocessor State Cache Size console: --------- -------- --------------------- ----------------- ---------- console: 0 250 MHz Active Functional 0 KB console: Available memory: 512 MB console: Good memory required: 16 MB console: Primary boot path: FWSCSI.0.0 console: Alternate boot path: FWSCSI.2.0 console: Console path: SERIAL_1.9600.8.none console: Keyboard path: PS2 console: Available boot devices: console: 1. DVD/CD [lsi 00:00.0 2:0 Drive QEMU QEMU CD-ROM 2.5+] console: Booting from DVD/CD [lsi 00:00.0 2:0 Drive QEMU QEMU CD-ROM 2.5+] console: Booting... console: Boot IO Dependent Code (IODC) revision 153 console: HARD Booted. console: ISL Revision A.00.25 November 18, 1992 console: ISL booting ODE UPDATE ; stable off ; RUN console: Loading... console: *************************************************************************** console: ****** ****** console: ****** Offline Diagnostic Environment ****** console: ****** ****** console: ****** (C) Copyright Hewlett-Packard Co 1993 ****** console: ****** All Rights Reserved ****** console: ****** ****** console: ****** HP shall not be liable for any damages resulting from the ****** console: ****** use of this program. ****** console: ****** ****** console: ****** TC Version A.00.15 ****** console: ****** SysLib Version A.00.44 ****** console: ****** ****** console: *************************************************************************** console: Type HELP for command information. console: ISL_CMD> UPDATE ; stable off ; RUN console: *************************************************************************** console: ****** ****** console: ****** PDC UPDATER ****** console: ****** ****** console: ****** Copyright (C) 1993, 1994, 1995 by Hewlett-Packard Company ****** console: ****** Version A.00.19 ****** console: ****** ****** console: *************************************************************************** console: Type HELP for command information. console: Stable Storage will NOT be updated console: STARTING EXECUTION OF UPDATE console: Unrecognized MODEL TYPE = 502 console: ERROR 0001 console: UPDATE PAUSED> exit console: UPDATE> console: UPDATE> ls console: Modules on this boot media are: console: filename type size created description console: ----------------------------------------------------------------------------- console: DAGGER DATA 118 96/02/15 ? console: IMAGE1A DATA 512 96/02/15 ? console: IMAGE1B DATA 388 96/02/15 ? console: UPDATE> exit console: THIS UTILITY WILL NOW RESET THE SYSTEM..... PASS (2.39 s) JOB TIME : 2.54 sSuggested-by Sven Schnelle <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2:
- checkgetenv(AVOCADO_ALLOW_UNTRUSTED_CODE)(pm215)I know this is not a 'Linux' test, but all our console functions reside in this file and I don't want to duplicate again. Maybe we could rename this file as '
boot_console_tests.py' or extract the console related functions.--- tests/acceptance/boot_linux_console.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)tests/acceptance/boot_linux_console.py +12
-0@@ -13,6 +13,7 @@ import lzma import gzip import shutil +from avocado import skipUnless from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern@@ -357,3 +358,29 @@ class BootLinuxConsole(MachineTest): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_hppa_fwupdate(self): + """ + :avocado: tags=arch:hppa + :avocado: tags=device:lsi53c895a + """ + cdrom_url = ('https://github.com/philmd/qemu-testing-blob/raw/ec1b741/' + 'hppa/hp9000/712/C7120023.frm') + cdrom_hash = '17944dee46f768791953009bcda551be5ab9fac9' + cdrom_path = self.fetch_asset(cdrom_url, asset_hash=cdrom_hash)
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 381
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ + self.vm.set_console() + self.vm.add_args('-cdrom', cdrom_path, + '-boot', 'd', + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Unrecognized MODEL TYPE = 502') + + exec_command_and_wait_for_pattern(self, 'exit', + 'UPDATE>')
OK, so this also gets stuck (like the previous tests I mentioned that wouldn't get passed a given "prompt" point). Adding a newline to the command (in addition to the carriage return) does the trick, that is:
---
tests/acceptance/avocado_qemu/__init__.py +1 -1
@@ -93,7 +93,7 @@ def exec_command_and_wait_for_pattern(test, command, :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ - command += '\r' + command += '\n\r' test.vm.console_socket.sendall(command.encode()) wait_for_console_pattern(test, success_message, failure_message)
---
I'm guessing that different systems will interpret the end of line differently. Any other ideas?
- Cleber.
Quoted 8 lines
tests/acceptance/boot_linux_console.py +5
-0+ exec_command_and_wait_for_pattern(self, 'ls', + 'IMAGE1B') + exec_command_and_wait_for_pattern(self, 'exit', + 'THIS UTILITY WILL NOW ' + 'RESET THE SYSTEM.....')Signature · 1 line
2.21.0
Re: [PATCH 17/26] .travis.yml: Let the avocado job run the 40p tests
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Acked-by Alex Bennée <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Re: [PATCH 19/26] tests/boot_linux_console: Use Avocado archive::gzip_uncompress()
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Avocado 67.0 [*] introduced the avocado.utils.archive module which provides handling of gzip files. Use the
gzip_uncompress()method.Suggested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 20/26] tests/boot_linux_console: Add a test for the Raspberry Pi 2
In reply to Philippe Mathieu-DaudéQuoted 16 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Similar to the x86_64/pc test, it boots a Linux kernel on a raspi2 board and verify the serial is working.
The kernel image and DeviceTree blob are built by the Raspbian project (based on Debian):
https://www.raspbian.org/RaspbianImages
as recommended by the Raspberry Pi project:
https://www.raspberrypi.org/downloads/raspbian/If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
Quoted 7 lines
$ avocado run -t arch:arm tests/acceptance $ avocado run -t machine:raspi2 tests/acceptanceReviewed-by Alex Bennée <[email protected]>Reviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 22/26] tests/boot_linux_console: Boot Linux and run few commands on raspi3
In reply to Philippe Mathieu-DaudéQuoted 104 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Add a test which boots Linux and run basic commands using the serial port console.
The kernel image is built by the Debian project:
https://wiki.debian.org/RaspberryPiThe DeviceTree blob comes from the official Raspberry Pi project:
https://www.raspberrypi.org/The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-testThis test can be run using:
$ avocado run --show=console,app run -t machine:raspi3 tests/acceptance console: [ 0.000000] Linux version 4.14.0-3-arm64 ([email protected]) (gcc version 7.2.0 (Debian 7.2.0-18)) #1 SMP Debian 4.14.12-2 (2018-01-06) console: [ 0.000000] Boot CPU: AArch64 Processor [410fd034] console: [ 0.000000] Machine model: Raspberry Pi 3 Model B console: [ 0.000000] earlycon: pl11 at MMIO 0x000000003f201000 (options '') console: [ 0.000000] bootconsole [pl11] enabled [...] console: Starting network: OK console: Found console ttyAMA0 console: Boot successful. console: / # cat /proc/cpuinfo console: processor : 0 console: BogoMIPS : 125.00 console: r : 0x41 console: CPU architecture: 8 console: CPU variant console: : 0x0 console: CPU part : 0xd03 console: CPU revision : 4 console: / # uname -a console: Linux buildroot 4.14.0-3-arm64 #1 SMP Debian 4.14.12-2 (2018-01-06) aarch64 GNU/Linux console: reboot console: / # reboot console: / # Found console ttyAMA0 console: Stopping network: OK console: Saving random seed... done. console: Stopping logging: OK console: umount: devtmpfs busy - remounted read-only console: umount: can't unmount /: Invalid argument console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: kvm: exiting hardware virtualization console: reboot: Restarting system PASS (11.08 s)Reviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: Use archive.gzip_uncompress (Cleber)some chars are scrambled on the console? Cleber ran this 100 times and doesn't have issue.
--- tests/acceptance/boot_linux_console.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)tests/acceptance/boot_linux_console.py +31
-0@@ -338,6 +338,54 @@ class BootLinuxConsole(MachineTest): """ self.do_test_arm_raspi2(1) + def test_arm_raspi3_initrd_uart0(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi3 + """ + deb_url = ('https://snapshot.debian.org/archive/debian/' + '20180106T174014Z/pool/main/l/linux/' + 'linux-image-4.14.0-3-arm64_4.14.12-2_arm64.deb') + deb_hash = 'e71c995de57921921895c1162baea5df527d1c6b' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.14.0-3-arm64') + + dtb_url = ('https://github.com/raspberrypi/firmware/raw/' + '1.20180313/boot/bcm2710-rpi-3-b.dtb') + dtb_hash = 'eb14d67133401ef2f93523be7341456d38bfc077' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '9b6b392ea7bc15f0d6632328d429d31c9c6273da/rootfs/' + 'arm64/rootfs.cpio.gz') + initrd_hash = '6fd05324f17bb950196b5ad9d3a0fa996339f4cd' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = self.workdir + "rootfs.cpio" + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_machine('raspi3') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,0x3f201000 console=ttyAMA0 ' + + 'panic=-1 noreboot')
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 381
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.', + failure_message='-----[ cut here ]-----') +
With the previous refactors to wait_for_console_pattern(), this should become:
wait_for_console_pattern(self,
'Boot successful.',
failure_message='-----[ cut here ]-----')- Cleber.
Re: [PATCH 22/26] tests/boot_linux_console: Boot Linux and run few commands on raspi3
In reply to Philippe Mathieu-DaudéQuoted 56 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Add a test which boots Linux and run basic commands using the serial port console.
The kernel image is built by the Debian project:
https://wiki.debian.org/RaspberryPiThe DeviceTree blob comes from the official Raspberry Pi project:
https://www.raspberrypi.org/The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-testThis test can be run using:
$ avocado run --show=console,app run -t machine:raspi3 tests/acceptance console: [ 0.000000] Linux version 4.14.0-3-arm64 ([email protected]) (gcc version 7.2.0 (Debian 7.2.0-18)) #1 SMP Debian 4.14.12-2 (2018-01-06) console: [ 0.000000] Boot CPU: AArch64 Processor [410fd034] console: [ 0.000000] Machine model: Raspberry Pi 3 Model B console: [ 0.000000] earlycon: pl11 at MMIO 0x000000003f201000 (options '') console: [ 0.000000] bootconsole [pl11] enabled [...] console: Starting network: OK console: Found console ttyAMA0 console: Boot successful. console: / # cat /proc/cpuinfo console: processor : 0 console: BogoMIPS : 125.00 console: r : 0x41 console: CPU architecture: 8 console: CPU variant console: : 0x0 console: CPU part : 0xd03 console: CPU revision : 4 console: / # uname -a console: Linux buildroot 4.14.0-3-arm64 #1 SMP Debian 4.14.12-2 (2018-01-06) aarch64 GNU/Linux console: reboot console: / # reboot console: / # Found console ttyAMA0 console: Stopping network: OK console: Saving random seed... done. console: Stopping logging: OK console: umount: devtmpfs busy - remounted read-only console: umount: can't unmount /: Invalid argument console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: kvm: exiting hardware virtualization console: reboot: Restarting system PASS (11.08 s)Reviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines
---
v2: Use archive.gzip_uncompress (Cleber)some chars are scrambled on the console? Cleber ran this 100 times and doesn't have issue.
---
Now, I'm not getting good vibes from this test. It spawns QEMU and then gets stuck on every single execution.
VM launch command: 'aarch64-softmmu/qemu-system-aarch64 -chardev socket,id=mon,path=/var/tmp/tmpgpee0g1h/qemu-23397-monitor.sock -mon chardev=mon,mode=control -display none -vga none -machine raspi3 -chardev socket,id=console,path=/var/tmp/tmpgpee0g1h/qemu-23397-console.sock,server,nowait -serial chardev:console -kernel /var/tmp/avocado_7ks9sppd/avocado_job_wsp2727i/1-tests_acceptance_boot_linux_console.py_BootLinuxConsole.test_arm_raspi3_initrd_uart0/boot/vmlinuz-4.14.0-3-arm64 -dtb /home/cleber/avocado/data/cache/by_location/cd5c65e442f2375a87c174b91963be739bcdae77/bcm2710-rpi-3-b.dtb -initrd /var/tmp/avocado_7ks9sppd/avocado_job_wsp2727i/1-tests_acceptance_boot_linux_console.py_BootLinuxConsole.test_arm_raspi3_initrd_uart0rootfs.cpio -append printk.time=0 earlycon=pl011,0x3f201000 console=ttyAMA0 panic=-1 noreboot -no-reboot'
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': '
qmp_capabilities'}
<<< {'return': {}}
Given that I've tested this before, and I see some changes to raspi3 since then, I'll try to bisect the possible culprit. If you have any clues, they would be much appreciated.
- Cleber.
Re: [PATCH 23/26] tests/boot_linux_console: Test SDHCI and termal sensor on raspi3
In reply to Philippe Mathieu-DaudéQuoted 56 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
Add a test which loads the root filesystem on a SD card. Use a kernel recent enough to also test the thermal sensor.
The kernel image comes from:
https://github.com/sakaki-/bcmrpi3-kernel#descriptionThe cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-testReviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: Use archive.gzip_uncompress (Cleber)--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +28
-0@@ -386,6 +386,52 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + def test_arm_raspi3_initrd_sd_temp(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi3 + """ + tarball_url = ('https://github.com/sakaki-/bcmrpi3-kernel/releases/' + 'download/4.19.71.20190910/' + 'bcmrpi3-kernel-4.19.71.20190910.tar.xz') + tarball_hash = '844f117a1a6de0532ba92d2a7bceb5b2acfbb298' + tarball_path = self.fetch_asset(tarball_url, asset_hash=tarball_hash) + archive.extract(tarball_path, self.workdir) + dtb_path = self.workdir + "/boot/bcm2837-rpi-3-b.dtb" + kernel_path = self.workdir + "/boot/kernel8.img" + + rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' + '9b6b392ea7bc15f0d6632328d429d31c9c6273da/rootfs/' + 'arm64/rootfs.ext2.gz') + rootfs_hash = 'dbe4136f0b4a0d2180b93fd2a3b9a784f9951d10' + rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = self.workdir + "rootfs.ext2" + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + + self.vm.set_machine('raspi3') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,0x3f201000 console=ttyAMA0 ' + + 'root=/dev/mmcblk0 rootwait rw ' + + 'panic=-1 noreboot')
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 426
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line, + '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', + '-no-reboot') + self.vm.launch() + + self.wait_for_console_pattern('Boot successful.', + failure_message='-----[ cut here ]-----') +
Same here as in previous patch, that is:
wait_for_console_pattern(self,
'Boot successful.',
failure_message='-----[ cut here ]-----')Also, I'm getting the same experience, that is it gets stuck...
VM launch command: 'aarch64-softmmu/qemu-system-aarch64 -chardev socket,id=mon,path=/var/tmp/tmpi8x47vvd/qemu-25605-monitor.sock -mon chardev=mon,mode=control -display none -vga none -machine raspi3 -chardev socket,id=console,path=/var/tmp/tmpi8x47vvd/qemu-25605-console.sock,server,nowait -serial chardev:console -kernel /var/tmp/avocado_lfnakl9r/avocado_job_t5whwper/1-tests_acceptance_boot_linux_console.py_BootLinuxConsole.test_arm_raspi3_initrd_sd_temp/boot/kernel8.img -dtb /var/tmp/avocado_lfnakl9r/avocado_job_t5whwper/1-tests_acceptance_boot_linux_console.py_BootLinuxConsole.test_arm_raspi3_initrd_sd_temp/boot/bcm2837-rpi-3-b.dtb -append printk.time=0 earlycon=pl011,0x3f201000 console=ttyAMA0 root=/dev/mmcblk0 rootwait rw panic=-1 noreboot -drive file=/var/tmp/avocado_lfnakl9r/avocado_job_t5whwper/1-tests_acceptance_boot_linux_console.py_BootLinuxConsole.test_arm_raspi3_initrd_sd_temprootfs.ext2,if=sd,format=raw -no-reboot'
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 427
Quoted 1 line
tests/acceptance/boot_linux_console.py +0
-0>> {'execute': 'qmp_capabilities'}
<<< {'return': {}}
... right here.
- Cleber.
Re: [PATCH 21/26] tests/boot_linux_console: Test the raspi2 UART1 (16550 based)
In reply to Philippe Mathieu-DaudéQuoted 31 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
The current
do_test_arm_raspi2()case tests the PL011 UART0. Our model also supports the AUX UART (16550 based). We can very simply test the UART1 with Linux, modifying the kernel command line.Add few lines to expand our previous test and cover the AUX UART.
Reviewed-by Alex Bennée <[email protected]>Reviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/acceptance/boot_linux_console.py +1
-0@@ -301,6 +301,7 @@ class BootLinuxConsole(MachineTest): """ serial_kernel_cmdline = { 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0', + 1: 'earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200' } deb_url = ('http://archive.raspberrypi.org/debian/' 'pool/main/r/raspberrypi-firmware/'
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 315
Quoted 5 lines
tests/acceptance/boot_linux_console.py +1
-1@@ -311,7 +312,7 @@ class BootLinuxConsole(MachineTest): dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') self.vm.set_machine('raspi2') - self.vm.set_console() + self.vm.set_console(console_index=uart_id)
While this was tested and looks good by itself, it depends on a solution to the problem responded on <[email protected]>.
- Cleber.
Re: [PATCH 24/26] tests/boot_linux_console: Add initrd test for the Exynos4210
In reply to Philippe Mathieu-DaudéQuoted 165 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a smdkc210 board and verify the serial output is working.
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-testIf ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
This test can be run using:
$ IGNORE_AVOCADO_CONSOLE_BUG=yes \ avocado --show=app,console run -t machine:smdkc210 \ tests/acceptance/boot_linux_console.py console: Booting Linux on physical CPU 0x900 console: Linux version 4.19.0-6-armmp ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) console: CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache console: OF: fdt: Machine model: Samsung smdkv310 evaluation board based on Exynos4210 [...] console: Samsung CPU ID: 0x43210211 console: random: get_random_bytes called from start_kernel+0xa0/0x504 with crng_init=0 console: percpu: Embedded 17 pages/cpu s39756 r8192 d21684 u69632 console: Built 1 zonelists, mobility grouping on. Total pages: 249152 console: Kernel command line: printk.time=0 console=ttySAC0,115200n8 earlyprintk random.trust_cpu=off cryptomgr.notests cpuidle.off=1 panic=-1 noreboot [...] console: L2C: platform modifies aux control register: 0x02020000 -> 0x3e420001 console: L2C: platform provided aux values permit register corruption. console: L2C: DT/platform modifies aux control register: 0x02020000 -> 0x3e420001 console: L2C-310 erratum 769419 enabled console: L2C-310 enabling early BRESP for Cortex-A9 console: L2C-310: enabling full line of zeros but not enabled in Cortex-A9 console: L2C-310 ID prefetch enabled, offset 1 lines console: L2C-310 dynamic clock gating disabled, standby mode disabled console: L2C-310 cache controller enabled, 8 ways, 128 kB console: L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x7e420001 console: Exynos4210 clocks: sclk_apll = 12000000, sclk_mpll = 12000000 console: sclk_epll = 12000000, sclk_vpll = 12000000, arm_clk = 12000000 [...] console: s3c-i2c 13860000.i2c: slave address 0x00 console: s3c-i2c 13860000.i2c: bus frequency set to 93 KHz console: s3c-i2c 13860000.i2c: i2c-0: S3C I2C adapter [...] console: dma-pl330 12680000.pdma: Loaded driver for PL330 DMAC-241330 console: dma-pl330 12680000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16 console: dma-pl330 12690000.pdma: Loaded driver for PL330 DMAC-241330 console: dma-pl330 12690000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16 console: dma-pl330 12850000.mdma: Loaded driver for PL330 DMAC-241330 console: dma-pl330 12850000.mdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-1 Num_Events-16 console: dma-pl330 12850000.mdma: PM domain LCD0 will not be powered off console: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled console: Serial: AMBA driver console: 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 40, base_baud = 0) is a S3C6400/10 console: console [ttySAC0] enabled console: 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 41, base_baud = 0) is a S3C6400/10 console: 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 42, base_baud = 0) is a S3C6400/10 console: 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 43, base_baud = 0) is a S3C6400/10 [...] console: Freeing unused kernel memory: 2048K console: Run /init as init process console: mount: mounting devtmpfs on /dev failed: Device or resource busy console: Starting logging: OK console: Initializing random number generator... random: dd: uninitialized urandom read (512 bytes read) console: done. console: Starting network: OK console: Found console ttySAC0 console: Linux version 4.19.0-6-armmp ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) console: Boot successful. PASS (37.98 s)Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: use archive.gzip_uncompress (Cleber)serial input is not working :(
I sometime get (not always):
Starting network: OK
[ 70.403690] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: [ 70.423212] rcu: 0-...!: (36 GPs behind) idle=c7a/1/0x40000000 softirq=287/288 fqs=1 [ 70.428209] rcu: (detected by 1, t=2602 jiffies, g=-443, q=2209) [ 70.432826] Sending NMI from CPU 1 to CPUs 0: [ 70.473866] NMI backtrace for cpu 0 [ 70.476621] CPU: 0 PID: 112 Comm: cat Not tainted 4.19.0 #1 [ 70.476711] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 70.476916] PC is at mntput_no_expire+0x88/0x464 [ 70.476996] LR is at rcu_is_watching+0x24/0x78 [ 70.477074] pc : [<c02b256c>] lr : [<c01a2fb4>] psr: a0000013 [ 70.477150] sp : ee2afdb0 ip : 9dff9a2f fp : ee2aff70 [ 70.477225] r10: 00000142 r9 : ee219dc0 r8 : ee2afec0 [ 70.477302] r7 : ee2afec0 r6 : c0298d6c r5 : ef02c400 r4 : ef018200 [ 70.477385] r3 : c0f99274 r2 : 00000031 r1 : 2e87c000 r0 : a0000013 [ 70.477461] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 70.477537] Control: 10c5387d Table: 6e30806a DAC: 00000051 [ 70.477613] CPU: 0 PID: 112 Comm: cat Not tainted 4.19.0 #1 [ 70.477688] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 70.477765] [<c01128f4>] (unwind_backtrace) from [<c010e5b4>] (show_stack+0x10/0x14) [ 70.477847] [<c010e5b4>] (show_stack) from [<c0a36160>] (dump_stack+0x98/0xc4) [ 70.477925] [<c0a36160>] (dump_stack) from [<c0a3cc90>] (nmi_cpu_backtrace+0x6c/0xb4) [ 70.478000] [<c0a3cc90>] (nmi_cpu_backtrace) from [<c0111530>] (handle_IPI+0x108/0x420) [ 70.478076] [<c0111530>] (handle_IPI) from [<c04950a8>] (gic_handle_irq+0x98/0x9c) [ 70.478151] [<c04950a8>] (gic_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0xb0) [ 70.478226] Exception stack(0xee2afd60 to 0xee2afda8) [ 70.478303] fd60: a0000013 2e87c000 00000031 c0f99274 ef018200 ef02c400 c0298d6c ee2afec0 [ 70.478378] fd80: ee2afec0 ee219dc0 00000142 ee2aff70 9dff9a2f ee2afdb0 c01a2fb4 c02b256c [ 70.478453] fda0: a0000013 ffffffff [ 70.478529] [<c01019f0>] (__irq_svc) from [<c02b256c>] (mntput_no_expire+0x88/0x464) [ 70.478605] [<c02b256c>] (mntput_no_expire) from [<c0298d6c>] (terminate_walk+0x154/0x160) [ 70.478681] [<c0298d6c>] (terminate_walk) from [<c029ce3c>] (path_openat+0x324/0xfe4) [ 70.478759] [<c029ce3c>] (path_openat) from [<c029ea9c>] (do_filp_open+0x70/0xdc) [ 70.478835] [<c029ea9c>] (do_filp_open) from [<c028b36c>] (do_sys_open+0x134/0x1e4) [ 70.478911] [<c028b36c>] (do_sys_open) from [<c0101000>] (ret_fast_syscall+0x0/0x28) [ 70.478989] Exception stack(0xee2affa8 to 0xee2afff0) [ 70.479064] ffa0: b6fc7d6c 0000000a ffffff9c bebbf268 000a0000 00000000 [ 70.479139] ffc0: b6fc7d6c 0000000a 00000050 00000142 bebbf268 b6fc6970 b6fc6b28 bebbf254 [ 70.479214] ffe0: b6fc6970 bebbf1e0 b6f9dd94 b6fb0c0c [ 70.484892] rcu: rcu_preempt kthread starved for 2600 jiffies! g-443 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=0 [ 70.514943] rcu: RCU grace-period kthread stack dump: [ 70.516687] rcu_preempt I 0 10 2 0x00000000 [ 70.523711] [<c0a4caac>] (__schedule) from [<c0a4d28c>] (schedule+0x4c/0xac) [ 70.525103] [<c0a4d28c>] (schedule) from [<c0a52c34>] (schedule_timeout+0x230/0x564) [ 70.526472] [<c0a52c34>] (schedule_timeout) from [<c01a7818>] (rcu_gp_kthread+0x6e4/0xbf0) [ 70.527784] [<c01a7818>] (rcu_gp_kthread) from [<c014d7f0>] (kthread+0x138/0x168) [ 70.528989] [<c014d7f0>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20) [ 70.530387] Exception stack(0xef111fb0 to 0xef111ff8) [ 70.532556] 1fa0: 00000000 00000000 00000000 00000000 [ 70.534904] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 70.536920] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000Found console ttySAC0
Linux version 4.19.0 (root@591d0a36fd03) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #1 SMP PREEMPT Fri Oct 4 19:53:43 UTC 2019 Boot successful.
/ #Also:
[ 73.000405] [<c01128f4>] (unwind_backtrace) from [<c010e5b4>] (show_stack+0x10/0x14) [ 73.000537] [<c010e5b4>] (show_stack) from [<c0a36160>] (dump_stack+0x98/0xc4) [ 73.000631] [<c0a36160>] (dump_stack) from [<c0a3cc90>] (nmi_cpu_backtrace+0x6c/0xb4) [ 73.000701] [<c0a3cc90>] (nmi_cpu_backtrace) from [<c0111530>] (handle_IPI+0x108/0x420) [ 73.000823] [<c0111530>] (handle_IPI) from [<c04950a8>] (gic_handle_irq+0x98/0x9c) [ 73.000924] [<c04950a8>] (gic_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0xb0) [ 73.000990] Exception stack(0xef123f80 to 0xef123fc8) [ 73.001064] 3f80: 00000001 00000001 00000000 ef11b300 ef122000 c1007470 c10074b4 00000002 [ 73.001131] 3fa0: 4000406a 410fc090 00000000 00000000 00000000 ef123fd0 c018759c c010a4c8 [ 73.001196] 3fc0: 20000013 ffffffff [ 73.001262] [<c01019f0>] (__irq_svc) from [<c010a4c8>] (arch_cpu_idle+0x24/0x3c) [ 73.001328] [<c010a4c8>] (arch_cpu_idle) from [<c015f1f0>] (do_idle+0xcc/0x168) [ 73.001394] [<c015f1f0>] (do_idle) from [<c015f60c>] (cpu_startup_entry+0x18/0x1c) [ 73.001462] [<c015f60c>] (cpu_startup_entry) from [<4010276c>] (0x4010276c)Based-on: [email protected] "tests/boot_linux_console: Extract the
gunzip()helper"--- tests/acceptance/boot_linux_console.py | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)tests/acceptance/boot_linux_console.py +0
-0
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 435
Quoted 4 lines
tests/acceptance/boot_linux_console.py +1
-0@@ -432,6 +432,48 @@ class BootLinuxConsole(MachineTest): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + @skipUnless(os.getenv('IGNORE_AVOCADO_CONSOLE_BUG'), 'Console buggy')
Given that the problems seem related to console input, I think it's safe to remove this conditional. I've tested this extensively (hundreds of executions with as many as 15 running simultaneously) and had no issues.
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 25/26] tests/boot_linux_console: Add sdcard test for the Exynos4210
In reply to Philippe Mathieu-DaudéQuoted 52 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a smdkc210 board and verify the serial output is working.
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-testSince this test is not reliable due to clock timing issues, it is disabled with the 'skip' property.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2:
- use archive.gzip_uncompress (Cleber)
- checkgetenv(AVOCADO_ALLOW_UNTRUSTED_CODE)(pm215)--- tests/acceptance/boot_linux_console.py | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)tests/acceptance/boot_linux_console.py +17
-0@@ -13,6 +13,7 @@ import lzma import gzip import shutil +from avocado import skip from avocado import skipUnless from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern@@ -474,6 +475,52 @@ class BootLinuxConsole(MachineTest): self.wait_for_console_pattern('Boot successful.') # TODO user command, for now the uart is stuck + @skip("unstable clock timings") + def test_arm_exynos4210_sdcard(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:smdkc210 + """ + deb_url = ('https://snapshot.debian.org/archive/debian/' + '20190928T224601Z/pool/main/l/linux/' + 'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb') + deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.19.0-6-armmp') + dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) +
tests/acceptance/boot_linux_console.py class BootLinuxConsole(MachineTest): · line 503
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv5.ext2.gz') + rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93' + rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = os.path.join(self.workdir, 'rootfs.ext2') + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + + self.vm.set_machine('smdkc210') + self.vm.set_console(console_index=1)
This also depends on the resolution of the
'QEMUMachine._console_index' question.
- Cleber.
Re: [PATCH 15/26] tests/acceptance: Test OpenBIOS on the PReP/40p
In reply to Cleber RosaQuoted 14 lines · Cleber Rosa
Quoted 5 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.htmlQuoted 7 lines
Acked-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- use MD5 hash
---
Quoted 4 lines
Reviewed-by Cleber Rosa <[email protected]>Tested-by Cleber Rosa <[email protected]>Queuing on my python-next branch (and sending shortly in a PR).
Even though this test runs fine on my local machine, it times out under Travis because the image is too large to be downloaded within the test timeout. For now, I'm adding:
@skipIf(os.getenv('CONTINUOUS_INTEGRATION'), 'Running on Travis-CI')
The definitive solution is coming. Avocado master already allows one to run:
$ avocado assets fetch tests/acceptance/boot_linux_console.py
And have the assets downloaded *before* the test is executed. We're now adding a "pre_tests"[1] plugin, so that the download will be done automatically (and only for the tests in the current job).
- Cleber.
Quoted 3 lines
Thanks,
- Cleber.
Re: [PATCH 26/26] tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
In reply to Aleksandar MarkovicQuoted 11 lines · Aleksandar Markovic
Quoted 7 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
This tests boots a Linux kernel on a Malta machine up to a busybox shell on the serial console. Few commands are executed before halting the machine (via reboot).
Quoted 4 lines
A very nice test.
Reviewed-by Aleksandar Markovic <[email protected]>
Thanks for the review Aleksandar.
Queuing on my python-next branch (and sending shortly in a PR).
Thanks,
- Cleber.
Re: [PATCH 08/26] tests/acceptance: Introduce LinuxUserTest base class
In reply to Philippe Mathieu-DaudéLaurent, you weren't Cc'ed on this series, you might find it helpful to test linux-user code. The next patch (09/26 Add bFLT loader linux-user test) is provided as an example, and tests a STM32 BusyBox.
Quoted 33 lines · Philippe Mathieu-Daudé
Similarly to the MachineTest base class, this class contains methods common to linux-user tests.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/avocado_qemu/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+)tests/acceptance/avocado_qemu/__init__.py +9
-0@@ -14,6 +14,7 @@ import sys import uuid import avocado +from avocado.utils import process SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..') sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))@@ -138,3 +139,11 @@ class MachineTest(Test): def tearDown(self): for vm in self._vms.values(): vm.shutdown() + + +class LinuxUserTest(Test): + def setUp(self): + self.base_setUp("%s-linux-user", "qemu-%s") + + def run(self, cmd): + return process.run("%s %s" % (self.qemu_bin, cmd))
Re: [PATCH 06/26] tests/acceptance: Rename avocado_qemu.Test as MachineTest
In reply to Philippe Mathieu-DaudéHi Philippe,
Quoted 2 lines · Philippe Mathieu-Daudé
This class is used to test QEMU machines, rename it as MachineTest. This will allow us to add a UserTest class for qemu-user tests.
My concern with this rename is that usually "Machine" refers to machine type implementation. What if we follow QEMU's terminology of User vs System? So it would be renamed to something like SystemTest (vs LinuxUserTest as you propose on Patch 08).
Thanks,
Wainer
Quoted 243 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- docs/devel/testing.rst | 8 ++++---- tests/acceptance/avocado_qemu/__init__.py | 7 ++++++- tests/acceptance/boot_linux_console.py | 4 ++-- tests/acceptance/cpu_queries.py | 4 ++-- tests/acceptance/empty_cpu_model.py | 4 ++-- tests/acceptance/linux_initrd.py | 4 ++-- tests/acceptance/linux_ssh_mips_malta.py | 4 ++-- tests/acceptance/migration.py | 4 ++-- tests/acceptance/version.py | 4 ++-- tests/acceptance/virtio_version.py | 4 ++-- tests/acceptance/vnc.py | 4 ++-- 11 files changed, 28 insertions(+), 23 deletions(-)docs/devel/testing.rst +4
-4@@ -601,7 +601,7 @@ class. Here's a simple usage example: from avocado_qemu import Test - class Version(Test): + class Version(MachineTest): """ :avocado: tags=quick """@@ -625,7 +625,7 @@ in the current directory, tagged as "quick", run: avocado run -t quick . -The ``avocado_qemu.Test`` base test class +The ``avocado_qemu.MachineTest`` base test class ----------------------------------------- The ``avocado_qemu.Test`` class has a number of characteristics that@@ -646,10 +646,10 @@ and hypothetical example follows: .. code:: - from avocado_qemu import Test + from avocado_qemu import MachineTest - class MultipleMachines(Test): + class MultipleMachines(MachineTest): """ :avocado: enable """tests/acceptance/avocado_qemu/__init__.py +6
-1@@ -100,7 +100,6 @@ def exec_command_and_wait_for_pattern(test, command, class Test(avocado.Test): def setUp(self): - self._vms = {} arches = self.tags.get('arch', []) if len(arches) == 1: arch = arches.pop()@@ -113,6 +112,12 @@ class Test(avocado.Test): if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") + +class MachineTest(Test): + def setUp(self): + self._vms = {} + super().setUp() + def _new_vm(self, *args): vm = QEMUMachine(self.qemu_bin) if args:tests/acceptance/boot_linux_console.py +2
-2@@ -13,14 +13,14 @@ import lzma import gzip import shutil -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive -class BootLinuxConsole(Test): +class BootLinuxConsole(MachineTest): """ Boots a Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kerneltests/acceptance/cpu_queries.py +2
-2@@ -10,9 +10,9 @@ import logging -from avocado_qemu import Test +from avocado_qemu import MachineTest -class QueryCPUModelExpansion(Test): +class QueryCPUModelExpansion(MachineTest): """ Run query-cpu-model-expansion for each CPU model, and validate results """tests/acceptance/empty_cpu_model.py +2
-2@@ -8,9 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. import subprocess -from avocado_qemu import Test +from avocado_qemu import MachineTest -class EmptyCPUModel(Test): +class EmptyCPUModel(MachineTest): def test(self): cmd = [self.qemu_bin, '-S', '-display', 'none', '-machine', 'none', '-cpu', ''] r = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)tests/acceptance/linux_initrd.py +2
-2@@ -12,10 +12,10 @@ import logging import tempfile from avocado.utils.process import run -from avocado_qemu import Test +from avocado_qemu import MachineTest -class LinuxInitrd(Test): +class LinuxInitrd(MachineTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option.tests/acceptance/linux_ssh_mips_malta.py +2
-2@@ -12,14 +12,14 @@ import logging import time from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive from avocado.utils import ssh -class LinuxSSH(Test): +class LinuxSSH(MachineTest): timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg'tests/acceptance/migration.py +2
-2@@ -10,13 +10,13 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest from avocado.utils import network from avocado.utils import wait -class Migration(Test): +class Migration(MachineTest): timeout = 10tests/acceptance/version.py +2
-2@@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest -class Version(Test): +class Version(MachineTest): """ :avocado: tags=quick """tests/acceptance/virtio_version.py +2
-2@@ -13,7 +13,7 @@ import os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import MachineTest # Virtio Device IDs: VIRTIO_NET = 1@@ -55,7 +55,7 @@ def get_pci_interfaces(vm, devtype): interfaces = ('pci-express-device', 'conventional-pci-device') return [i for i in interfaces if devtype_implements(vm, devtype, i)] -class VirtioVersionCheck(Test): +class VirtioVersionCheck(MachineTest): """ Check if virtio-version-specific device types result in the same device tree created by `disable-modern` andtests/acceptance/vnc.py +2
-2@@ -8,10 +8,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import MachineTest -class Vnc(Test): +class Vnc(MachineTest): """ :avocado: tags=vnc,quick """
Re: [PATCH 16/26] tests/acceptance: Test Sandalfoot initrd on the PReP/40p
In reply to Cleber RosaQuoted 48 lines · Cleber Rosa
Quoted 47 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
User case from:
https://mail.coreboot.org/pipermail/openbios/2018-May/010360.htmlSandalfoot info:
http://www.juneau-lug.org/sandalfoot.phpAcked-by David Gibson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v3:
- use avocado_qemu.wait_for_console_pattern (Cleber)
- useexec_command_and_wait_for_pattern
- checkgetenv(AVOCADO_ALLOW_UNTRUSTED_CODE)(pm215)--- tests/acceptance/ppc_prep_40p.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)tests/acceptance/ppc_prep_40p.py +13
-0@@ -11,6 +11,7 @@ import logging from avocado import skipIf from avocado import skipUnless from avocado_qemu import MachineTest +from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern@@ -101,3 +102,33 @@ class IbmPrep40pMachine(MachineTest): self.vm.launch() wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_sandalfoot_busybox(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:40p + """ + drive_url = ('http://www.juneau-lug.org/zImage.initrd.sandalfoot') + drive_hash = 'dacacfc4085ea51d34d99ef70e972b849e2c6949' + drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash) + + self.vm.set_machine('40p')
Quoted 8 lines
tests/acceptance/ppc_prep_40p.py class IbmPrep40pMachine(MachineTest): · line 122
Quoted 6 lines
tests/acceptance/ppc_prep_40p.py +6
-0+ self.vm.set_console() + self.vm.add_args('-cdrom', drive_path, + '-boot', 'd') + + self.vm.launch() + wait_for_console_pattern(self, 'Now booting the kernel')I could never get past this point. Any ideas?
I think this is because the message below :
Quoted 2 lines
tests/acceptance/ppc_prep_40p.py class IbmPrep40pMachine(MachineTest): · line 124
Quoted 2 lines
tests/acceptance/ppc_prep_40p.py +2
-0+ + msg = 'Please press Enter to activate this console.'
waits for a Line Feed and the console interaction does a readline.
It would be interesting to include this acceptance/avocado test for the 40p machine because QEMU still supports the 604 CPUs quite well.
Thanks,
C.
Quoted 16 lines
Quoted 13 lines
tests/acceptance/ppc_prep_40p.py +10
-0+ wait_for_console_pattern(self, msg) + + version = 'BusyBox v0.60.0 (2001.08.19-09:26+0000) Built-in shell (ash)' + exec_command_and_wait_for_pattern(self, '', version) + + uname = 'Linux ppc 2.4.18 #5 Wed May 21 23:50:43 AKDT 2003 ppc unknown' + exec_command_and_wait_for_pattern(self, 'uname -a', uname) + + cpu = 'PReP IBM 6015/7020 (Sandalfoot/Sandalbow)' + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', cpu)Signature · 1 line
2.21.0