diff options
author | Thomas Huth <thuth@redhat.com> | 2024-12-06 11:23:52 +0100 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2024-12-11 09:18:39 +0100 |
commit | bade2d51fb3a0ad73ffa0d369bdf56ced698074d (patch) | |
tree | 59b62672978b1eeaa4f778c1762417742f84d639 /tests/functional | |
parent | 490d25e6c52b0c32f78b5176d64cf20a53fde51a (diff) | |
download | qemu-bade2d51fb3a0ad73ffa0d369bdf56ced698074d.zip qemu-bade2d51fb3a0ad73ffa0d369bdf56ced698074d.tar.gz qemu-bade2d51fb3a0ad73ffa0d369bdf56ced698074d.tar.bz2 |
tests/functional: Convert the emcraft_sf2 avocado test
A pretty straight-forward conversion of the emcraft_sf2 boot
test to the functional framework.
This was the last test that used file_truncate() in
boot_linux_console.py, so we can remove that function from that
file now, too.
Message-ID: <20241206102358.1186644-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/meson.build | 1 | ||||
-rwxr-xr-x | tests/functional/test_arm_emcraft_sf2.py | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 6e22d8f..af38494 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -71,6 +71,7 @@ tests_arm_system_thorough = [ 'arm_bpim2u', 'arm_canona1100', 'arm_collie', + 'arm_emcraft_sf2', 'arm_integratorcp', 'arm_orangepi', 'arm_raspi2', diff --git a/tests/functional/test_arm_emcraft_sf2.py b/tests/functional/test_arm_emcraft_sf2.py new file mode 100755 index 0000000..ada4dfd --- /dev/null +++ b/tests/functional/test_arm_emcraft_sf2.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import shutil + +from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pattern +from qemu_test.utils import file_truncate + +class EmcraftSf2Machine(LinuxKernelTest): + + ASSET_UBOOT = Asset( + ('https://raw.githubusercontent.com/Subbaraya-Sundeep/qemu-test-binaries/' + 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot'), + '5c6a15103375db11b21f2236473679a9dbbed6d89652bfcdd501c263d68ab725') + + ASSET_SPI = Asset( + ('https://raw.githubusercontent.com/Subbaraya-Sundeep/qemu-test-binaries/' + 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin'), + 'cd9bdd2c4cb55a59c3adb6bcf74881667c4500dde0570a43aa3be2b17eecfdb6') + + def test_arm_emcraft_sf2(self): + self.set_machine('emcraft-sf2') + self.require_netdev('user') + + uboot_path = self.ASSET_UBOOT.fetch() + spi_path = self.ASSET_SPI.fetch() + spi_path_rw = os.path.join(self.workdir, 'spi.bin') + shutil.copy(spi_path, spi_path_rw) + os.chmod(spi_path_rw, 0o600) + + file_truncate(spi_path_rw, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB + + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + self.vm.add_args('-kernel', uboot_path, + '-append', kernel_command_line, + '-drive', 'file=' + spi_path_rw + ',if=mtd,format=raw', + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Enter \'help\' for a list') + + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15', + 'eth0: link becomes ready') + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + '3 packets transmitted, 3 packets received, 0% packet loss') + +if __name__ == '__main__': + LinuxKernelTest.main() |