xref: /openbmc/qemu/tests/functional/test_ppc_mac.py (revision 2af37e791906cfda42cb9604a16d218e56994bb1)
112c0b407SThomas Huth#!/usr/bin/env python3
212c0b407SThomas Huth#
312c0b407SThomas Huth# Boot Linux kernel on a mac99 and g3beige ppc machine and check the console
412c0b407SThomas Huth#
512c0b407SThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later
612c0b407SThomas Huth
712c0b407SThomas Huthfrom qemu_test import LinuxKernelTest, Asset
812c0b407SThomas Huthfrom qemu_test.utils import archive_extract
912c0b407SThomas Huth
1012c0b407SThomas Huthclass MacTest(LinuxKernelTest):
1112c0b407SThomas Huth
1212c0b407SThomas Huth    ASSET_DAY15 = Asset(
13*67d76bdeSThomas Huth        'https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/day15.tar.xz',
1412c0b407SThomas Huth        '03e0757c131d2959decf293a3572d3b96c5a53587165bf05ce41b2818a2bccd5')
1512c0b407SThomas Huth
1612c0b407SThomas Huth    def do_day15_test(self):
1712c0b407SThomas Huth        # mac99 also works with kvm_pr but we don't have a reliable way at
1812c0b407SThomas Huth        # the moment (e.g. by looking at /proc/modules) to detect whether
1912c0b407SThomas Huth        # we're running kvm_hv or kvm_pr. For now let's disable this test
2012c0b407SThomas Huth        # if we don't have TCG support.
2112c0b407SThomas Huth        self.require_accelerator("tcg")
2212c0b407SThomas Huth
2312c0b407SThomas Huth        file_path = self.ASSET_DAY15.fetch()
2412c0b407SThomas Huth        archive_extract(file_path, self.workdir)
2512c0b407SThomas Huth        self.vm.add_args('-M', 'graphics=off')
2612c0b407SThomas Huth        self.launch_kernel(self.workdir + '/day15/invaders.elf',
2712c0b407SThomas Huth                           wait_for='QEMU advent calendar')
2812c0b407SThomas Huth
2912c0b407SThomas Huth    def test_ppc_g3beige(self):
3012c0b407SThomas Huth        self.set_machine('g3beige')
3112c0b407SThomas Huth        self.do_day15_test()
3212c0b407SThomas Huth
3312c0b407SThomas Huth    def test_ppc_mac99(self):
3412c0b407SThomas Huth        self.set_machine('mac99')
3512c0b407SThomas Huth        self.do_day15_test()
3612c0b407SThomas Huth
3712c0b407SThomas Huthif __name__ == '__main__':
3812c0b407SThomas Huth    LinuxKernelTest.main()
39