mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
tests/functional: switch to new test skip decorators
This ensures consistency of behaviour across all the tests, and requires that we provide gitlab bug links when marking a test to be skipped due to unreliability. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-9-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
3ea06d65be
commit
3d5938607e
16 changed files with 61 additions and 122 deletions
|
@ -32,7 +32,6 @@ https://gitlab.com/qemu-project/biosbits-bits .
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -46,28 +45,13 @@ from typing import (
|
||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
from qemu.machine import QEMUMachine
|
from qemu.machine import QEMUMachine
|
||||||
from unittest import skipIf
|
from qemu_test import (QemuSystemTest, Asset, skipIfMissingCommands,
|
||||||
from qemu_test import QemuSystemTest, Asset, which
|
skipIfNotMachine)
|
||||||
|
|
||||||
deps = ["xorriso", "mformat"] # dependent tools needed in the test setup/box.
|
|
||||||
supported_platforms = ['x86_64'] # supported test platforms.
|
|
||||||
|
|
||||||
# default timeout of 120 secs is sometimes not enough for bits test.
|
# default timeout of 120 secs is sometimes not enough for bits test.
|
||||||
BITS_TIMEOUT = 200
|
BITS_TIMEOUT = 200
|
||||||
|
|
||||||
def missing_deps():
|
|
||||||
""" returns True if any of the test dependent tools are absent.
|
|
||||||
"""
|
|
||||||
for dep in deps:
|
|
||||||
if which(dep) is None:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def supported_platform():
|
|
||||||
""" checks if the test is running on a supported platform.
|
|
||||||
"""
|
|
||||||
return platform.machine() in supported_platforms
|
|
||||||
|
|
||||||
class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
|
class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
|
||||||
"""
|
"""
|
||||||
A QEMU VM, with isa-debugcon enabled and bits iso passed
|
A QEMU VM, with isa-debugcon enabled and bits iso passed
|
||||||
|
@ -110,9 +94,8 @@ class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
|
||||||
"""return the base argument to QEMU binary"""
|
"""return the base argument to QEMU binary"""
|
||||||
return self._base_args
|
return self._base_args
|
||||||
|
|
||||||
@skipIf(not supported_platform() or missing_deps(),
|
@skipIfMissingCommands("xorriso", "mformat")
|
||||||
'unsupported platform or dependencies (%s) not installed' \
|
@skipIfNotMachine("x86_64")
|
||||||
% ','.join(deps))
|
|
||||||
class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attributes
|
class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attributes
|
||||||
"""
|
"""
|
||||||
ACPI and SMBIOS tests using biosbits.
|
ACPI and SMBIOS tests using biosbits.
|
||||||
|
|
|
@ -11,10 +11,9 @@ import subprocess
|
||||||
|
|
||||||
from qemu_test import Asset
|
from qemu_test import Asset
|
||||||
from aspeed import AspeedTest
|
from aspeed import AspeedTest
|
||||||
from qemu_test import exec_command_and_wait_for_pattern
|
from qemu_test import exec_command_and_wait_for_pattern, skipIfMissingCommands
|
||||||
from qemu_test import has_cmd
|
|
||||||
from qemu_test.utils import archive_extract
|
from qemu_test.utils import archive_extract
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
class AST2600Machine(AspeedTest):
|
class AST2600Machine(AspeedTest):
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ class AST2600Machine(AspeedTest):
|
||||||
'images/ast2600-evb/buildroot-2023.02-tpm/flash.img'),
|
'images/ast2600-evb/buildroot-2023.02-tpm/flash.img'),
|
||||||
'a46009ae8a5403a0826d607215e731a8c68d27c14c41e55331706b8f9c7bd997')
|
'a46009ae8a5403a0826d607215e731a8c68d27c14c41e55331706b8f9c7bd997')
|
||||||
|
|
||||||
@skipUnless(*has_cmd('swtpm'))
|
@skipIfMissingCommands('swtpm')
|
||||||
def test_arm_ast2600_evb_buildroot_tpm(self):
|
def test_arm_ast2600_evb_buildroot_tpm(self):
|
||||||
self.set_machine('ast2600-evb')
|
self.set_machine('ast2600-evb')
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,8 @@ import os
|
||||||
import bz2
|
import bz2
|
||||||
|
|
||||||
from qemu_test import QemuUserTest, Asset
|
from qemu_test import QemuUserTest, Asset
|
||||||
from qemu_test import has_cmd
|
from qemu_test import skipIfMissingCommands, skipUntrustedTest
|
||||||
from qemu_test.utils import cpio_extract
|
from qemu_test.utils import cpio_extract
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
|
|
||||||
class LoadBFLT(QemuUserTest):
|
class LoadBFLT(QemuUserTest):
|
||||||
|
@ -21,8 +20,8 @@ class LoadBFLT(QemuUserTest):
|
||||||
('https://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2'),
|
('https://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2'),
|
||||||
'eefb788e4980c9e8d6c9d60ce7d15d4da6bf4fbc6a80f487673824600d5ba9cc')
|
'eefb788e4980c9e8d6c9d60ce7d15d4da6bf4fbc6a80f487673824600d5ba9cc')
|
||||||
|
|
||||||
@skipUnless(*has_cmd('cpio'))
|
@skipIfMissingCommands('cpio')
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
def test_stm32(self):
|
def test_stm32(self):
|
||||||
# See https://elinux.org/STM32#User_Space
|
# See https://elinux.org/STM32#User_Space
|
||||||
rootfs_path_bz2 = self.ASSET_ROOTFS.fetch()
|
rootfs_path_bz2 = self.ASSET_ROOTFS.fetch()
|
||||||
|
|
|
@ -9,9 +9,10 @@ import os
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern
|
from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern
|
||||||
from qemu_test import Asset, interrupt_interactive_console_until_pattern
|
from qemu_test import Asset, interrupt_interactive_console_until_pattern
|
||||||
|
from qemu_test import skipBigDataTest
|
||||||
from qemu_test.utils import gzip_uncompress, lzma_uncompress
|
from qemu_test.utils import gzip_uncompress, lzma_uncompress
|
||||||
from qemu_test.utils import image_pow2ceil_expand
|
from qemu_test.utils import image_pow2ceil_expand
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
class BananaPiMachine(LinuxKernelTest):
|
class BananaPiMachine(LinuxKernelTest):
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ class BananaPiMachine(LinuxKernelTest):
|
||||||
os.remove(dtb_path)
|
os.remove(dtb_path)
|
||||||
os.remove(rootfs_path)
|
os.remove(rootfs_path)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited')
|
@skipBigDataTest()
|
||||||
def test_arm_bpim2u_openwrt_22_03_3(self):
|
def test_arm_bpim2u_openwrt_22_03_3(self):
|
||||||
self.set_machine('bpim2u')
|
self.set_machine('bpim2u')
|
||||||
# This test download a 8.9 MiB compressed image and expand it
|
# This test download a 8.9 MiB compressed image and expand it
|
||||||
|
|
|
@ -8,8 +8,9 @@ import os
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pattern
|
from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pattern
|
||||||
from qemu_test import interrupt_interactive_console_until_pattern
|
from qemu_test import interrupt_interactive_console_until_pattern
|
||||||
|
from qemu_test import skipBigDataTest
|
||||||
from qemu_test.utils import gzip_uncompress, image_pow2ceil_expand
|
from qemu_test.utils import gzip_uncompress, image_pow2ceil_expand
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
class CubieboardMachine(LinuxKernelTest):
|
class CubieboardMachine(LinuxKernelTest):
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ class CubieboardMachine(LinuxKernelTest):
|
||||||
# Wait for VM to shut down gracefully
|
# Wait for VM to shut down gracefully
|
||||||
self.vm.wait()
|
self.vm.wait()
|
||||||
|
|
||||||
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
|
@skipBigDataTest()
|
||||||
def test_arm_cubieboard_openwrt_22_03_2(self):
|
def test_arm_cubieboard_openwrt_22_03_2(self):
|
||||||
# This test download a 7.5 MiB compressed image and expand it
|
# This test download a 7.5 MiB compressed image and expand it
|
||||||
# to 126 MiB.
|
# to 126 MiB.
|
||||||
|
|
|
@ -17,20 +17,7 @@ import logging
|
||||||
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern
|
||||||
from unittest import skipUnless
|
from qemu_test import skipIfMissingImports, skipUntrustedTest
|
||||||
|
|
||||||
|
|
||||||
NUMPY_AVAILABLE = True
|
|
||||||
try:
|
|
||||||
import numpy as np
|
|
||||||
except ImportError:
|
|
||||||
NUMPY_AVAILABLE = False
|
|
||||||
|
|
||||||
CV2_AVAILABLE = True
|
|
||||||
try:
|
|
||||||
import cv2
|
|
||||||
except ImportError:
|
|
||||||
CV2_AVAILABLE = False
|
|
||||||
|
|
||||||
|
|
||||||
class IntegratorMachine(QemuSystemTest):
|
class IntegratorMachine(QemuSystemTest):
|
||||||
|
@ -63,7 +50,7 @@ class IntegratorMachine(QemuSystemTest):
|
||||||
'-append', 'printk.time=0 console=ttyAMA0')
|
'-append', 'printk.time=0 console=ttyAMA0')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
def test_integratorcp_console(self):
|
def test_integratorcp_console(self):
|
||||||
"""
|
"""
|
||||||
Boots the Linux kernel and checks that the console is operational
|
Boots the Linux kernel and checks that the console is operational
|
||||||
|
@ -71,13 +58,15 @@ class IntegratorMachine(QemuSystemTest):
|
||||||
self.boot_integratorcp()
|
self.boot_integratorcp()
|
||||||
wait_for_console_pattern(self, 'Log in as root')
|
wait_for_console_pattern(self, 'Log in as root')
|
||||||
|
|
||||||
@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
|
@skipIfMissingImports("numpy", "cv2")
|
||||||
@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
|
@skipUntrustedTest()
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
|
||||||
def test_framebuffer_tux_logo(self):
|
def test_framebuffer_tux_logo(self):
|
||||||
"""
|
"""
|
||||||
Boot Linux and verify the Tux logo is displayed on the framebuffer.
|
Boot Linux and verify the Tux logo is displayed on the framebuffer.
|
||||||
"""
|
"""
|
||||||
|
import numpy as np
|
||||||
|
import cv2
|
||||||
|
|
||||||
screendump_path = os.path.join(self.workdir, "screendump.pbm")
|
screendump_path = os.path.join(self.workdir, "screendump.pbm")
|
||||||
tuxlogo_path = self.ASSET_TUXLOGO.fetch()
|
tuxlogo_path = self.ASSET_TUXLOGO.fetch()
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ import shutil
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern
|
from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern
|
||||||
from qemu_test import Asset, interrupt_interactive_console_until_pattern
|
from qemu_test import Asset, interrupt_interactive_console_until_pattern
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern, skipBigDataTest
|
||||||
from qemu_test.utils import gzip_uncompress, lzma_uncompress
|
from qemu_test.utils import gzip_uncompress, lzma_uncompress
|
||||||
from qemu_test.utils import image_pow2ceil_expand
|
from qemu_test.utils import image_pow2ceil_expand
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
class BananaPiMachine(LinuxKernelTest):
|
class BananaPiMachine(LinuxKernelTest):
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class BananaPiMachine(LinuxKernelTest):
|
||||||
os.remove(dtb_path)
|
os.remove(dtb_path)
|
||||||
os.remove(rootfs_path)
|
os.remove(rootfs_path)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited')
|
@skipBigDataTest()
|
||||||
def test_arm_orangepi_armbian(self):
|
def test_arm_orangepi_armbian(self):
|
||||||
self.set_machine('orangepi-pc')
|
self.set_machine('orangepi-pc')
|
||||||
# This test download a 275 MiB compressed image and expand it
|
# This test download a 275 MiB compressed image and expand it
|
||||||
|
@ -185,7 +185,7 @@ class BananaPiMachine(LinuxKernelTest):
|
||||||
'to <orangepipc>')
|
'to <orangepipc>')
|
||||||
self.wait_for_console_pattern('Starting Load Kernel Modules...')
|
self.wait_for_console_pattern('Starting Load Kernel Modules...')
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited')
|
@skipBigDataTest()
|
||||||
def test_arm_orangepi_uboot_netbsd9(self):
|
def test_arm_orangepi_uboot_netbsd9(self):
|
||||||
self.set_machine('orangepi-pc')
|
self.set_machine('orangepi-pc')
|
||||||
# This test download a 304MB compressed image and expand it to 2GB
|
# This test download a 304MB compressed image and expand it to 2GB
|
||||||
|
|
|
@ -10,12 +10,10 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
# later. See the COPYING file in the top-level directory.
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset, skipFlakyTest
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
|
|
||||||
class LinuxInitrd(QemuSystemTest):
|
class LinuxInitrd(QemuSystemTest):
|
||||||
|
@ -60,7 +58,8 @@ class LinuxInitrd(QemuSystemTest):
|
||||||
max_size + 1)
|
max_size + 1)
|
||||||
self.assertRegex(self.vm.get_log(), expected_msg)
|
self.assertRegex(self.vm.get_log(), expected_msg)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
# XXX file tracking bug
|
||||||
|
@skipFlakyTest(bug_url=None)
|
||||||
def test_with_2gib_file_should_work_with_linux_v4_16(self):
|
def test_with_2gib_file_should_work_with_linux_v4_16(self):
|
||||||
"""
|
"""
|
||||||
QEMU has supported up to 4 GiB initrd for recent kernel
|
QEMU has supported up to 4 GiB initrd for recent kernel
|
||||||
|
|
|
@ -11,17 +11,9 @@ import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from unittest import skipUnless
|
from qemu_test import skipIfMissingImports, skipIfMissingCommands
|
||||||
|
|
||||||
from qemu_test import has_cmd
|
|
||||||
from qemu_test.tesseract import tesseract_ocr
|
from qemu_test.tesseract import tesseract_ocr
|
||||||
|
|
||||||
PIL_AVAILABLE = True
|
|
||||||
try:
|
|
||||||
from PIL import Image
|
|
||||||
except ImportError:
|
|
||||||
PIL_AVAILABLE = False
|
|
||||||
|
|
||||||
|
|
||||||
class NextCubeMachine(QemuSystemTest):
|
class NextCubeMachine(QemuSystemTest):
|
||||||
|
|
||||||
|
@ -44,17 +36,18 @@ class NextCubeMachine(QemuSystemTest):
|
||||||
self.vm.cmd('human-monitor-command',
|
self.vm.cmd('human-monitor-command',
|
||||||
command_line='screendump %s' % screenshot_path)
|
command_line='screendump %s' % screenshot_path)
|
||||||
|
|
||||||
@skipUnless(PIL_AVAILABLE, 'Python PIL not installed')
|
@skipIfMissingImports("PIL")
|
||||||
def test_bootrom_framebuffer_size(self):
|
def test_bootrom_framebuffer_size(self):
|
||||||
self.set_machine('next-cube')
|
self.set_machine('next-cube')
|
||||||
screenshot_path = os.path.join(self.workdir, "dump.ppm")
|
screenshot_path = os.path.join(self.workdir, "dump.ppm")
|
||||||
self.check_bootrom_framebuffer(screenshot_path)
|
self.check_bootrom_framebuffer(screenshot_path)
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
width, height = Image.open(screenshot_path).size
|
width, height = Image.open(screenshot_path).size
|
||||||
self.assertEqual(width, 1120)
|
self.assertEqual(width, 1120)
|
||||||
self.assertEqual(height, 832)
|
self.assertEqual(height, 832)
|
||||||
|
|
||||||
@skipUnless(*has_cmd('tesseract'))
|
@skipIfMissingCommands('tesseract')
|
||||||
def test_bootrom_framebuffer_ocr_with_tesseract(self):
|
def test_bootrom_framebuffer_ocr_with_tesseract(self):
|
||||||
self.set_machine('next-cube')
|
self.set_machine('next-cube')
|
||||||
screenshot_path = os.path.join(self.workdir, "dump.ppm")
|
screenshot_path = os.path.join(self.workdir, "dump.ppm")
|
||||||
|
|
|
@ -13,7 +13,7 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, Asset
|
from qemu_test import LinuxKernelTest, Asset
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern, skipUntrustedTest
|
||||||
from unittest import skipUnless
|
from unittest import skipUnless
|
||||||
|
|
||||||
class MipsFuloong2e(LinuxKernelTest):
|
class MipsFuloong2e(LinuxKernelTest):
|
||||||
|
@ -39,7 +39,7 @@ class MipsFuloong2e(LinuxKernelTest):
|
||||||
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
||||||
self.wait_for_console_pattern(console_pattern)
|
self.wait_for_console_pattern(console_pattern)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
@skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available')
|
@skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available')
|
||||||
def test_linux_kernel_2_6_27_isa_serial(self):
|
def test_linux_kernel_2_6_27_isa_serial(self):
|
||||||
# Recovery system for the Yeeloong laptop
|
# Recovery system for the Yeeloong laptop
|
||||||
|
|
|
@ -9,11 +9,9 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from unittest import skipUnless
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern, skipUntrustedTest
|
||||||
|
|
||||||
|
|
||||||
class MipsLoongson3v(QemuSystemTest):
|
class MipsLoongson3v(QemuSystemTest):
|
||||||
timeout = 60
|
timeout = 60
|
||||||
|
@ -23,7 +21,7 @@ class MipsLoongson3v(QemuSystemTest):
|
||||||
'releases/download/20210112/pmon-3avirt.bin'),
|
'releases/download/20210112/pmon-3avirt.bin'),
|
||||||
'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a')
|
'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a')
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
def test_pmon_serial_console(self):
|
def test_pmon_serial_console(self):
|
||||||
self.set_machine('loongson3-virt')
|
self.set_machine('loongson3-virt')
|
||||||
|
|
||||||
|
|
|
@ -14,20 +14,8 @@ import logging
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, Asset
|
from qemu_test import LinuxKernelTest, Asset
|
||||||
from qemu_test import exec_command_and_wait_for_pattern
|
from qemu_test import exec_command_and_wait_for_pattern
|
||||||
|
from qemu_test import skipIfMissingImports, skipFlakyTest, skipUntrustedTest
|
||||||
from qemu_test.utils import gzip_uncompress
|
from qemu_test.utils import gzip_uncompress
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
NUMPY_AVAILABLE = True
|
|
||||||
try:
|
|
||||||
import numpy as np
|
|
||||||
except ImportError:
|
|
||||||
NUMPY_AVAILABLE = False
|
|
||||||
|
|
||||||
CV2_AVAILABLE = True
|
|
||||||
try:
|
|
||||||
import cv2
|
|
||||||
except ImportError:
|
|
||||||
CV2_AVAILABLE = False
|
|
||||||
|
|
||||||
|
|
||||||
class MaltaMachineConsole(LinuxKernelTest):
|
class MaltaMachineConsole(LinuxKernelTest):
|
||||||
|
@ -76,7 +64,7 @@ class MaltaMachineConsole(LinuxKernelTest):
|
||||||
'rootfs.mipsel64r1.cpio.gz'),
|
'rootfs.mipsel64r1.cpio.gz'),
|
||||||
'75ba10cd35fb44e32948eeb26974f061b703c81c4ba2fab1ebcacf1d1bec3b61')
|
'75ba10cd35fb44e32948eeb26974f061b703c81c4ba2fab1ebcacf1d1bec3b61')
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
def test_mips64el_malta_5KEc_cpio(self):
|
def test_mips64el_malta_5KEc_cpio(self):
|
||||||
kernel_path = self.ASSET_KERNEL_3_19_3.fetch()
|
kernel_path = self.ASSET_KERNEL_3_19_3.fetch()
|
||||||
initrd_path_gz = self.ASSET_CPIO_R1.fetch()
|
initrd_path_gz = self.ASSET_CPIO_R1.fetch()
|
||||||
|
@ -106,8 +94,7 @@ class MaltaMachineConsole(LinuxKernelTest):
|
||||||
self.vm.wait()
|
self.vm.wait()
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
|
@skipIfMissingImports('numpy', 'cv2')
|
||||||
@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
|
|
||||||
class MaltaMachineFramebuffer(LinuxKernelTest):
|
class MaltaMachineFramebuffer(LinuxKernelTest):
|
||||||
|
|
||||||
timeout = 30
|
timeout = 30
|
||||||
|
@ -126,6 +113,10 @@ class MaltaMachineFramebuffer(LinuxKernelTest):
|
||||||
"""
|
"""
|
||||||
Boot Linux kernel and check Tux logo is displayed on the framebuffer.
|
Boot Linux kernel and check Tux logo is displayed on the framebuffer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import cv2
|
||||||
|
|
||||||
screendump_path = os.path.join(self.workdir, 'screendump.pbm')
|
screendump_path = os.path.join(self.workdir, 'screendump.pbm')
|
||||||
|
|
||||||
kernel_path_gz = self.ASSET_KERNEL_4_7_0.fetch()
|
kernel_path_gz = self.ASSET_KERNEL_4_7_0.fetch()
|
||||||
|
@ -171,11 +162,12 @@ class MaltaMachineFramebuffer(LinuxKernelTest):
|
||||||
def test_mips_malta_i6400_framebuffer_logo_1core(self):
|
def test_mips_malta_i6400_framebuffer_logo_1core(self):
|
||||||
self.do_test_i6400_framebuffer_logo(1)
|
self.do_test_i6400_framebuffer_logo(1)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
# XXX file tracking bug
|
||||||
|
@skipFlakyTest(bug_url=None)
|
||||||
def test_mips_malta_i6400_framebuffer_logo_7cores(self):
|
def test_mips_malta_i6400_framebuffer_logo_7cores(self):
|
||||||
self.do_test_i6400_framebuffer_logo(7)
|
self.do_test_i6400_framebuffer_logo(7)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
@skipFlakyTest(bug_url=None)
|
||||||
def test_mips_malta_i6400_framebuffer_logo_8cores(self):
|
def test_mips_malta_i6400_framebuffer_logo_8cores(self):
|
||||||
self.do_test_i6400_framebuffer_logo(8)
|
self.do_test_i6400_framebuffer_logo(8)
|
||||||
|
|
||||||
|
|
|
@ -9,24 +9,14 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
# later. See the COPYING file in the top-level directory.
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
from unittest import skipIf, skipUnless
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from qemu_test import wait_for_console_pattern, exec_command, which
|
from qemu_test import wait_for_console_pattern, exec_command
|
||||||
|
from qemu_test import skipIfMissingCommands, skipBigDataTest
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
deps = ["xorriso"] # dependent tools needed in the test setup/box.
|
|
||||||
|
|
||||||
def missing_deps():
|
|
||||||
""" returns True if any of the test dependent tools are absent.
|
|
||||||
"""
|
|
||||||
for dep in deps:
|
|
||||||
if which(dep) is None:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Alpine is a light weight distro that supports QEMU. These tests boot
|
# Alpine is a light weight distro that supports QEMU. These tests boot
|
||||||
# that on the machine then run a QEMU guest inside it in KVM mode,
|
# that on the machine then run a QEMU guest inside it in KVM mode,
|
||||||
# that runs the same Alpine distro image.
|
# that runs the same Alpine distro image.
|
||||||
|
@ -34,8 +24,8 @@ def missing_deps():
|
||||||
# large download, but it may be more polite to create qcow2 image with
|
# large download, but it may be more polite to create qcow2 image with
|
||||||
# QEMU already installed and use that.
|
# QEMU already installed and use that.
|
||||||
# XXX: The order of these tests seems to matter, see git blame.
|
# XXX: The order of these tests seems to matter, see git blame.
|
||||||
@skipIf(missing_deps(), 'dependencies (%s) not installed' % ','.join(deps))
|
@skipIfMissingCommands("xorriso")
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited')
|
@skipBigDataTest()
|
||||||
class HypervisorTest(QemuSystemTest):
|
class HypervisorTest(QemuSystemTest):
|
||||||
|
|
||||||
timeout = 1000
|
timeout = 1000
|
||||||
|
|
|
@ -7,11 +7,8 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
# later. See the COPYING file in the top-level directory.
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from unittest import skipUnless
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern, skipUntrustedTest
|
||||||
|
|
||||||
|
|
||||||
class IbmPrep40pMachine(QemuSystemTest):
|
class IbmPrep40pMachine(QemuSystemTest):
|
||||||
|
@ -37,7 +34,7 @@ class IbmPrep40pMachine(QemuSystemTest):
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
|
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
|
||||||
# restricted by GSA ADP Schedule Contract with IBM Corp.
|
# restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||||
@skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
@skipUntrustedTest()
|
||||||
def test_factory_firmware_and_netbsd(self):
|
def test_factory_firmware_and_netbsd(self):
|
||||||
self.set_machine('40p')
|
self.set_machine('40p')
|
||||||
self.require_accelerator("tcg")
|
self.require_accelerator("tcg")
|
||||||
|
|
|
@ -12,10 +12,9 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import skipUnless
|
|
||||||
from qemu_test import QemuSystemTest, Asset
|
from qemu_test import QemuSystemTest, Asset
|
||||||
from qemu_test import exec_command_and_wait_for_pattern
|
from qemu_test import exec_command_and_wait_for_pattern
|
||||||
from qemu_test import wait_for_console_pattern
|
from qemu_test import wait_for_console_pattern, skipFlakyTest
|
||||||
from qemu_test.utils import gzip_uncompress
|
from qemu_test.utils import gzip_uncompress
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,9 +51,10 @@ class RxGdbSimMachine(QemuSystemTest):
|
||||||
wait_for_console_pattern(self, uboot_version)
|
wait_for_console_pattern(self, uboot_version)
|
||||||
gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'
|
gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'
|
||||||
# FIXME limit baudrate on chardev, else we type too fast
|
# FIXME limit baudrate on chardev, else we type too fast
|
||||||
|
# https://gitlab.com/qemu-project/qemu/-/issues/2691
|
||||||
#exec_command_and_wait_for_pattern(self, 'version', gcc_version)
|
#exec_command_and_wait_for_pattern(self, 'version', gcc_version)
|
||||||
|
|
||||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
|
@skipFlakyTest(bug_url="https://gitlab.com/qemu-project/qemu/-/issues/2691")
|
||||||
def test_linux_sash(self):
|
def test_linux_sash(self):
|
||||||
"""
|
"""
|
||||||
Boots a Linux kernel and checks that the console is operational.
|
Boots a Linux kernel and checks that the console is operational.
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import os
|
from qemu_test import LinuxKernelTest, Asset, skipFlakyTest
|
||||||
|
|
||||||
from qemu_test import LinuxKernelTest, Asset
|
|
||||||
from qemu_test.utils import archive_extract
|
from qemu_test.utils import archive_extract
|
||||||
from unittest import skipUnless
|
|
||||||
|
|
||||||
class R2dTest(LinuxKernelTest):
|
class R2dTest(LinuxKernelTest):
|
||||||
|
|
||||||
|
@ -18,7 +15,8 @@ class R2dTest(LinuxKernelTest):
|
||||||
|
|
||||||
# This test has a 6-10% failure rate on various hosts that look
|
# This test has a 6-10% failure rate on various hosts that look
|
||||||
# like issues with a buggy kernel.
|
# like issues with a buggy kernel.
|
||||||
@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable')
|
# XXX file tracking bug
|
||||||
|
@skipFlakyTest(bug_url=None)
|
||||||
def test_r2d(self):
|
def test_r2d(self):
|
||||||
self.set_machine('r2d')
|
self.set_machine('r2d')
|
||||||
file_path = self.ASSET_DAY09.fetch()
|
file_path = self.ASSET_DAY09.fetch()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue