tests/functional: Convert the tcg_plugins test

A straight forward conversion, only the usual changes were required
here (i.e. adjustment for asset downloading, machine selection).

Message-ID: <20241023051754.813412-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2024-10-23 07:17:54 +02:00
parent f5b47c7aa2
commit 3abc545e66
2 changed files with 16 additions and 23 deletions

View file

@ -3744,7 +3744,7 @@ S: Maintained
F: docs/devel/tcg-plugins.rst F: docs/devel/tcg-plugins.rst
F: plugins/ F: plugins/
F: tests/tcg/plugins/ F: tests/tcg/plugins/
F: tests/avocado/tcg_plugins.py F: tests/functional/test_aarch64_tcg_plugins.py
F: contrib/plugins/ F: contrib/plugins/
AArch64 TCG target AArch64 TCG target

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# TCG Plugins tests # TCG Plugins tests
# #
# These are a little more involved than the basic tests run by check-tcg. # These are a little more involved than the basic tests run by check-tcg.
@ -13,7 +15,7 @@ import tempfile
import mmap import mmap
import re import re
from boot_linux_console import LinuxKernelTest from qemu_test import LinuxKernelTest, Asset
class PluginKernelBase(LinuxKernelTest): class PluginKernelBase(LinuxKernelTest):
@ -53,22 +55,14 @@ class PluginKernelBase(LinuxKernelTest):
class PluginKernelNormal(PluginKernelBase): class PluginKernelNormal(PluginKernelBase):
def _grab_aarch64_kernel(self): ASSET_KERNEL = Asset(
kernel_url = ('https://storage.tuxboot.com/20230331/arm64/Image') ('https://storage.tuxboot.com/20230331/arm64/Image'),
kernel_sha256 = 'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7' 'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
kernel_path = self.fetch_asset(kernel_url,
asset_hash=kernel_sha256,
algorithm = "sha256")
return kernel_path
def test_aarch64_virt_insn(self): def test_aarch64_virt_insn(self):
""" self.set_machine('virt')
:avocado: tags=accel:tcg self.cpu='cortex-a53'
:avocado: tags=arch:aarch64 kernel_path = self.ASSET_KERNEL.fetch()
:avocado: tags=machine:virt
:avocado: tags=cpu:cortex-a53
"""
kernel_path = self._grab_aarch64_kernel()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyAMA0') 'console=ttyAMA0')
console_pattern = 'Kernel panic - not syncing: VFS:' console_pattern = 'Kernel panic - not syncing: VFS:'
@ -92,13 +86,9 @@ class PluginKernelNormal(PluginKernelBase):
def test_aarch64_virt_insn_icount(self): def test_aarch64_virt_insn_icount(self):
""" self.set_machine('virt')
:avocado: tags=accel:tcg self.cpu='cortex-a53'
:avocado: tags=arch:aarch64 kernel_path = self.ASSET_KERNEL.fetch()
:avocado: tags=machine:virt
:avocado: tags=cpu:cortex-a53
"""
kernel_path = self._grab_aarch64_kernel()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyAMA0') 'console=ttyAMA0')
console_pattern = 'Kernel panic - not syncing: VFS:' console_pattern = 'Kernel panic - not syncing: VFS:'
@ -120,3 +110,6 @@ class PluginKernelNormal(PluginKernelBase):
else: else:
count = int(m.group("count")) count = int(m.group("count"))
self.log.info(f"Counted: {count} instructions") self.log.info(f"Counted: {count} instructions")
if __name__ == '__main__':
LinuxKernelTest.main()