ppc/xive: Add support for the PC MMIOs
[qemu/kevin.git] / tests / avocado / multiprocess.py
blob9112a4cacc6e3cd351f8d07df9e197ef3b6a09c8
1 # Test for multiprocess qemu
3 # This work is licensed under the terms of the GNU GPL, version 2 or
4 # later. See the COPYING file in the top-level directory.
7 import os
8 import socket
10 from avocado_qemu import QemuSystemTest
11 from avocado_qemu import wait_for_console_pattern
12 from avocado_qemu import exec_command
13 from avocado_qemu import exec_command_and_wait_for_pattern
15 class Multiprocess(QemuSystemTest):
16 """
17 :avocado: tags=multiprocess
18 """
19 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
21 def do_test(self, kernel_url, initrd_url, kernel_command_line,
22 machine_type):
23 """Main test method"""
24 self.require_accelerator('kvm')
25 self.require_multiprocess()
27 # Create socketpair to connect proxy and remote processes
28 proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,
29 socket.SOCK_STREAM)
30 os.set_inheritable(proxy_sock.fileno(), True)
31 os.set_inheritable(remote_sock.fileno(), True)
33 kernel_path = self.fetch_asset(kernel_url)
34 initrd_path = self.fetch_asset(initrd_url)
36 # Create remote process
37 remote_vm = self.get_vm()
38 remote_vm.add_args('-machine', 'x-remote')
39 remote_vm.add_args('-nodefaults')
40 remote_vm.add_args('-device', 'lsi53c895a,id=lsi1')
41 remote_vm.add_args('-object', 'x-remote-object,id=robj1,'
42 'devid=lsi1,fd='+str(remote_sock.fileno()))
43 remote_vm.launch()
45 # Create proxy process
46 self.vm.set_console()
47 self.vm.add_args('-machine', machine_type)
48 self.vm.add_args('-accel', 'kvm')
49 self.vm.add_args('-cpu', 'host')
50 self.vm.add_args('-object',
51 'memory-backend-memfd,id=sysmem-file,size=2G')
52 self.vm.add_args('--numa', 'node,memdev=sysmem-file')
53 self.vm.add_args('-m', '2048')
54 self.vm.add_args('-kernel', kernel_path,
55 '-initrd', initrd_path,
56 '-append', kernel_command_line)
57 self.vm.add_args('-device',
58 'x-pci-proxy-dev,'
59 'id=lsi1,fd='+str(proxy_sock.fileno()))
60 self.vm.launch()
61 wait_for_console_pattern(self, 'as init process',
62 'Kernel panic - not syncing')
63 exec_command(self, 'mount -t sysfs sysfs /sys')
64 exec_command_and_wait_for_pattern(self,
65 'cat /sys/bus/pci/devices/*/uevent',
66 'PCI_ID=1000:0012')
68 def test_multiprocess_x86_64(self):
69 """
70 :avocado: tags=arch:x86_64
71 """
72 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
73 '/linux/releases/31/Everything/x86_64/os/images'
74 '/pxeboot/vmlinuz')
75 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
76 '/linux/releases/31/Everything/x86_64/os/images'
77 '/pxeboot/initrd.img')
78 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
79 'console=ttyS0 rdinit=/bin/bash')
80 machine_type = 'pc'
81 self.do_test(kernel_url, initrd_url, kernel_command_line, machine_type)
83 def test_multiprocess_aarch64(self):
84 """
85 :avocado: tags=arch:aarch64
86 """
87 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
88 '/linux/releases/31/Everything/aarch64/os/images'
89 '/pxeboot/vmlinuz')
90 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
91 '/linux/releases/31/Everything/aarch64/os/images'
92 '/pxeboot/initrd.img')
93 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
94 'rdinit=/bin/bash console=ttyAMA0')
95 machine_type = 'virt,gic-version=3'
96 self.do_test(kernel_url, initrd_url, kernel_command_line, machine_type)