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