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 10from qemu_test import exec_command_and_wait_for_pattern 11from qemu_test import QemuSystemTest, Asset 12from qemu_test import wait_for_console_pattern 13 14 15class MicroblazeelMachine(QemuSystemTest): 16 17 timeout = 90 18 19 ASSET_IMAGE_LE = Asset( 20 ('http://www.qemu-advent-calendar.org/2023/download/day13.tar.gz'), 21 'b9b3d43c5dd79db88ada495cc6e0d1f591153fe41355e925d791fbf44de50c22') 22 23 def do_xmaton_le_test(self, machine): 24 self.require_netdev('user') 25 self.set_machine(machine) 26 self.archive_extract(self.ASSET_IMAGE_LE) 27 self.vm.set_console() 28 self.vm.add_args('-kernel', self.scratch_file('day13', 'xmaton.bin')) 29 tftproot = self.scratch_file('day13') 30 self.vm.add_args('-nic', f'user,tftp={tftproot}') 31 self.vm.launch() 32 wait_for_console_pattern(self, 'QEMU Advent Calendar 2023') 33 wait_for_console_pattern(self, 'buildroot login:') 34 exec_command_and_wait_for_pattern(self, 'root', '#') 35 exec_command_and_wait_for_pattern(self, 36 'tftp -g -r xmaton.png 10.0.2.2 ; md5sum xmaton.png', 37 '821cd3cab8efd16ad6ee5acc3642a8ea') 38 39 def test_microblaze_s3adsp1800_legacy_le(self): 40 self.do_xmaton_le_test('petalogix-s3adsp1800') 41 42if __name__ == '__main__': 43 QemuSystemTest.main() 44