1#!/usr/bin/env python3 2# 3# Functional test that boots known good tuxboot images the same way 4# that tuxrun (www.tuxrun.org) does. This tool is used by things like 5# the LKFT project to run regression tests on kernels. 6# 7# Copyright (c) 2023 Linaro Ltd. 8# 9# Author: 10# Alex Bennée <alex.bennee@linaro.org> 11# 12# SPDX-License-Identifier: GPL-2.0-or-later 13 14from qemu_test import Asset, exec_command_and_wait_for_pattern 15from qemu_test.tuxruntest import TuxRunBaselineTest 16 17class TuxRunSh4Test(TuxRunBaselineTest): 18 19 ASSET_SH4_KERNEL = Asset( 20 'https://storage.tuxboot.com/20230331/sh4/zImage', 21 '29d9b2aba604a0f53a5dc3b5d0f2b8e35d497de1129f8ee5139eb6fdf0db692f') 22 ASSET_SH4_ROOTFS = Asset( 23 'https://storage.tuxboot.com/20230331/sh4/rootfs.ext4.zst', 24 '3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd') 25 26 def test_sh4(self): 27 self.set_machine('r2d') 28 self.cpu='sh7785' 29 self.root='sda' 30 self.console='ttySC1' 31 32 # The test is currently too unstable to do much in userspace 33 # so we skip common_tuxrun and do a minimal boot and shutdown. 34 (kernel, disk, dtb) = self.fetch_tuxrun_assets(self.ASSET_SH4_KERNEL, 35 self.ASSET_SH4_ROOTFS) 36 37 # the console comes on the second serial port 38 self.prepare_run(kernel, disk, 39 "driver=ide-hd,bus=ide.0,unit=0", 40 console_index=1) 41 self.vm.launch() 42 43 self.wait_for_console_pattern("tuxtest login:") 44 exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#') 45 exec_command_and_wait_for_pattern(self, 'halt', 46 "reboot: System halted") 47 48if __name__ == '__main__': 49 TuxRunBaselineTest.main() 50