qemu/tests/functional/test_ppc_bamboo.py
Daniel P. Berrangé beaf88c895 tests/functional: switch over to using self.scratch_file()
Replace any instances of

  os.path.join(self.workdir, ".../...")
  self.workdir + "/.../..."

with

  self.scratch_file("...", "...")

which is more compact and portable

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-15-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-12-17 19:39:53 +01:00

45 lines
1.7 KiB
Python
Executable file

#!/usr/bin/env python3
#
# Test that Linux kernel boots on the ppc bamboo board and check the console
#
# Copyright (c) 2021 Red Hat
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
from qemu_test.utils import archive_extract
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern
from qemu_test import exec_command_and_wait_for_pattern
class BambooMachine(QemuSystemTest):
timeout = 90
ASSET_IMAGE = Asset(
('http://landley.net/aboriginal/downloads/binaries/'
'system-image-powerpc-440fp.tar.gz'),
'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e')
def test_ppc_bamboo(self):
self.set_machine('bamboo')
self.require_accelerator("tcg")
self.require_netdev('user')
file_path = self.ASSET_IMAGE.fetch()
archive_extract(file_path, self.workdir)
self.vm.set_console()
self.vm.add_args('-kernel',
self.scratch_file('system-image-powerpc-440fp',
'linux'),
'-initrd',
self.scratch_file('system-image-powerpc-440fp',
'rootfs.cpio.gz'),
'-nic', 'user,model=rtl8139,restrict=on')
self.vm.launch()
wait_for_console_pattern(self, 'Type exit when done')
exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2',
'10.0.2.2 is alive!')
exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
if __name__ == '__main__':
QemuSystemTest.main()