qemu/tests/avocado/machine_mips_malta.py

160 lines
5.6 KiB
Python
Raw Normal View History

tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
# Functional tests for the MIPS Malta board
#
# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
import gzip
import logging
tests/avocado: Add tests booting YAMON ROM on MIPS Malta machines Add quick tests booting YAMON: $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon: console: YAMON ROM Monitor, Revision 02.22. console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved. console: For a list of available commands, type 'help'. console: Compilation time = May 24 2013 12:16:34 (pburton) console: Board type/revision = 0x02 (Malta) / 0x00 console: Core board type/revision = 0x01 (CoreLV) / 0x00 console: System controller/revision = Galileo / GT_64120A-B-0 console: FPGA revision = 0x0000 console: MAC address = ff.ff.ff.ff.ff.ff console: Board S/N = 0123456789 console: PCI bus frequency = 33.33 MHz console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x93 (MIPS 24Kf) / 0x00 console: Endianness = Little console: CPU/Bus frequency = 333 MHz / 419 MHz console: Coherency = None console: Flash memory size = 4 MByte console: SDRAM size = 128 MByte console: First free SDRAM address = 0x800c32f0 console: WARNING: Environment variable flash area is invalid! console: HINT : Perform "erase -e" console: YAMON> PASS (1.88 s) (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon: ... console: System controller/revision = Galileo / GT_64120A-B-0 console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x82 (MIPS 20Kc) / 0xa0 ... console: YAMON> PASS (1.89 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 4.57 s YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA registers. These tests are useful to debug cross-endianness issues, in particular on big-endian host. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230104133935.4639-7-philmd@linaro.org>
2022-12-30 23:53:42 +03:00
from avocado import skipIf
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
from avocado import skipUnless
tests/avocado: Add tests booting YAMON ROM on MIPS Malta machines Add quick tests booting YAMON: $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon: console: YAMON ROM Monitor, Revision 02.22. console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved. console: For a list of available commands, type 'help'. console: Compilation time = May 24 2013 12:16:34 (pburton) console: Board type/revision = 0x02 (Malta) / 0x00 console: Core board type/revision = 0x01 (CoreLV) / 0x00 console: System controller/revision = Galileo / GT_64120A-B-0 console: FPGA revision = 0x0000 console: MAC address = ff.ff.ff.ff.ff.ff console: Board S/N = 0123456789 console: PCI bus frequency = 33.33 MHz console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x93 (MIPS 24Kf) / 0x00 console: Endianness = Little console: CPU/Bus frequency = 333 MHz / 419 MHz console: Coherency = None console: Flash memory size = 4 MByte console: SDRAM size = 128 MByte console: First free SDRAM address = 0x800c32f0 console: WARNING: Environment variable flash area is invalid! console: HINT : Perform "erase -e" console: YAMON> PASS (1.88 s) (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon: ... console: System controller/revision = Galileo / GT_64120A-B-0 console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x82 (MIPS 20Kc) / 0xa0 ... console: YAMON> PASS (1.89 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 4.57 s YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA registers. These tests are useful to debug cross-endianness issues, in particular on big-endian host. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230104133935.4639-7-philmd@linaro.org>
2022-12-30 23:53:42 +03:00
from avocado.utils import archive
from avocado_qemu import QemuSystemTest
tests/avocado: Add tests booting YAMON ROM on MIPS Malta machines Add quick tests booting YAMON: $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon: console: YAMON ROM Monitor, Revision 02.22. console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved. console: For a list of available commands, type 'help'. console: Compilation time = May 24 2013 12:16:34 (pburton) console: Board type/revision = 0x02 (Malta) / 0x00 console: Core board type/revision = 0x01 (CoreLV) / 0x00 console: System controller/revision = Galileo / GT_64120A-B-0 console: FPGA revision = 0x0000 console: MAC address = ff.ff.ff.ff.ff.ff console: Board S/N = 0123456789 console: PCI bus frequency = 33.33 MHz console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x93 (MIPS 24Kf) / 0x00 console: Endianness = Little console: CPU/Bus frequency = 333 MHz / 419 MHz console: Coherency = None console: Flash memory size = 4 MByte console: SDRAM size = 128 MByte console: First free SDRAM address = 0x800c32f0 console: WARNING: Environment variable flash area is invalid! console: HINT : Perform "erase -e" console: YAMON> PASS (1.88 s) (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon: ... console: System controller/revision = Galileo / GT_64120A-B-0 console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x82 (MIPS 20Kc) / 0xa0 ... console: YAMON> PASS (1.89 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 4.57 s YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA registers. These tests are useful to debug cross-endianness issues, in particular on big-endian host. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230104133935.4639-7-philmd@linaro.org>
2022-12-30 23:53:42 +03:00
from avocado_qemu import exec_command_and_wait_for_pattern
from avocado_qemu import interrupt_interactive_console_until_pattern
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
from avocado_qemu import wait_for_console_pattern
NUMPY_AVAILABLE = True
try:
import numpy as np
except ImportError:
NUMPY_AVAILABLE = False
CV2_AVAILABLE = True
try:
import cv2
except ImportError:
CV2_AVAILABLE = False
@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
class MaltaMachineFramebuffer(QemuSystemTest):
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
timeout = 30
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
"""
Boot Linux kernel and check Tux logo is displayed on the framebuffer.
"""
screendump_path = os.path.join(self.workdir, 'screendump.pbm')
kernel_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
'a5966ca4b5/mips/malta/mips64el/'
'vmlinux-4.7.0-rc1.I6400.gz')
kernel_hash = '096f50c377ec5072e6a366943324622c312045f6'
kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
kernel_path = self.workdir + "vmlinux"
archive.gzip_uncompress(kernel_path_gz, kernel_path)
tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
'drivers/video/logo/logo_linux_vga16.ppm')
tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)
self.vm.set_console()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'clocksource=GIC console=tty0 console=ttyS0')
self.vm.add_args('-kernel', kernel_path,
'-smp', '%u' % cpu_cores_count,
'-vga', 'std',
'-append', kernel_command_line)
self.vm.launch()
framebuffer_ready = 'Console: switching to colour frame buffer device'
wait_for_console_pattern(self, framebuffer_ready,
failure_message='Kernel panic - not syncing')
self.vm.cmd('human-monitor-command', command_line='stop')
self.vm.cmd('human-monitor-command',
command_line='screendump %s' % screendump_path)
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
logger = logging.getLogger('framebuffer')
match_threshold = 0.95
screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
tuxlogo_bgr = cv2.imread(tuxlogo_path, cv2.IMREAD_COLOR)
result = cv2.matchTemplate(screendump_bgr, tuxlogo_bgr,
cv2.TM_CCOEFF_NORMED)
loc = np.where(result >= match_threshold)
tuxlogo_count = 0
h, w = tuxlogo_bgr.shape[:2]
debug_png = os.getenv('AVOCADO_CV2_SCREENDUMP_PNG_PATH')
for tuxlogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
logger.debug('found Tux at position (x, y) = %s', pt)
cv2.rectangle(screendump_bgr, pt,
(pt[0] + w, pt[1] + h), (0, 0, 255), 2)
if debug_png:
cv2.imwrite(debug_png, screendump_bgr)
self.assertGreaterEqual(tuxlogo_count, cpu_cores_count)
def test_mips_malta_i6400_framebuffer_logo_1core(self):
"""
:avocado: tags=arch:mips64el
:avocado: tags=machine:malta
:avocado: tags=cpu:I6400
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
"""
self.do_test_i6400_framebuffer_logo(1)
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
def test_mips_malta_i6400_framebuffer_logo_7cores(self):
"""
:avocado: tags=arch:mips64el
:avocado: tags=machine:malta
:avocado: tags=cpu:I6400
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
:avocado: tags=mips:smp
"""
self.do_test_i6400_framebuffer_logo(7)
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
def test_mips_malta_i6400_framebuffer_logo_8cores(self):
"""
:avocado: tags=arch:mips64el
:avocado: tags=machine:malta
:avocado: tags=cpu:I6400
tests/acceptance: Count multiple Tux logos displayed on framebuffer Add a test that verifies that each core properly displays the Tux logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer \ run -t cpu:i6400 \ tests/acceptance/machine_mips_malta.py JOB ID : 54f3d8efd8674f289b8aa01a87f5d70c5814544c JOB LOG : avocado/job-results/job-2020-02-01T20.52-54f3d8e/job.log (1/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core: framebuffer: found Tux at position (x, y) = (0, 0) PASS (3.37 s) (2/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) PASS (5.80 s) (3/3) tests/acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores: framebuffer: found Tux at position (x, y) = (0, 0) framebuffer: found Tux at position (x, y) = (88, 0) framebuffer: found Tux at position (x, y) = (176, 0) framebuffer: found Tux at position (x, y) = (264, 0) framebuffer: found Tux at position (x, y) = (352, 0) framebuffer: found Tux at position (x, y) = (440, 0) framebuffer: found Tux at position (x, y) = (528, 0) framebuffer: found Tux at position (x, y) = (616, 0) PASS (6.67 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 16.79 s If the AVOCADO_CV2_SCREENDUMP_PNG_PATH environment variable is set, the test will save the screenshot with matched squares to it. Test inspired by the following post: https://www.mips.com/blog/how-to-run-smp-linux-in-qemu-on-a-mips64-release-6-cpu/ Kernel built with the following Docker file: https://github.com/philmd/qemu-testing-blob/blob/malta_i6400/mips/malta/mips64el/Dockerfile Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200201204751.17810-1-f4bug@amsat.org>
2020-02-01 23:47:50 +03:00
:avocado: tags=mips:smp
"""
self.do_test_i6400_framebuffer_logo(8)
tests/avocado: Add tests booting YAMON ROM on MIPS Malta machines Add quick tests booting YAMON: $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon: console: YAMON ROM Monitor, Revision 02.22. console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved. console: For a list of available commands, type 'help'. console: Compilation time = May 24 2013 12:16:34 (pburton) console: Board type/revision = 0x02 (Malta) / 0x00 console: Core board type/revision = 0x01 (CoreLV) / 0x00 console: System controller/revision = Galileo / GT_64120A-B-0 console: FPGA revision = 0x0000 console: MAC address = ff.ff.ff.ff.ff.ff console: Board S/N = 0123456789 console: PCI bus frequency = 33.33 MHz console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x93 (MIPS 24Kf) / 0x00 console: Endianness = Little console: CPU/Bus frequency = 333 MHz / 419 MHz console: Coherency = None console: Flash memory size = 4 MByte console: SDRAM size = 128 MByte console: First free SDRAM address = 0x800c32f0 console: WARNING: Environment variable flash area is invalid! console: HINT : Perform "erase -e" console: YAMON> PASS (1.88 s) (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon: ... console: System controller/revision = Galileo / GT_64120A-B-0 console: Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 console: Processor ID/revision = 0x82 (MIPS 20Kc) / 0xa0 ... console: YAMON> PASS (1.89 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 4.57 s YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA registers. These tests are useful to debug cross-endianness issues, in particular on big-endian host. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230104133935.4639-7-philmd@linaro.org>
2022-12-30 23:53:42 +03:00
class MaltaMachine(QemuSystemTest):
def do_test_yamon(self):
rom_url = ('http://www.imgtec.com/tools/mips-tools/downloads/'
'yamon/yamon-bin-02.22.zip')
rom_hash = '8da7ecddbc5312704b8b324341ee238189bde480'
zip_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
archive.extract(zip_path, self.workdir)
yamon_path = os.path.join(self.workdir, 'yamon-02.22.bin')
self.vm.set_console()
self.vm.add_args('-bios', yamon_path)
self.vm.launch()
prompt = 'YAMON>'
pattern = 'YAMON ROM Monitor'
interrupt_interactive_console_until_pattern(self, pattern, prompt)
wait_for_console_pattern(self, prompt)
self.vm.shutdown()
def test_mipsel_malta_yamon(self):
"""
:avocado: tags=arch:mipsel
:avocado: tags=machine:malta
:avocado: tags=endian:little
"""
self.do_test_yamon()
def test_mips64el_malta_yamon(self):
"""
:avocado: tags=arch:mips64el
:avocado: tags=machine:malta
:avocado: tags=endian:little
"""
self.do_test_yamon()