From 162127f29f2a5a628ecea79d4718d3a51b1bffac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 21 Oct 2020 12:33:25 +0200 Subject: tests/acceptance: Extract tesseract_available() helper in new namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are going to reuse tesseract_available(). Extract it to a new 'tesseract_utils' namespace. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20201021105035.2477784-4-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/machine_m68k_nextcube.py | 25 +++---------------------- tests/acceptance/tesseract_utils.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 tests/acceptance/tesseract_utils.py diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/machine_m68k_nextcube.py index 2baba5fdc2..3c7400c43e 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -1,19 +1,19 @@ # Functional test that boots a VM and run OCR on the framebuffer # -# Copyright (c) Philippe Mathieu-Daudé +# Copyright (c) 2019 Philippe Mathieu-Daudé # # 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 re import time import logging from avocado_qemu import Test from avocado import skipUnless from avocado.utils import process -from avocado.utils.path import find_command, CmdNotFoundError + +from tesseract_utils import tesseract_available PIL_AVAILABLE = True try: @@ -22,25 +22,6 @@ except ImportError: PIL_AVAILABLE = False -def tesseract_available(expected_version): - try: - find_command('tesseract') - except CmdNotFoundError: - return False - res = process.run('tesseract --version') - try: - version = res.stdout_text.split()[1] - except IndexError: - version = res.stderr_text.split()[1] - return int(version.split('.')[0]) == expected_version - - match = re.match(r'tesseract\s(\d)', res) - if match is None: - return False - # now this is guaranteed to be a digit - return int(match.groups()[0]) == expected_version - - class NextCubeMachine(Test): """ :avocado: tags=arch:m68k diff --git a/tests/acceptance/tesseract_utils.py b/tests/acceptance/tesseract_utils.py new file mode 100644 index 0000000000..acd6e8c2fa --- /dev/null +++ b/tests/acceptance/tesseract_utils.py @@ -0,0 +1,28 @@ +# ... +# +# Copyright (c) 2019 Philippe Mathieu-Daudé +# +# 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 re + +from avocado.utils.path import find_command, CmdNotFoundError + +def tesseract_available(expected_version): + try: + find_command('tesseract') + except CmdNotFoundError: + return False + res = process.run('tesseract --version') + try: + version = res.stdout_text.split()[1] + except IndexError: + version = res.stderr_text.split()[1] + return int(version.split('.')[0]) == expected_version + + match = re.match(r'tesseract\s(\d)', res) + if match is None: + return False + # now this is guaranteed to be a digit + return int(match.groups()[0]) == expected_version -- cgit v1.2.3 From ca8224492854a2930d0cadc76e715bf59582bf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 21 Oct 2020 12:35:30 +0200 Subject: tests/acceptance: Introduce tesseract_ocr() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are going to reuse the tesseract OCR code. Create a new tesseract_ocr() helper and use it. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201021105035.2477784-5-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/machine_m68k_nextcube.py | 21 +++++---------------- tests/acceptance/tesseract_utils.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/machine_m68k_nextcube.py index 3c7400c43e..09e2745cc5 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -7,13 +7,11 @@ import os import time -import logging from avocado_qemu import Test from avocado import skipUnless -from avocado.utils import process -from tesseract_utils import tesseract_available +from tesseract_utils import tesseract_available, tesseract_ocr PIL_AVAILABLE = True try: @@ -61,12 +59,8 @@ class NextCubeMachine(Test): def test_bootrom_framebuffer_ocr_with_tesseract_v3(self): screenshot_path = os.path.join(self.workdir, "dump.ppm") self.check_bootrom_framebuffer(screenshot_path) - - console_logger = logging.getLogger('console') - text = process.run("tesseract %s stdout" % screenshot_path).stdout_text - for line in text.split('\n'): - if len(line): - console_logger.debug(line) + lines = tesseract_ocr(screenshot_path, tesseract_version=3) + text = '\n'.join(lines) self.assertIn('Backplane', text) self.assertIn('Ethernet address', text) @@ -77,13 +71,8 @@ class NextCubeMachine(Test): def test_bootrom_framebuffer_ocr_with_tesseract_v4(self): screenshot_path = os.path.join(self.workdir, "dump.ppm") self.check_bootrom_framebuffer(screenshot_path) - - console_logger = logging.getLogger('console') - proc = process.run("tesseract --oem 1 %s stdout" % screenshot_path) - text = proc.stdout_text - for line in text.split('\n'): - if len(line): - console_logger.debug(line) + lines = tesseract_ocr(screenshot_path, tesseract_version=4) + text = '\n'.join(lines) self.assertIn('Testing the FPU, SCC', text) self.assertIn('System test failed. Error code', text) self.assertIn('Boot command', text) diff --git a/tests/acceptance/tesseract_utils.py b/tests/acceptance/tesseract_utils.py index acd6e8c2fa..72cd9ab798 100644 --- a/tests/acceptance/tesseract_utils.py +++ b/tests/acceptance/tesseract_utils.py @@ -6,7 +6,9 @@ # later. See the COPYING file in the top-level directory. import re +import logging +from avocado.utils import process from avocado.utils.path import find_command, CmdNotFoundError def tesseract_available(expected_version): @@ -26,3 +28,19 @@ def tesseract_available(expected_version): return False # now this is guaranteed to be a digit return int(match.groups()[0]) == expected_version + + +def tesseract_ocr(image_path, tesseract_args='', tesseract_version=3): + console_logger = logging.getLogger('tesseract') + console_logger.debug(image_path) + if tesseract_version == 4: + tesseract_args += ' --oem 1' + proc = process.run("tesseract {} {} stdout".format(tesseract_args, + image_path)) + lines = [] + for line in proc.stdout_text.split('\n'): + sline = line.strip() + if len(sline): + console_logger.debug(sline) + lines += [sline] + return lines -- cgit v1.2.3 From 108a76da763aa33a72842c5d0785f5523067bfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 23 Oct 2020 12:56:25 +0200 Subject: tests/acceptance: Extract do_test_arm_orangepi_armbian_uboot() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As we want to reuse the same U-Boot test for multiple Armbian releases, extract the common part as do_test_arm_orangepi_armbian_uboot(). Signed-off-by: Philippe Mathieu-Daudé Tested-by: Bin Meng Tested-by: Niek Linnenbank Message-Id: <20201023131808.3198005-4-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 45 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index fb41bb7144..46835e49df 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -802,27 +802,7 @@ class BootLinuxConsole(LinuxKernelTest): # Wait for VM to shut down gracefully self.vm.wait() - @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'), - 'Test artifacts fetched from unreliable dl.armbian.com') - @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') - @skipUnless(P7ZIP_AVAILABLE, '7z not installed') - def test_arm_orangepi_bionic(self): - """ - :avocado: tags=arch:arm - :avocado: tags=machine:orangepi-pc - :avocado: tags=device:sd - """ - - # This test download a 196MB compressed image and expand it to 1GB - image_url = ('https://dl.armbian.com/orangepipc/archive/' - 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z') - image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e' - image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash) - image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img' - image_path = os.path.join(self.workdir, image_name) - process.run("7z e -o%s %s" % (self.workdir, image_path_7z)) - image_pow2ceil_expand(image_path) - + def do_test_arm_orangepi_uboot_armbian(self, image_path): self.vm.set_console() self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', '-nic', 'user', @@ -848,6 +828,29 @@ class BootLinuxConsole(LinuxKernelTest): 'to ') self.wait_for_console_pattern('Starting Load Kernel Modules...') + @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'), + 'Test artifacts fetched from unreliable apt.armbian.com') + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') + @skipUnless(P7ZIP_AVAILABLE, '7z not installed') + def test_arm_orangepi_bionic_19_11(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + :avocado: tags=device:sd + """ + + # This test download a 196MB compressed image and expand it to 1GB + image_url = ('https://dl.armbian.com/orangepipc/archive/' + 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z') + image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e' + image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash) + image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img' + image_path = os.path.join(self.workdir, image_name) + process.run("7z e -o%s %s" % (self.workdir, image_path_7z)) + image_pow2ceil_expand(image_path) + + self.do_test_arm_orangepi_uboot_armbian(image_path) + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') def test_arm_orangepi_uboot_netbsd9(self): """ -- cgit v1.2.3 From 093aac4ab2059d02bc137476198cdd5791ab0b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 23 Oct 2020 13:00:17 +0200 Subject: tests/acceptance: Test U-Boot/Linux from Armbian 20.08 on Orange Pi PC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test U-Boot and Linux on the recent Armbian release 20.08. Suggested-by: Cleber Rosa Tested-by: Niek Linnenbank Tested-by: Bin Meng Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201023131808.3198005-5-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 46835e49df..128ed5500f 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -851,6 +851,31 @@ class BootLinuxConsole(LinuxKernelTest): self.do_test_arm_orangepi_uboot_armbian(image_path) + @skipUnless(os.getenv('ARMBIAN_ARTIFACTS_CACHED'), + 'Test artifacts fetched from unreliable apt.armbian.com') + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') + def test_arm_orangepi_bionic_20_08(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + :avocado: tags=device:sd + """ + + # This test download a 275 MiB compressed image and expand it + # to 1036 MiB, but the underlying filesystem is 1552 MiB... + # As we expand it to 2 GiB we are safe. + + image_url = ('https://dl.armbian.com/orangepipc/archive/' + 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz') + image_hash = ('b4d6775f5673486329e45a0586bf06b6' + 'dbe792199fd182ac6b9c7bb6c7d3e6dd') + image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash, + algorithm='sha256') + image_path = archive.extract(image_path_xz, self.workdir) + image_pow2ceil_expand(image_path) + + self.do_test_arm_orangepi_uboot_armbian(image_path) + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') def test_arm_orangepi_uboot_netbsd9(self): """ -- cgit v1.2.3 From c592f70cae94faef7c9f915ce49d4b8edb6d71ea Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 12 Jan 2021 17:40:43 +0100 Subject: tests/acceptance: Move the pseries test to a separate file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's gather the POWER-related tests in a separate file. Signed-off-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Acked-by: David Gibson Message-Id: <20210112164045.98565-2-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + tests/acceptance/boot_linux_console.py | 19 ------------------- tests/acceptance/machine_ppc.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 tests/acceptance/machine_ppc.py diff --git a/MAINTAINERS b/MAINTAINERS index 8d8b0bf966..9543d7c44a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -281,6 +281,7 @@ 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 diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 128ed5500f..c34075d537 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -1004,25 +1004,6 @@ class BootLinuxConsole(LinuxKernelTest): console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) - 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 - self.wait_for_console_pattern(console_pattern) - def test_m68k_q800(self): """ :avocado: tags=arch:m68k diff --git a/tests/acceptance/machine_ppc.py b/tests/acceptance/machine_ppc.py new file mode 100644 index 0000000000..51bbfd411c --- /dev/null +++ b/tests/acceptance/machine_ppc.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_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) -- cgit v1.2.3 From 46c647e69d6525c63bc235d96b5956130dc3f04f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 12 Jan 2021 17:40:44 +0100 Subject: tests/acceptance: Test the mpc8544ds machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can use the "Stupid creek" image to test the mpc8544ds ppc machine. Signed-off-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Acked-by: David Gibson Message-Id: <20210112164045.98565-3-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/machine_ppc.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/acceptance/machine_ppc.py b/tests/acceptance/machine_ppc.py index 51bbfd411c..71025d296c 100644 --- a/tests/acceptance/machine_ppc.py +++ b/tests/acceptance/machine_ppc.py @@ -5,6 +5,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. +from avocado.utils import archive from avocado_qemu import Test from avocado_qemu import wait_for_console_pattern @@ -32,3 +33,19 @@ class PpcMachine(Test): 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) -- cgit v1.2.3 From 299ab1b0cef9b7aacf3658ed9b6f16d4870c2778 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 12 Jan 2021 17:40:45 +0100 Subject: tests/acceptance: Add a test for the virtex-ml507 ppc machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "And a hippo new year" image from the QEMU advent calendar 2020 can be used to test the virtex-ml507 ppc machine. Signed-off-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Acked-by: David Gibson Message-Id: <20210112164045.98565-4-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/machine_ppc.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/acceptance/machine_ppc.py b/tests/acceptance/machine_ppc.py index 71025d296c..a836e2496f 100644 --- a/tests/acceptance/machine_ppc.py +++ b/tests/acceptance/machine_ppc.py @@ -49,3 +49,21 @@ class PpcMachine(Test): 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) -- cgit v1.2.3 From ee6c14d0166c9a2fa2bf849d8e09fffdda4de31f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 28 Jan 2021 16:28:15 +0100 Subject: tests/acceptance: Re-enable the microblaze test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The microblaze kernel sometimes gets stuck during boot (ca. 1 out of 200 times), so we disabled the corresponding acceptance tests some months ago. However, it's likely better to check that the kernel is still starting than to not testing it at all anymore. Move the test to a separate file, enable it again and check for an earlier console message that should always appear. Signed-off-by: Thomas Huth Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20210128152815.585478-1-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + tests/acceptance/boot_linux_console.py | 9 --------- tests/acceptance/machine_microblaze.py | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 tests/acceptance/machine_microblaze.py diff --git a/MAINTAINERS b/MAINTAINERS index 9543d7c44a..99621abf8d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1119,6 +1119,7 @@ M: Edgar E. Iglesias S: Maintained F: hw/microblaze/petalogix_s3adsp1800_mmu.c F: include/hw/char/xilinx_uartlite.h +F: tests/acceptance/machine_microblaze.py petalogix_ml605 M: Edgar E. Iglesias diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index c34075d537..eb01286799 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -1056,15 +1056,6 @@ class BootLinuxConsole(LinuxKernelTest): tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c' self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf') - @skip("Test currently broken") # Console stuck as of 5.2-rc1 - def test_microblaze_s3adsp1800(self): - """ - :avocado: tags=arch:microblaze - :avocado: tags=machine:petalogix-s3adsp1800 - """ - tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' - self.do_test_advcal_2018('17', tar_hash, 'ballerina.bin') - def test_or1k_sim(self): """ :avocado: tags=arch:or1k diff --git a/tests/acceptance/machine_microblaze.py b/tests/acceptance/machine_microblaze.py new file mode 100644 index 0000000000..7f6d18495d --- /dev/null +++ b/tests/acceptance/machine_microblaze.py @@ -0,0 +1,35 @@ +# Functional test that boots a microblaze Linux kernel and checks the console +# +# Copyright (c) 2018, 2021 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_qemu import Test +from avocado_qemu import wait_for_console_pattern +from avocado.utils import archive + +class MicroblazeMachine(Test): + + timeout = 90 + + def test_microblaze_s3adsp1800(self): + """ + :avocado: tags=arch:microblaze + :avocado: tags=machine:petalogix-s3adsp1800 + """ + + tar_url = ('https://www.qemu-advent-calendar.org' + '/2018/download/day17.tar.xz') + tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' + 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 + '/day17/ballerina.bin') + self.vm.launch() + wait_for_console_pattern(self, 'This architecture does not have ' + 'kernel memory protection') + # Note: + # The kernel sometimes gets stuck after the "This architecture ..." + # message, that's why we don't test for a later string here. This + # needs some investigation by a microblaze wizard one day... -- cgit v1.2.3 From 834736c9d1fa5623bd600b46c36cc6c46e7cefe1 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:36 -0500 Subject: tests/acceptance/boot_linux: fix typo on cloudinit error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cleber Rosa Reviewed-by: Alex Bennée Reviewed-by: Beraldo Leal Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210203172357.1422425-2-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py index 1da4a53d6a..2ac3e57587 100644 --- a/tests/acceptance/boot_linux.py +++ b/tests/acceptance/boot_linux.py @@ -70,7 +70,7 @@ class BootLinuxBase(Test): phone_home_port=self.phone_home_port, authorized_key=ssh_pubkey) except Exception: - self.cancel('Failed to prepared cloudinit image') + self.cancel('Failed to prepare the cloudinit image') return cloudinit_iso class BootLinux(BootLinuxBase): -- cgit v1.2.3 From b5a86c482d9c18b594b7dc8c37acc5bc72c4279a Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:37 -0500 Subject: tests/acceptance/boot_linux: rename misleading cloudinit method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no downloading happening on that method, so let's call it "prepare" instead. While at it, and because of it, the current "prepare_boot" and "prepare_cloudinit" are also renamed. The reasoning here is that "prepare_" methods will just work on the images, while "set_up_" will make them effective to the VM that will be launched. Inspiration comes from the "virtiofs_submounts.py" tests, which this expects to converge more into. Signed-off-by: Cleber Rosa Reviewed-by: Alex Bennée Reviewed-by: Beraldo Leal Reviewed-by: Thomas Huth Message-Id: <20210203172357.1422425-3-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py index 2ac3e57587..bcd923bb4a 100644 --- a/tests/acceptance/boot_linux.py +++ b/tests/acceptance/boot_linux.py @@ -57,7 +57,7 @@ class BootLinuxBase(Test): self.cancel('Failed to download/prepare boot image') return boot.path - def download_cloudinit(self, ssh_pubkey=None): + def prepare_cloudinit(self, ssh_pubkey=None): self.log.info('Preparing cloudinit image') try: cloudinit_iso = os.path.join(self.workdir, 'cloudinit.iso') @@ -85,15 +85,15 @@ class BootLinux(BootLinuxBase): super(BootLinux, self).setUp() self.vm.add_args('-smp', '2') self.vm.add_args('-m', '1024') - self.prepare_boot() - self.prepare_cloudinit(ssh_pubkey) + self.set_up_boot() + self.set_up_cloudinit(ssh_pubkey) - def prepare_boot(self): + def set_up_boot(self): path = self.download_boot() self.vm.add_args('-drive', 'file=%s' % path) - def prepare_cloudinit(self, ssh_pubkey=None): - cloudinit_iso = self.download_cloudinit(ssh_pubkey) + def set_up_cloudinit(self, ssh_pubkey=None): + cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) def launch_and_wait(self): -- cgit v1.2.3 From fef453ee185958bf42644e3eb107e99184e0cbfc Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:39 -0500 Subject: tests/acceptance/virtiofs_submounts: use workdir property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Avocado Instrumented based tests, it's a better idea to just use the property. The environment variable is a fall back for tests not written using that Python API. Signed-off-by: Cleber Rosa Reviewed-by: Beraldo Leal Reviewed-by: Alex Bennée Reference: https://avocado-framework.readthedocs.io/en/84.0/api/test/avocado.html#avocado.Test.workdir Message-Id: <20210203172357.1422425-5-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtiofs_submounts.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 361e5990b6..68d3cd6869 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -136,8 +136,7 @@ class VirtiofsSubmountsTest(BootLinux): return (stdout, stderr, ret) def set_up_shared_dir(self): - atwd = os.getenv('AVOCADO_TEST_WORKDIR') - self.shared_dir = os.path.join(atwd, 'virtiofs-shared') + self.shared_dir = os.path.join(self.workdir, 'virtiofs-shared') os.mkdir(self.shared_dir) @@ -234,8 +233,7 @@ class VirtiofsSubmountsTest(BootLinux): self.seed = self.params.get('seed') - atwd = os.getenv('AVOCADO_TEST_WORKDIR') - self.ssh_key = os.path.join(atwd, 'id_ed25519') + self.ssh_key = os.path.join(self.workdir, 'id_ed25519') self.run(('ssh-keygen', '-t', 'ed25519', '-f', self.ssh_key)) -- cgit v1.2.3 From c70a6d1b9f0cd88dfa583d05d562f625038e26cd Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:40 -0500 Subject: tests/acceptance/virtiofs_submounts: do not ask for ssh key password MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests are supposed to be non-interactive, and ssh-keygen is asking for a passphrase when creating a key. Let's set an empty passphrase to avoid the prompt. Signed-off-by: Cleber Rosa Reviewed-by: Beraldo Leal Reviewed-by: Alex Bennée Message-Id: <20210203172357.1422425-6-crosa@redhat.com> [PMD: Reword description per Alex Bennée comment] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtiofs_submounts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 68d3cd6869..3b5a242385 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -235,7 +235,7 @@ class VirtiofsSubmountsTest(BootLinux): self.ssh_key = os.path.join(self.workdir, 'id_ed25519') - self.run(('ssh-keygen', '-t', 'ed25519', '-f', self.ssh_key)) + self.run(('ssh-keygen', '-N', '', '-t', 'ed25519', '-f', self.ssh_key)) pubkey = open(self.ssh_key + '.pub').read() -- cgit v1.2.3 From 14a79778e17bb7e087101b00d6b1839dc7858f1e Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:41 -0500 Subject: tests/acceptance/virtiofs_submounts: use a virtio-net device instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a virtiofs based tests, it seems safe to assume that the guest will be capable of a virtio-net device. Signed-off-by: Cleber Rosa Reviewed-by: Alex Bennée Message-Id: <20210203172357.1422425-7-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtiofs_submounts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 3b5a242385..f1b49f03bb 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -247,7 +247,7 @@ class VirtiofsSubmountsTest(BootLinux): # Allow us to connect to SSH self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', - '-device', 'e1000,netdev=vnet') + '-device', 'virtio-net,netdev=vnet') if not kvm_available(self.arch, self.qemu_bin): self.cancel(KVM_NOT_AVAILABLE) -- cgit v1.2.3 From c0d1681e501180065927f40f4bfd0ed2a06d2ff1 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:43 -0500 Subject: tests/acceptance/virtiofs_submounts: standardize port as integer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of having to cast it whenever it's going to be used, let's standardize it as an integer, which is the data type that will be used most often. Given that the regex will only match digits, it's safe that we'll end up getting a integer, but, it could as well be a zero. Signed-off-by: Cleber Rosa Reviewed-by: Beraldo Leal Message-Id: <20210203172357.1422425-9-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtiofs_submounts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index f1b49f03bb..8294175608 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -86,17 +86,18 @@ class VirtiofsSubmountsTest(BootLinux): re.search(r'TCP.HOST_FORWARD.*127\.0\.0\.1\s*(\d+)\s+10\.', line) if match is not None: - port = match[1] + port = int(match[1]) break self.assertIsNotNone(port) - self.log.debug('sshd listening on port: ' + port) + self.assertGreater(port, 0) + self.log.debug('sshd listening on port: %d', port) return port def ssh_connect(self, username, keyfile): self.ssh_logger = logging.getLogger('ssh') port = self.get_portfwd() - self.ssh_session = ssh.Session('127.0.0.1', port=int(port), + self.ssh_session = ssh.Session('127.0.0.1', port=port, user=username, key=keyfile) for i in range(10): try: -- cgit v1.2.3 From d7f57c25e10d9d39ec8125c981320c343cac0743 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:44 -0500 Subject: tests/acceptance/virtiofs_submounts: required space between IP and port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AFAICT, there should not be a situation where IP and port do not have at least one whitespace character separating them. This may be true for other '\s*' patterns in the same regex too. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210203172357.1422425-10-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/virtiofs_submounts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 8294175608..28b2920b88 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -83,7 +83,7 @@ class VirtiofsSubmountsTest(BootLinux): command_line='info usernet') for line in res.split('\r\n'): match = \ - re.search(r'TCP.HOST_FORWARD.*127\.0\.0\.1\s*(\d+)\s+10\.', + re.search(r'TCP.HOST_FORWARD.*127\.0\.0\.1\s+(\d+)\s+10\.', line) if match is not None: port = int(match[1]) -- cgit v1.2.3 From 4f0d032185a422116e492b1e07b55728e5ba1832 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:47 -0500 Subject: Acceptance tests: clarify ssh connection failure reason MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the connection to the ssh server fails, it may indeed be a "sshd" issue, but it may also not be that. Let's state what we know: the establishment of the connection from the client side was not possible. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210203172357.1422425-13-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/linux_ssh_mips_malta.py | 2 +- tests/acceptance/virtiofs_submounts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 25c5c5f741..6dbd02d49d 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -91,7 +91,7 @@ class LinuxSSH(Test): except: time.sleep(4) pass - self.fail("sshd timeout") + self.fail("ssh connection timeout") def ssh_disconnect_vm(self): self.ssh_session.quit() diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 28b2920b88..949ca87a83 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -106,7 +106,7 @@ class VirtiofsSubmountsTest(BootLinux): except: time.sleep(4) pass - self.fail('sshd timeout') + self.fail('ssh connection timeout') def ssh_command(self, command): self.ssh_logger.info(command) -- cgit v1.2.3 From 86b7cb6660bfec139f293c246572f77b53389699 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 3 Feb 2021 12:23:38 -0500 Subject: Acceptance Tests: remove unnecessary tag from documentation example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ":avocado: enable" is not necessary and was removed in 9531d26c, so let's remove from the docs. Signed-off-by: Cleber Rosa Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210203172357.1422425-4-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/testing.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 809af69725..209f9d8172 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -765,9 +765,6 @@ and hypothetical example follows: class MultipleMachines(Test): - """ - :avocado: enable - """ def test_multiple_machines(self): first_machine = self.get_vm() second_machine = self.get_vm() -- cgit v1.2.3