From f7ade7793170619cebbe2aeeda6c7baf0516a58c Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Tue, 27 Jul 2021 11:45:17 +0300 Subject: [PATCH 01/22] tests/acceptance: add replay kernel test for s390x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds record/replay test which boots Linux kernel on s390x platform. The test uses kernel binaries taken from boot_linux_console test. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Acked-by: Thomas Huth [PMD: Drop default '-smp 1' as suggested by Thomas] Signed-off-by: Philippe Mathieu-Daudé Message-Id: <162737551785.1735673.6775108576116333386.stgit@pasha-ThinkPad-X280> --- tests/acceptance/replay_kernel.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py index bb32b31240..06a09d6679 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/acceptance/replay_kernel.py @@ -207,6 +207,21 @@ class ReplayKernelNormal(ReplayKernelBase): '-initrd', initrd_path, '-no-reboot')) + def test_s390x_s390_ccw_virtio(self): + """ + :avocado: tags=arch:s390x + :avocado: tags=machine:s390-ccw-virtio + """ + kernel_url = ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/29/Everything/s390x/os/images' + '/kernel.img') + kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0' + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=9) + def test_ppc64_pseries(self): """ :avocado: tags=arch:ppc64 From 27f551135ea897928e29f12fc035d68f2bf6216c Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Tue, 27 Jul 2021 11:45:23 +0300 Subject: [PATCH 02/22] tests/acceptance: add replay kernel test for openrisc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds record/replay test which boots Linux kernel on openrisc platform. The test uses kernel binaries taken from boot_linux_console test. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé Message-Id: <162737552350.1735673.14603125561530143423.stgit@pasha-ThinkPad-X280> --- tests/acceptance/replay_kernel.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py index 06a09d6679..1bf7e997fe 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/acceptance/replay_kernel.py @@ -317,6 +317,17 @@ class ReplayKernelNormal(ReplayKernelBase): file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) self.do_test_advcal_2018(file_path, 'uImage') + def test_or1k_sim(self): + """ + :avocado: tags=arch:or1k + :avocado: tags=machine:or1k-sim + """ + tar_hash = '20334cdaf386108c530ff0badaecc955693027dd' + tar_url = ('https://www.qemu-advent-calendar.org' + '/2018/download/day20.tar.xz') + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + self.do_test_advcal_2018(file_path, 'vmlinux') + def test_ppc_g3beige(self): """ :avocado: tags=arch:ppc From ce9771f5a4003d93e0afd3f7397740219713c875 Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Tue, 27 Jul 2021 11:45:29 +0300 Subject: [PATCH 03/22] tests/acceptance: add replay kernel test for nios2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds record/replay test which boots Linux kernel on nios2 platform. The test uses kernel binaries taken from boot_linux_console test. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé Message-Id: <162737552919.1735673.12493523185952280539.stgit@pasha-ThinkPad-X280> --- tests/acceptance/replay_kernel.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py index 1bf7e997fe..9325181992 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/acceptance/replay_kernel.py @@ -328,6 +328,17 @@ class ReplayKernelNormal(ReplayKernelBase): file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) self.do_test_advcal_2018(file_path, 'vmlinux') + def test_nios2_10m50(self): + """ + :avocado: tags=arch:nios2 + :avocado: tags=machine:10m50-ghrd + """ + tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918' + tar_url = ('https://www.qemu-advent-calendar.org' + '/2018/download/day14.tar.xz') + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + self.do_test_advcal_2018(file_path, 'vmlinux.elf') + def test_ppc_g3beige(self): """ :avocado: tags=arch:ppc From 7f7c382a4d7b7698fd27ae1f14ff56ffa3e3ef1c Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Tue, 27 Jul 2021 11:45:34 +0300 Subject: [PATCH 04/22] tests/acceptance: add replay kernel test for alpha MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds record/replay test which boots Linux kernel on alpha platform. The test uses kernel binaries taken from boot_linux_console test. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé Message-Id: <162737553482.1735673.10021851966976933952.stgit@pasha-ThinkPad-X280> --- tests/acceptance/replay_kernel.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py index 9325181992..c68a953730 100644 --- a/tests/acceptance/replay_kernel.py +++ b/tests/acceptance/replay_kernel.py @@ -222,6 +222,23 @@ class ReplayKernelNormal(ReplayKernelBase): console_pattern = 'Kernel command line: %s' % kernel_command_line self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=9) + def test_alpha_clipper(self): + """ + :avocado: tags=arch:alpha + :avocado: tags=machine:clipper + """ + kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/' + 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz') + kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + uncompressed_kernel = archive.uncompress(kernel_path, self.workdir) + + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.run_rr(uncompressed_kernel, kernel_command_line, console_pattern, shift=9, + args=('-nodefaults', )) + def test_ppc64_pseries(self): """ :avocado: tags=arch:ppc64 From 82184f40186ad16fe3bc98591db511b67704ffb2 Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Tue, 27 Jul 2021 11:45:40 +0300 Subject: [PATCH 05/22] tests/acceptance: Linux boot test for record/replay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a test for record/replay, which boots Linux image from the disk and interacts with the network. The idea and code of this test is borrowed from boot_linux.py This test includes only x86_64 platform. Other platforms and machines will be added later after testing and improving record/replay to completely support them. Each test consists of the following phases: - downloading the disk image - recording the execution - replaying the execution Replay does not validates the output, but waits until QEMU finishes the execution. This is reasonable, because QEMU usually hangs when replay goes wrong. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé Message-Id: <162737554047.1735673.13133593401566029378.stgit@pasha-ThinkPad-X280> --- MAINTAINERS | 1 + tests/acceptance/replay_linux.py | 116 +++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 tests/acceptance/replay_linux.py diff --git a/MAINTAINERS b/MAINTAINERS index d7915ec128..069db6d299 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2973,6 +2973,7 @@ F: include/sysemu/replay.h F: docs/replay.txt F: stubs/replay.c F: tests/acceptance/replay_kernel.py +F: tests/acceptance/replay_linux.py F: tests/acceptance/reverse_debugging.py F: qapi/replay.json diff --git a/tests/acceptance/replay_linux.py b/tests/acceptance/replay_linux.py new file mode 100644 index 0000000000..15953f9e49 --- /dev/null +++ b/tests/acceptance/replay_linux.py @@ -0,0 +1,116 @@ +# Record/replay test that boots a complete Linux system via a cloud image +# +# Copyright (c) 2020 ISP RAS +# +# Author: +# Pavel Dovgalyuk +# +# 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 +import time + +from avocado import skipUnless +from avocado.utils import cloudinit +from avocado.utils import network +from avocado.utils import vmimage +from avocado.utils import datadrainer +from avocado.utils.path import find_command +from avocado_qemu import LinuxTest + +class ReplayLinux(LinuxTest): + """ + Boots a Linux system, checking for a successful initialization + """ + + timeout = 1800 + chksum = None + hdd = 'ide-hd' + cd = 'ide-cd' + bus = 'ide' + + def setUp(self): + super(ReplayLinux, self).setUp() + self.boot_path = self.download_boot() + self.cloudinit_path = self.prepare_cloudinit() + + def vm_add_disk(self, vm, path, id, device): + bus_string = '' + if self.bus: + bus_string = ',bus=%s.%d' % (self.bus, id,) + vm.add_args('-drive', 'file=%s,snapshot,id=disk%s,if=none' % (path, id)) + vm.add_args('-drive', + 'driver=blkreplay,id=disk%s-rr,if=none,image=disk%s' % (id, id)) + vm.add_args('-device', + '%s,drive=disk%s-rr%s' % (device, id, bus_string)) + + def launch_and_wait(self, record, args, shift): + vm = self.get_vm() + vm.add_args('-smp', '1') + vm.add_args('-m', '1024') + vm.add_args('-object', 'filter-replay,id=replay,netdev=hub0port0') + if args: + vm.add_args(*args) + self.vm_add_disk(vm, self.boot_path, 0, self.hdd) + self.vm_add_disk(vm, self.cloudinit_path, 1, self.cd) + logger = logging.getLogger('replay') + if record: + logger.info('recording the execution...') + mode = 'record' + else: + logger.info('replaying the execution...') + mode = 'replay' + replay_path = os.path.join(self.workdir, 'replay.bin') + vm.add_args('-icount', 'shift=%s,rr=%s,rrfile=%s' % + (shift, mode, replay_path)) + + start_time = time.time() + + vm.set_console() + vm.launch() + console_drainer = datadrainer.LineLogger(vm.console_socket.fileno(), + logger=self.log.getChild('console'), + stop_check=(lambda : not vm.is_running())) + console_drainer.start() + if record: + cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), + self.name) + vm.shutdown() + logger.info('finished the recording with log size %s bytes' + % os.path.getsize(replay_path)) + else: + vm.event_wait('SHUTDOWN', self.timeout) + vm.shutdown(True) + logger.info('successfully fihished the replay') + elapsed = time.time() - start_time + logger.info('elapsed time %.2f sec' % elapsed) + return elapsed + + def run_rr(self, args=None, shift=7): + t1 = self.launch_and_wait(True, args, shift) + t2 = self.launch_and_wait(False, args, shift) + logger = logging.getLogger('replay') + logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1)) + +@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') +class ReplayLinuxX8664(ReplayLinux): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=accel:tcg + """ + + chksum = 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c5c27a0' + + def test_pc_i440fx(self): + """ + :avocado: tags=machine:pc + """ + self.run_rr(shift=1) + + def test_pc_q35(self): + """ + :avocado: tags=machine:q35 + """ + self.run_rr(shift=3) From 8adacf7fa962c7cc38e3772a38f817735f099ef3 Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 9 Aug 2021 16:29:07 -0300 Subject: [PATCH 06/22] Acceptance tests: add myself as a reviewer for the acceptance tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Willian Rampazzo Acked-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210809192907.42138-1-willianr@redhat.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 069db6d299..f98523cfe0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3485,6 +3485,7 @@ W: https://trello.com/b/6Qi1pxVn/avocado-qemu R: Cleber Rosa R: Philippe Mathieu-Daudé R: Wainer dos Santos Moschetta +R: Willian Rampazzo S: Odd Fixes F: tests/acceptance/ From 1f1fcf0c5738296f79723ead75520a957bf7b30b Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Mon, 20 Sep 2021 17:49:27 -0300 Subject: [PATCH 07/22] Acceptance Tests: add standard clean up at test tearDown() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The avocado.Test class, used as the basis of the avocado_qemu.Test class, performs a clean of temporary directories up as part of its own tearDown() implementation. But the avocado_qemu.Test class is currently missing the same clean up, as it implemented its own tearDown() method without resorting to the upper class behavior. This brings avocado_qemu.Test behavior in sync with the standard avocado.Test behavior and prevents temporary directories from cluttering the test results directory (unless instructed to do so with Avocado's "--keep-tmp" option). Reported-by: Peter Maydell Signed-off-by: Cleber Rosa [willianr: respin to new Python super format] Signed-off-by: Willian Rampazzo Reviewed-by: Wainer dos Santos Moschetta Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-2-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 2c4fef3e14..d9e1b32aa1 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -276,6 +276,7 @@ class Test(avocado.Test): for vm in self._vms.values(): vm.shutdown() self._sd = None + super().tearDown() def fetch_asset(self, name, asset_hash=None, algorithm=None, From 20bf915418bcd4c2f14ce417764cc9f9c63bafff Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 20 Sep 2021 17:49:28 -0300 Subject: [PATCH 08/22] avocado_qemu: standardize super() call following PEP3135 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PEP3135 states when calling super(), there is no need to use arguments. This changes the calls on avocado_qemu to standardize according to PEP3135 and avoid warnings from linters. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-3-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index d9e1b32aa1..d2077d63cd 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -282,7 +282,7 @@ class Test(avocado.Test): asset_hash=None, algorithm=None, locations=None, expire=None, find_only=False, cancel_on_missing=True): - return super(Test, self).fetch_asset(name, + return super().fetch_asset(name, asset_hash=asset_hash, algorithm=algorithm, locations=locations, @@ -470,7 +470,7 @@ class LinuxTest(Test, LinuxSSHMixIn): self.distro.checksum = distro_checksum def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): - super(LinuxTest, self).setUp() + super().setUp() self._set_distro() self.vm.add_args('-smp', '2') self.vm.add_args('-m', '1024') From e410bac0701b6f6a3d45990caf9aaca7f8d46bb3 Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 20 Sep 2021 17:49:29 -0300 Subject: [PATCH 09/22] avocado_qemu: fix import module based on isort MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-4-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index d2077d63cd..edb9ed7485 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -12,19 +12,13 @@ import logging import os import shutil import sys -import uuid import tempfile +import uuid import avocado - -from avocado.utils import cloudinit -from avocado.utils import datadrainer -from avocado.utils import network -from avocado.utils import ssh -from avocado.utils import vmimage +from avocado.utils import cloudinit, datadrainer, network, ssh, vmimage from avocado.utils.path import find_command - #: The QEMU build root directory. It may also be the source directory #: if building from the source dir, but it's safer to use BUILD_DIR for #: that purpose. Be aware that if this code is moved outside of a source @@ -42,11 +36,9 @@ else: sys.path.append(os.path.join(SOURCE_DIR, 'python')) from qemu.machine import QEMUMachine -from qemu.utils import ( - get_info_usernet_hostfwd_port, - kvm_available, - tcg_available, -) +from qemu.utils import (get_info_usernet_hostfwd_port, kvm_available, + tcg_available) + def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) From 22e82e0982a893074738cd9c6184c8eb1c012422 Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 20 Sep 2021 17:49:30 -0300 Subject: [PATCH 10/22] avocado_qemu: tweak ssh connect method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation will crash if the connection fails as the `time` module is not imported. Fix the import problem. While here, tweaks the connection to wait progressively when the connection fails. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé [PMD: Reworded description] Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-5-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index edb9ed7485..c3613f9262 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -13,6 +13,7 @@ import os import shutil import sys import tempfile +import time import uuid import avocado @@ -305,8 +306,7 @@ class LinuxSSHMixIn: self.ssh_session.connect() return except: - time.sleep(4) - pass + time.sleep(i) self.fail('ssh connection timeout') def ssh_command(self, command): From 6c58af2e173254d933f11d420a6a140021cd7573 Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 20 Sep 2021 17:49:31 -0300 Subject: [PATCH 11/22] avocado_qemu: explicitly return None to avoid R1710 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The linter is complaining the `pick_default_qemu_bin` is not explicitly returning None. Fix it to explicitly return None and avoid R1710 inconsistent-return-statements. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-6-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index c3613f9262..35318ce2a9 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -72,6 +72,7 @@ def pick_default_qemu_bin(arch=None): qemu_bin_relative_path) if is_readable_executable_file(qemu_bin_from_bld_dir_path): return qemu_bin_from_bld_dir_path + return None def _console_interaction(test, success_message, failure_message, From e519df437a1f46491f687c001fe2eab24bafe18e Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Mon, 20 Sep 2021 17:49:32 -0300 Subject: [PATCH 12/22] avocado_qemu: fix inheritance order on LinuxTest class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Class hierarchy on Python is defined from right to left. Although the current code is not harmful, let's fix it to avoid problems in the future. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210920204932.94132-7-willianr@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 35318ce2a9..1841053e2c 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -424,7 +424,7 @@ class LinuxDistro: return self._info.get('kernel_params', None) -class LinuxTest(Test, LinuxSSHMixIn): +class LinuxTest(LinuxSSHMixIn, Test): """Facilitates having a cloud-image Linux based available. For tests that indend to interact with guests, this is a better choice From 23022794dee93f7bc3213e42cb613c4fc78b90ec Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Thu, 23 Sep 2021 13:11:39 -0300 Subject: [PATCH 13/22] tests/Makefile: allow control over tags during check-acceptance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although it is possible to run a specific test using the avocado command-line, a user may want to use a specific tag while running the ``make check-acceptance`` during the development or debugging. This allows using the AVOCADO_TAGS environment variable where the user takes total control of which tests should run based on the tags defined. This also makes the check-acceptance command flexible to restrict tests based on tags while running on CI. e.g.: AVOCADO_TAGS="foo bar baz" make check-acceptance Signed-off-by: Willian Rampazzo Tested-by: Wainer dos Santos Moschetta Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210923161141.232208-2-willianr@redhat.com> --- docs/devel/testing.rst | 14 ++++++++++++++ tests/Makefile.include | 12 +++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 4a0abbf23d..d1841e35d5 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -732,6 +732,20 @@ available. On Debian and Ubuntu based systems, depending on the specific version, they may be on packages named ``python3-venv`` and ``python3-pip``. +It is also possible to run tests based on tags using the +``make check-acceptance`` command and the ``AVOCADO_TAGS`` environment +variable: + +.. code:: + + make check-acceptance AVOCADO_TAGS=quick + +Note that tags separated with commas have an AND behavior, while tags +separated by spaces have an OR behavior. For more information on Avocado +tags, see: + + https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/tags.html + The scripts installed inside the virtual environment may be used without an "activation". For instance, the Avocado test runner may be invoked by running: diff --git a/tests/Makefile.include b/tests/Makefile.include index 6e16c05f10..f6484e5b31 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -92,7 +92,12 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results # Any number of command separated loggers are accepted. For more # information please refer to "avocado --help". AVOCADO_SHOW=app -AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGETS))) +ifndef AVOCADO_TAGS + AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \ + $(filter %-softmmu,$(TARGETS))) +else + AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS)) +endif $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) $(call quiet-command, \ @@ -128,8 +133,9 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images $(call quiet-command, \ $(TESTS_VENV_DIR)/bin/python -m avocado \ --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ - --filter-by-tags-include-empty --filter-by-tags-include-empty-key \ - $(AVOCADO_TAGS) \ + $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ + --filter-by-tags-include-empty-key) \ + $(AVOCADO_CMDLINE_TAGS) \ $(if $(GITLAB_CI),,--failfast) tests/acceptance, \ "AVOCADO", "tests/acceptance") From 6676f18fa5e09c437e8aa160befa096415e09aae Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Thu, 23 Sep 2021 13:11:40 -0300 Subject: [PATCH 14/22] docs/devel/testing: add instruction to run a single acceptance test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add instructions to the Acceptance tests section about running a single test file or a test within the test file. Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210923161141.232208-3-willianr@redhat.com> --- docs/devel/testing.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index d1841e35d5..c9f6b97f87 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -754,6 +754,34 @@ may be invoked by running: tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/acceptance/ +Note that if ``make check-acceptance`` was not executed before, it is +possible to create the Python virtual environment with the dependencies +needed running: + + .. code:: + + make check-venv + +It is also possible to run tests from a single file or a single test within +a test file. To run tests from a single file within the build tree, use: + + .. code:: + + tests/venv/bin/avocado run tests/acceptance/$TESTFILE + +To run a single test within a test file, use: + + .. code:: + + tests/venv/bin/avocado run tests/acceptance/$TESTFILE:$TESTCLASS.$TESTNAME + +Valid test names are visible in the output from any previous execution +of Avocado or ``make check-acceptance``, and can also be queried using: + + .. code:: + + tests/venv/bin/avocado list tests/acceptance + Manual Installation ------------------- From 94c714620bede2e03b5a03421c8e8f654817d65d Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Thu, 23 Sep 2021 13:11:41 -0300 Subject: [PATCH 15/22] tests/Makefile: add AVOCADO_TESTS option to make check-acceptance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the possibility of running all the tests from a single file, or multiple files, running a single test within a file or multiple tests within multiple files using `make check-acceptance` and the AVOCADO_TESTS environment variable. Suggested-by: Daniel P. Berrangé Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210923161141.232208-4-willianr@redhat.com> --- docs/devel/testing.rst | 27 +++++++++++++++++++++++++++ tests/Makefile.include | 5 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index c9f6b97f87..64c9744795 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -746,6 +746,33 @@ tags, see: https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/tags.html +To run a single test file, a couple of them, or a test within a file +using the ``make check-acceptance`` command, set the ``AVOCADO_TESTS`` +environment variable with the test files or test names. To run all +tests from a single file, use: + + .. code:: + + make check-acceptance AVOCADO_TESTS=$FILEPATH + +The same is valid to run tests from multiple test files: + + .. code:: + + make check-acceptance AVOCADO_TESTS='$FILEPATH1 $FILEPATH2' + +To run a single test within a file, use: + + .. code:: + + make check-acceptance AVOCADO_TESTS=$FILEPATH:$TESTCLASS.$TESTNAME + +The same is valid to run single tests from multiple test files: + + .. code:: + + make check-acceptance AVOCADO_TESTS='$FILEPATH1:$TESTCLASS1.$TESTNAME1 $FILEPATH2:$TESTCLASS2.$TESTNAME2' + The scripts installed inside the virtual environment may be used without an "activation". For instance, the Avocado test runner may be invoked by running: diff --git a/tests/Makefile.include b/tests/Makefile.include index f6484e5b31..e69c4fae53 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -88,6 +88,9 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES) TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results +ifndef AVOCADO_TESTS + AVOCADO_TESTS=tests/acceptance +endif # Controls the output generated by Avocado when running tests. # Any number of command separated loggers are accepted. For more # information please refer to "avocado --help". @@ -136,7 +139,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ --filter-by-tags-include-empty-key) \ $(AVOCADO_CMDLINE_TAGS) \ - $(if $(GITLAB_CI),,--failfast) tests/acceptance, \ + $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ "AVOCADO", "tests/acceptance") # Consolidated targets From c5f0a81650ada7178865f74dd4b3c9e508b3018e Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 27 Sep 2021 14:48:02 +1000 Subject: [PATCH 16/22] qemu: Split machine_ppc.py acceptance tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit machine_ppc.py contains tests for 3 different ppc based machine types. It is listed in MAINTAINERS along with the PPC TCG cpu code. That's not really accurate though, since it's really more about testing those machines than the CPUs. Therefore, split it up into separate files for the separate machine types, and list those along with their machine types in MAINTAINERS. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210927044808.73391-2-david@gibson.dropbear.id.au> --- MAINTAINERS | 4 +- tests/acceptance/machine_ppc.py | 69 ---------------------------- tests/acceptance/ppc_mpc8544ds.py | 32 +++++++++++++ tests/acceptance/ppc_pseries.py | 35 ++++++++++++++ tests/acceptance/ppc_virtex_ml507.py | 34 ++++++++++++++ 5 files changed, 104 insertions(+), 70 deletions(-) delete mode 100644 tests/acceptance/machine_ppc.py create mode 100644 tests/acceptance/ppc_mpc8544ds.py create mode 100644 tests/acceptance/ppc_pseries.py create mode 100644 tests/acceptance/ppc_virtex_ml507.py diff --git a/MAINTAINERS b/MAINTAINERS index f98523cfe0..bf1fc5b21e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -274,7 +274,6 @@ F: target/ppc/ F: hw/ppc/ F: include/hw/ppc/ F: disas/ppc.c -F: tests/acceptance/machine_ppc.py RISC-V TCG CPUs M: Palmer Dabbelt @@ -1270,6 +1269,7 @@ L: qemu-ppc@nongnu.org S: Odd Fixes F: hw/ppc/mpc8544ds.c F: hw/ppc/mpc8544_guts.c +F: tests/acceptance/ppc_mpc8544ds.py New World (mac99) M: Mark Cave-Ayland @@ -1340,6 +1340,7 @@ F: tests/qtest/spapr* F: tests/qtest/libqos/*spapr* F: tests/qtest/rtas* F: tests/qtest/libqos/rtas* +F: tests/acceptance/ppc_pseries.py PowerNV (Non-Virtualized) M: Cédric Le Goater @@ -1361,6 +1362,7 @@ M: Edgar E. Iglesias L: qemu-ppc@nongnu.org S: Odd Fixes F: hw/ppc/virtex_ml507.c +F: tests/acceptance/ppc_virtex_ml507.py sam460ex M: BALATON Zoltan diff --git a/tests/acceptance/machine_ppc.py b/tests/acceptance/machine_ppc.py deleted file mode 100644 index a836e2496f..0000000000 --- a/tests/acceptance/machine_ppc.py +++ /dev/null @@ -1,69 +0,0 @@ -# Test that Linux kernel boots on ppc machines and check the console -# -# Copyright (c) 2018, 2020 Red Hat, Inc. -# -# 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.utils import archive -from avocado_qemu import Test -from avocado_qemu import wait_for_console_pattern - -class PpcMachine(Test): - - timeout = 90 - KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' - panic_message = 'Kernel panic - not syncing' - - def test_ppc64_pseries(self): - """ - :avocado: tags=arch:ppc64 - :avocado: tags=machine:pseries - """ - kernel_url = ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/29/Everything/ppc64le/os' - '/ppc/ppc64/vmlinuz') - kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' - kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) - - self.vm.set_console() - kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0' - self.vm.add_args('-kernel', kernel_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern = 'Kernel command line: %s' % kernel_command_line - wait_for_console_pattern(self, console_pattern, self.panic_message) - - def test_ppc_mpc8544ds(self): - """ - :avocado: tags=arch:ppc - :avocado: tags=machine:mpc8544ds - """ - tar_url = ('https://www.qemu-advent-calendar.org' - '/2020/download/day17.tar.gz') - tar_hash = '7a5239542a7c4257aa4d3b7f6ddf08fb6775c494' - file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) - archive.extract(file_path, self.workdir) - self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin') - self.vm.launch() - wait_for_console_pattern(self, 'QEMU advent calendar 2020', - self.panic_message) - - def test_ppc_virtex_ml507(self): - """ - :avocado: tags=arch:ppc - :avocado: tags=machine:virtex-ml507 - """ - tar_url = ('https://www.qemu-advent-calendar.org' - '/2020/download/hippo.tar.gz') - tar_hash = '306b95bfe7d147f125aa176a877e266db8ef914a' - file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) - archive.extract(file_path, self.workdir) - self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/hippo/hippo.linux', - '-dtb', self.workdir + '/hippo/virtex440-ml507.dtb', - '-m', '512') - self.vm.launch() - wait_for_console_pattern(self, 'QEMU advent calendar 2020', - self.panic_message) diff --git a/tests/acceptance/ppc_mpc8544ds.py b/tests/acceptance/ppc_mpc8544ds.py new file mode 100644 index 0000000000..ce840600c1 --- /dev/null +++ b/tests/acceptance/ppc_mpc8544ds.py @@ -0,0 +1,32 @@ +# Test that Linux kernel boots on ppc machines and check the console +# +# Copyright (c) 2018, 2020 Red Hat, Inc. +# +# 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.utils import archive +from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern + +class Mpc8544dsMachine(Test): + + timeout = 90 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + panic_message = 'Kernel panic - not syncing' + + def test_ppc_mpc8544ds(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:mpc8544ds + """ + tar_url = ('https://www.qemu-advent-calendar.org' + '/2020/download/day17.tar.gz') + tar_hash = '7a5239542a7c4257aa4d3b7f6ddf08fb6775c494' + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(file_path, self.workdir) + self.vm.set_console() + self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin') + self.vm.launch() + wait_for_console_pattern(self, 'QEMU advent calendar 2020', + self.panic_message) diff --git a/tests/acceptance/ppc_pseries.py b/tests/acceptance/ppc_pseries.py new file mode 100644 index 0000000000..f14a884ee1 --- /dev/null +++ b/tests/acceptance/ppc_pseries.py @@ -0,0 +1,35 @@ +# Test that Linux kernel boots on ppc machines and check the console +# +# Copyright (c) 2018, 2020 Red Hat, Inc. +# +# 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.utils import archive +from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern + +class pseriesMachine(Test): + + timeout = 90 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + panic_message = 'Kernel panic - not syncing' + + def test_ppc64_pseries(self): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:pseries + """ + kernel_url = ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/29/Everything/ppc64le/os' + '/ppc/ppc64/vmlinuz') + kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0' + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + wait_for_console_pattern(self, console_pattern, self.panic_message) diff --git a/tests/acceptance/ppc_virtex_ml507.py b/tests/acceptance/ppc_virtex_ml507.py new file mode 100644 index 0000000000..27f7bf2d49 --- /dev/null +++ b/tests/acceptance/ppc_virtex_ml507.py @@ -0,0 +1,34 @@ +# Test that Linux kernel boots on ppc machines and check the console +# +# Copyright (c) 2018, 2020 Red Hat, Inc. +# +# 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.utils import archive +from avocado_qemu import Test +from avocado_qemu import wait_for_console_pattern + +class VirtexMl507Machine(Test): + + timeout = 90 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + panic_message = 'Kernel panic - not syncing' + + def test_ppc_virtex_ml507(self): + """ + :avocado: tags=arch:ppc + :avocado: tags=machine:virtex-ml507 + """ + tar_url = ('https://www.qemu-advent-calendar.org' + '/2020/download/hippo.tar.gz') + tar_hash = '306b95bfe7d147f125aa176a877e266db8ef914a' + file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(file_path, self.workdir) + self.vm.set_console() + self.vm.add_args('-kernel', self.workdir + '/hippo/hippo.linux', + '-dtb', self.workdir + '/hippo/virtex440-ml507.dtb', + '-m', '512') + self.vm.launch() + wait_for_console_pattern(self, 'QEMU advent calendar 2020', + self.panic_message) From 181e1ab2adfdaaf16ad9fcad9d9ddf92812c9a90 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 24 Sep 2021 14:54:52 -0400 Subject: [PATCH 17/22] Acceptance Tests: improve check-acceptance description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "check-acceptance" make rule won't necessarily run *all* available tests, because it employs a filter based on the currently configured targets. This change in the description of the rule makes that behavior extra clear. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210924185506.2542588-3-crosa@redhat.com> --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index e69c4fae53..7426522bbe 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -16,7 +16,7 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) @echo " $(MAKE) check-tcg Run TCG tests" @echo " $(MAKE) check-softfloat Run FPU emulation tests" endif - @echo " $(MAKE) check-acceptance Run all acceptance (functional) tests" + @echo " $(MAKE) check-acceptance Run acceptance (functional) tests for currently configured targets" @echo @echo " $(MAKE) check-report.tap Generates an aggregated TAP test report" @echo " $(MAKE) check-venv Creates a Python venv for tests" From 0f981d879264de4e5b5c5fccefee154ebee86119 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 24 Sep 2021 14:54:58 -0400 Subject: [PATCH 18/22] acceptance/tests/vnc.py: use explicit syntax for enabling passwords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This matches the command line on 82a17d1d67, where the "on" or "off" should be explicitly given. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210924185506.2542588-9-crosa@redhat.com> --- tests/acceptance/vnc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py index 22656bbcc2..f301fbb4f5 100644 --- a/tests/acceptance/vnc.py +++ b/tests/acceptance/vnc.py @@ -45,7 +45,7 @@ class Vnc(Test): 'Could not set password') def test_change_password(self): - self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password') + self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=on') self.vm.launch() self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled']) set_password_response = self.vm.qmp('change-vnc-password', From 6f1f86cfa7127bacb1ed8f9ba6403393f5a03029 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 24 Sep 2021 14:55:02 -0400 Subject: [PATCH 19/22] tests/acceptance/boot_xen.py: removed unused import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just a clean up for an unused import. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210924185506.2542588-13-crosa@redhat.com> --- tests/acceptance/boot_xen.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/boot_xen.py b/tests/acceptance/boot_xen.py index 3479b5233b..fc2faeedb5 100644 --- a/tests/acceptance/boot_xen.py +++ b/tests/acceptance/boot_xen.py @@ -13,7 +13,6 @@ import os -from avocado import skipIf from avocado_qemu import wait_for_console_pattern from boot_linux_console import LinuxKernelTest From 089f25877fddc583c1002dbeb93d01f4aa02d8f1 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 24 Sep 2021 14:55:04 -0400 Subject: [PATCH 20/22] tests/acceptance/ppc_prep_40p.py: NetBSD 7.1.2 location update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NetBSD-7.1.2-prep.iso is no longer available on the CDN, but it's still available in the archive. Let's update its location so that users without the file on cache can still fetch it and run the test. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210924185506.2542588-15-crosa@redhat.com> --- tests/acceptance/ppc_prep_40p.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py index 2993ee3b07..6b28a69ea5 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/acceptance/ppc_prep_40p.py @@ -67,8 +67,8 @@ class IbmPrep40pMachine(Test): :avocado: tags=machine:40p :avocado: tags=os:netbsd """ - drive_url = ('https://cdn.netbsd.org/pub/NetBSD/iso/7.1.2/' - 'NetBSD-7.1.2-prep.iso') + drive_url = ('https://archive.netbsd.org/pub/NetBSD-archive/' + 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso') drive_hash = 'ac6fa2707d888b36d6fa64de6e7fe48e' drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash, algorithm='md5') From 3d2ec56550e5743f49213bddff3954b4490a45fb Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 24 Sep 2021 14:55:05 -0400 Subject: [PATCH 21/22] tests/acceptance/ppc_prep_40p.py: clean up unused import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just a removal of an unused imported symbol. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210924185506.2542588-16-crosa@redhat.com> --- tests/acceptance/ppc_prep_40p.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py index 6b28a69ea5..5e61e686bd 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/acceptance/ppc_prep_40p.py @@ -7,7 +7,6 @@ import os -from avocado import skipIf from avocado import skipUnless from avocado_qemu import Test from avocado_qemu import wait_for_console_pattern From 4c5fc0c5fc496c147adb15536e4ac808feccf2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Tue, 17 Aug 2021 11:30:36 +0200 Subject: [PATCH 22/22] tests/acceptance: Test powernv machines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fetch the OpenPOWER images to boot the powernv8 and powernv9 machines with a simple PCI layout. Cc: Cleber Rosa Cc: Philippe Mathieu-Daudé Cc: Wainer dos Santos Moschetta Signed-off-by: Cédric Le Goater Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210817093036.1288791-1-clg@kaod.org> --- tests/acceptance/boot_linux_console.py | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 0a49c0e276..06fc967f6c 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -1176,6 +1176,41 @@ class BootLinuxConsole(LinuxKernelTest): tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' self.do_test_advcal_2018('19', tar_hash, 'uImage') + def do_test_ppc64_powernv(self, proc): + images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/') + + kernel_url = images_url + 'zImage.epapr' + kernel_hash = '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash, + algorithm='sha256') + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path, + '-append', 'console=tty0 console=hvc0', + '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0', + '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234', + '-device', 'e1000e,bus=bridge1,addr=0x3', + '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2') + self.vm.launch() + + self.wait_for_console_pattern("CPU: " + proc + " generation processor") + self.wait_for_console_pattern("zImage starting: loaded") + self.wait_for_console_pattern("Run /init as init process") + self.wait_for_console_pattern("Creating 1 MTD partitions") + + def test_ppc_powernv8(self): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:powernv8 + """ + self.do_test_ppc64_powernv('P8') + + def test_ppc_powernv9(self): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:powernv9 + """ + self.do_test_ppc64_powernv('P9') + def test_ppc_g3beige(self): """ :avocado: tags=arch:ppc