1#!/usr/bin/env python3 2# 3# Functional test that boots a microblaze Linux kernel and checks the console 4# 5# Copyright (c) 2018, 2021 Red Hat, Inc. 6# 7# This work is licensed under the terms of the GNU GPL, version 2 or 8# later. See the COPYING file in the top-level directory. 9 10import time 11from qemu_test import exec_command, exec_command_and_wait_for_pattern 12from qemu_test import QemuSystemTest, Asset 13from qemu_test import wait_for_console_pattern 14from qemu_test.utils import archive_extract 15 16class MicroblazeelMachine(QemuSystemTest): 17 18 timeout = 90 19 20 ASSET_IMAGE = Asset( 21 ('http://www.qemu-advent-calendar.org/2023/download/day13.tar.gz'), 22 'b9b3d43c5dd79db88ada495cc6e0d1f591153fe41355e925d791fbf44de50c22') 23 24 def test_microblazeel_s3adsp1800(self): 25 self.require_netdev('user') 26 self.set_machine('petalogix-s3adsp1800') 27 file_path = self.ASSET_IMAGE.fetch() 28 archive_extract(file_path, self.workdir) 29 self.vm.set_console() 30 self.vm.add_args('-kernel', self.scratch_file('day13', 'xmaton.bin')) 31 tftproot = self.scratch_file('day13') 32 self.vm.add_args('-nic', f'user,tftp={tftproot}') 33 self.vm.launch() 34 wait_for_console_pattern(self, 'QEMU Advent Calendar 2023') 35 time.sleep(0.1) 36 exec_command(self, 'root') 37 time.sleep(0.1) 38 exec_command_and_wait_for_pattern(self, 39 'tftp -g -r xmaton.png 10.0.2.2 ; md5sum xmaton.png', 40 '821cd3cab8efd16ad6ee5acc3642a8ea') 41 42if __name__ == '__main__': 43 QemuSystemTest.main() 44