ui/cocoa.m: Drop old macOS-10.12-and-earlier compat ifdefs
[qemu/armbru.git] / tests / avocado / multiprocess.py
blobee7490ae084e3447379727ff8f0f97a09592765f
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, kernel_hash, initrd_url, initrd_hash,
22 kernel_command_line, 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, asset_hash=kernel_hash)
34 initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
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 kernel_hash = '5b6f6876e1b5bda314f93893271da0d5777b1f3c'
76 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
77 '/linux/releases/31/Everything/x86_64/os/images'
78 '/pxeboot/initrd.img')
79 initrd_hash = 'dd0340a1b39bd28f88532babd4581c67649ec5b1'
80 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
81 'console=ttyS0 rdinit=/bin/bash')
82 machine_type = 'pc'
83 self.do_test(kernel_url, kernel_hash, initrd_url, initrd_hash,
84 kernel_command_line, machine_type)
86 def test_multiprocess_aarch64(self):
87 """
88 :avocado: tags=arch:aarch64
89 """
90 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
91 '/linux/releases/31/Everything/aarch64/os/images'
92 '/pxeboot/vmlinuz')
93 kernel_hash = '3505f2751e2833c681de78cee8dda1e49cabd2e8'
94 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
95 '/linux/releases/31/Everything/aarch64/os/images'
96 '/pxeboot/initrd.img')
97 initrd_hash = '519a1962daf17d67fc3a9c89d45affcb399607db'
98 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
99 'rdinit=/bin/bash console=ttyAMA0')
100 machine_type = 'virt,gic-version=3'
101 self.do_test(kernel_url, kernel_hash, initrd_url, initrd_hash,
102 kernel_command_line, machine_type)