From 59692a1238f7f1e0afa85f67ae15a664f786ece0 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:05 -0400 Subject: tests/acceptance: show avocado test execution by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current version of the "check-acceptance" target will only show one line for execution of all tests. That's probably OK if the tests to be run are quick enough and they're always the same. But, there's already one test alone that takes on average ~5 seconds to run, we intend to adapt the list of tests to match the user's build environment (among other choices). Because of that, let's present the default Avocado UI by default. Users can always choose a different output by setting the AVOCADO_SHOW variable. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-2-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index e2432d5..445aa0b 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1133,7 +1133,7 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results # 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". -AVOCADO_SHOW=none +AVOCADO_SHOW=app ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2) $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) -- cgit v1.1 From 45c01bd926ec072a9ec54b2fdd780917dd7786b5 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:06 -0400 Subject: tests/acceptance: improve docstring on pick_default_qemu_bin() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Making it clear what is returned by this utility function. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-3-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/avocado_qemu/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index a66ec72..b7c5d59 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -27,6 +27,10 @@ def pick_default_qemu_bin(): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. + + :returns: the path to the default QEMU binary or None if one could not + be found + :rtype: str or None """ arch = os.uname()[4] qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, -- cgit v1.1 From 2c44d68f2b004e41136996fef0e4122e6507ba90 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:08 -0400 Subject: tests/acceptance: introduce arch parameter and attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's useful to define the architecture that should be used in situations such as: * the intended target of the QEMU binary to be used on tests * the architecture of code to be run within the QEMU binary, such as a kernel image or a full blown guest OS image This commit introduces both a test parameter and a test instance attribute, that will contain such a value. Now, when the "arch" test parameter is given, it will influence the selection of the default QEMU binary, if one is not given explicitly by means of the "qemu_img" parameter. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-5-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/avocado_qemu/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index b7c5d59..688a074 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -23,16 +23,22 @@ 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(): +def pick_default_qemu_bin(arch=None): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. + :param arch: the arch to use when looking for a QEMU binary (the target + will match the arch given). If None (the default), arch + will be the current host system arch (as given by + :func:`os.uname`). + :type arch: str :returns: the path to the default QEMU binary or None if one could not be found :rtype: str or None """ - arch = os.uname()[4] + if arch is None: + arch = os.uname()[4] qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, "qemu-system-%s" % arch) if is_readable_executable_file(qemu_bin_relative_path): @@ -47,8 +53,10 @@ def pick_default_qemu_bin(): class Test(avocado.Test): def setUp(self): self._vms = {} + self.arch = self.params.get('arch') + default_qemu_bin = pick_default_qemu_bin(arch=self.arch) self.qemu_bin = self.params.get('qemu_bin', - default=pick_default_qemu_bin()) + default=default_qemu_bin) if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") -- cgit v1.1 From b194713f94b286fd1f2bccace45cb5b25316e232 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:09 -0400 Subject: tests/acceptance: use "arch:" tag to filter target specific tests Currently, some tests contains target architecture information, in the form of a "x86_64" tag. But that tag is not respected in the default execution, that is, "make check-acceptance" doesn't do anything with it. That said, even the target architecture handling currently present in the "avocado_qemu.Test" class is pretty limited. For instance, by default, it chooses a target based on the host architecture. Because the original implementation of the tags feature in Avocado did not include any time of namespace or "key:val" mechanism, no tag has relation to another tag. The new implementation of the tags feature from version 67.0 onwards, allows "key:val" tags, and because of that, a test can be classified with a tag in a given key. For instance, the new proposed version of the "boot_linux_console.py" test, which downloads and attempts to run a x86_64 kernel, is now tagged as: :avocado: tags=arch:x86_64 This means that it can be filtered (out) when no x86_64 target is available. At the same time, tests that don't have a "arch:" tag, will not be filtered out. Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-6-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/Makefile.include | 3 +++ tests/acceptance/boot_linux_console.py | 2 +- tests/acceptance/linux_initrd.py | 2 +- tests/acceptance/virtio_version.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 445aa0b..7c8b9c8 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1134,6 +1134,7 @@ 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,$(TARGET_DIRS))) ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2) $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) @@ -1159,6 +1160,8 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) $(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) \ --failfast=on $(SRC_PATH)/tests/acceptance, \ "AVOCADO", "tests/acceptance") diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index beeb1e5..fa4594f 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -18,7 +18,7 @@ class BootLinuxConsole(Test): Boots a x86_64 Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kernel - :avocado: tags=x86_64 + :avocado: tags=arch:x86_64 """ timeout = 60 diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py index fbdb48e..23be5a6 100644 --- a/tests/acceptance/linux_initrd.py +++ b/tests/acceptance/linux_initrd.py @@ -19,7 +19,7 @@ class LinuxInitrd(Test): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option. - :avocado: tags=x86_64 + :avocado: tags=arch:x86_64 """ timeout = 300 diff --git a/tests/acceptance/virtio_version.py b/tests/acceptance/virtio_version.py index 37fc01e..8b97453 100644 --- a/tests/acceptance/virtio_version.py +++ b/tests/acceptance/virtio_version.py @@ -61,7 +61,7 @@ class VirtioVersionCheck(Test): same device tree created by `disable-modern` and `disable-legacy`. - :avocado: tags=x86_64 + :avocado: tags=arch:x86_64 """ # just in case there are failures, show larger diff: -- cgit v1.1 From b910545fbf3f55f22545c202c1aee62598edb838 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:10 -0400 Subject: tests/acceptance: look for target architecture in test tags first A test can, optionally, be tagged for one or many architectures. If a test has been tagged for a single architecture, there's a high chance that the test won't run on other architectures. This changes the default order of choosing a default target architecture to use based on the 'arch' tag value first. The precedence order is for choosing a QEMU binary to use for a test is now: * qemu_bin parameter * arch parameter * arch tag value (for example, x86_64 if ":avocado: tags=arch:x86_64 is used) This means that if one runs: $ avocado run -p qemu_bin=/usr/bin/qemu-system-x86_64 test.py No arch parameter or tag will influence the selection of the QEMU target binary. If one runs: $ avocado run -p arch=ppc64 test.py The target binary selection mechanism will attempt to find a binary such as "ppc64-softmmu/qemu-system-ppc64". And finally, if one runs a test that is tagged (in its docstring) with "arch:aarch64": $ avocado run aarch64.py The target binary selection mechanism will attempt to find a binary such as "aarch64-softmmu/qemu-system-aarch64". At this time, no provision is made to cancel the execution of tests if the arch parameter given (manually) does not match the test "arch" tag, but it may be a useful default behavior to be added in the future. Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-7-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/avocado_qemu/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 688a074..2b236a1 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -53,7 +53,12 @@ def pick_default_qemu_bin(arch=None): class Test(avocado.Test): def setUp(self): self._vms = {} - self.arch = self.params.get('arch') + 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) self.qemu_bin = self.params.get('qemu_bin', default=default_qemu_bin) -- cgit v1.1 From 78664ed84949fef4cc0a8be45dd1968e5713e18c Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:11 -0400 Subject: tests/boot_linux_console: rename the x86_64 after the arch and machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Given that the test is specific to x86_64 and pc, and new tests are going to be added to the same class, let's rename it accordingly. Also, let's make the class documentation not architecture specific. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-8-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index fa4594f..4d57741 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -15,15 +15,17 @@ from avocado_qemu import Test class BootLinuxConsole(Test): """ - Boots a x86_64 Linux kernel and checks that the console is operational - and the kernel command line is properly passed from QEMU to the kernel - - :avocado: tags=arch:x86_64 + Boots a Linux kernel and checks that the console is operational and the + kernel command line is properly passed from QEMU to the kernel """ timeout = 60 - def test(self): + def test_x86_64_pc(self): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:pc + """ kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/' 'Everything/x86_64/os/images/pxeboot/vmlinuz') kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a' -- cgit v1.1 From 7d7985b1613345541df7c7fc032e470c71cba942 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:12 -0400 Subject: tests/boot_linux_console: update the x86_64 kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update to the stock Fedora 29 kernel, from the Fedora 28. New tests will be added using the 29 kernel, so for consistency, let's also update it here. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Cornelia Huck CC: Daniel P. Berrangé Message-Id: <20190312171824.5134-9-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 4d57741..03a4445 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -26,9 +26,9 @@ class BootLinuxConsole(Test): :avocado: tags=arch:x86_64 :avocado: tags=machine:pc """ - kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/' - 'Everything/x86_64/os/images/pxeboot/vmlinuz') - kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a' + kernel_url = ('https://download.fedoraproject.org/pub/fedora/linux/' + 'releases/29/Everything/x86_64/os/images/pxeboot/vmlinuz') + kernel_hash = '23bebd2680757891cf7adedb033532163a792495' kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) self.vm.set_machine('pc') -- cgit v1.1 From b50fcd39ba077465852870c17687df17227759a5 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:13 -0400 Subject: tests/boot_linux_console: add common kernel command line options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'printk.time=0' option makes it easier to parse the console output. Let's set it as a default, and reusable, kernel command line options for this and future similar tests. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-10-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 03a4445..a94f5cd 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -21,6 +21,8 @@ class BootLinuxConsole(Test): timeout = 60 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + def test_x86_64_pc(self): """ :avocado: tags=arch:x86_64 @@ -33,7 +35,7 @@ class BootLinuxConsole(Test): self.vm.set_machine('pc') self.vm.set_console() - kernel_command_line = 'console=ttyS0' + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' self.vm.add_args('-kernel', kernel_path, '-append', kernel_command_line) self.vm.launch() -- cgit v1.1 From 61f74506623186f076233dc5d5a8d92f4f8235dd Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:14 -0400 Subject: tests/boot_linux_console: increase timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running on very low powered environments, some tests may time out causing false negatives. As a conservative change, and for considering that human time (investigating false negatives) is worth more than some extra machine cycles (and time), let's increase the overall timeout. CC: Alex Bennée Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-11-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index a94f5cd..bfcae37 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -19,7 +19,7 @@ class BootLinuxConsole(Test): kernel command line is properly passed from QEMU to the kernel """ - timeout = 60 + timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' -- cgit v1.1 From 0d1d74e5e572034abb90c5b187ff3b2edd778960 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:15 -0400 Subject: tests/boot_linux_console: refactor the console watcher into utility method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a utility method that monitors the console device and looks for either a message that signals the test success or failure. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-12-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index bfcae37..32f1d4d 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -23,6 +23,25 @@ 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() + 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 test_x86_64_pc(self): """ :avocado: tags=arch:x86_64 @@ -39,12 +58,5 @@ class BootLinuxConsole(Test): self.vm.add_args('-kernel', kernel_path, '-append', kernel_command_line) self.vm.launch() - console = self.vm.console_socket.makefile() - console_logger = logging.getLogger('console') - while True: - msg = console.readline() - console_logger.debug(msg.strip()) - if 'Kernel command line: %s' % kernel_command_line in msg: - break - if 'Kernel panic - not syncing' in msg: - self.fail("Kernel panic reached") + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From f87920474d29e48c7548e6e826c3d50a259f2599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 12 Mar 2019 13:18:17 -0400 Subject: tests/boot_linux_console: add a test for mips + malta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the x86_64 + pc test, it boots a Linux kernel on a Malta board and verify the serial is working. Also, it relies on the serial device set by the machine itself. 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 run -t arch:mips tests/acceptance $ avocado run -t machine:malta tests/acceptance $ avocado run -t endian:big tests/acceptance Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Cleber Rosa Reviewed-by: Aleksandar Markovic Tested-by: Philippe Mathieu-Daudé Message-Id: <20190312171824.5134-14-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 32f1d4d..028fefd 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -8,9 +8,12 @@ # 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_qemu import Test +from avocado.utils import process +from avocado.utils import archive class BootLinuxConsole(Test): @@ -42,6 +45,21 @@ class BootLinuxConsole(Test): fail = 'Failure message found in console: %s' % failure_message self.fail(fail) + def extract_from_deb(self, deb, path): + """ + Extracts a file from a deb package into the test workdir + + :param deb: path to the deb archive + :param file: path within the deb archive of the file to be extracted + :returns: path of the extracted file + """ + cwd = os.getcwd() + os.chdir(self.workdir) + process.run("ar x %s data.tar.gz" % deb) + archive.extract("data.tar.gz", self.workdir) + os.chdir(cwd) + return self.workdir + path + def test_x86_64_pc(self): """ :avocado: tags=arch:x86_64 @@ -60,3 +78,26 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_mips_malta(self): + """ + :avocado: tags=arch:mips + :avocado: tags=machine:malta + :avocado: tags=endian:big + """ + deb_url = ('http://snapshot.debian.org/archive/debian/' + '20130217T032700Z/pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinux-2.6.32-5-4kc-malta') + + self.vm.set_machine('malta') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From 02c2852bcd8fadea3d81c380bdaeaee1ae91247f Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:18 -0400 Subject: tests/boot_linux_console: add a test for mips64el + malta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the x86_64 + pc test, it boots a Linux kernel on a Malta board and verify the serial is working. If mips64el is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:mips64el" tags. Alternatively, this test can be run using: $ avocado run -t arch:mips64el tests/acceptance $ avocado run -t machine:malta tests/acceptance Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Cleber Rosa Reviewed-by: Aleksandar Markovic Message-Id: <20190312171824.5134-15-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 028fefd..38b33b2 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -101,3 +101,36 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_mips64el_malta(self): + """ + This test requires the ar tool to extract "data.tar.gz" from + the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/ + #linux-source-2.6.32_2.6.32-48 + [2] https://kernel-team.pages.debian.net/kernel-handbook/ + ch-common-tasks.html#s-common-official + + :avocado: tags=arch:mips64el + :avocado: tags=machine:malta + """ + deb_url = ('http://snapshot.debian.org/archive/debian/' + '20130217T032700Z/pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb') + deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinux-2.6.32-5-5kc-malta') + + self.vm.set_machine('malta') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From d4e12161677bbad86079d15236f1d449cc860978 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:21 -0400 Subject: tests/boot_linux_console: add a test for aarch64 + virt Just like the previous tests, boots a Linux kernel on a aarch64 target using the virt machine. One special option added is the CPU type, given that the kernel selected fails to boot on the virt machine's default CPU (cortex-a15). Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Message-Id: <20190312171824.5134-18-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 38b33b2..6d93629 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -134,3 +134,24 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_aarch64_virt(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt + """ + kernel_url = ('https://download.fedoraproject.org/pub/fedora/linux/' + 'releases/29/Everything/aarch64/os/images/pxeboot/vmlinuz') + kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyAMA0') + self.vm.add_args('-cpu', 'cortex-a53', + '-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From 1a30892ed5f253f6bf7adbe56ef5931bd69cd4b6 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:22 -0400 Subject: tests/boot_linux_console: add a test for arm + virt Just like the previous tests, boots a Linux kernel on an arm target using the virt machine. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Message-Id: <20190312171824.5134-19-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 6d93629..54b6e26 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -155,3 +155,23 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_arm_virt(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:virt + """ + kernel_url = ('https://download.fedoraproject.org/pub/fedora/linux/' + 'releases/29/Everything/armhfp/os/images/pxeboot/vmlinuz') + kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyAMA0') + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From 7918249416dddc5ab2d4bcb1e6c2742f3be0edac Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:23 -0400 Subject: tests/boot_linux_console: add a test for s390x + s390-ccw-virtio Just like the previous tests, boots a Linux kernel on a s390x target using the s390-ccw-virtio machine. Because it's not possible to have multiple VT220 consoles, '-nodefaults' is used, so that the one set with set_console() works correctly. Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck Reviewed-by: Caio Carrara Message-Id: <20190312171824.5134-20-crosa@redhat.com> [ehabkost: Updated kernel URL to point to fedoraproject.org] Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 54b6e26..7c1099e 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -175,3 +175,23 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_s390x_s390_ccw_virtio(self): + """ + :avocado: tags=arch:s390x + :avocado: tags=machine:s390_ccw_virtio + """ + kernel_url = ('https://download.fedoraproject.org/pub/fedora-secondary/' + 'releases/29/Everything/s390x/os/images/kernel.img') + kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('s390-ccw-virtio') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0' + self.vm.add_args('-nodefaults', + '-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1 From b36b59371fbb39ae39645b16db85f9a49573309d Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:24 -0400 Subject: tests/boot_linux_console: add a test for alpha + clipper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the x86_64 + pc test, it boots a Linux kernel on a Malta board and verify the serial is working. One extra command added to the QEMU command line is '-vga std', because the kernel used is known to crash without it. If alpha is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:alpha" tags. Alternatively, this test can be run using: $ avocado run -t arch:alpha tests/acceptance $ avocado run -t machine:clipper tests/acceptance Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Message-Id: <20190312171824.5134-21-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/boot_linux_console.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 7c1099e..d5c500e 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -195,3 +195,25 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + 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/current/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) + + self.vm.set_machine('clipper') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' + self.vm.add_args('-vga', 'std', + '-kernel', uncompressed_kernel, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) -- cgit v1.1