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