Revert "hmp: Use QAPI NetdevInfo in hmp_info_network"
[qemu/kevin.git] / tests / acceptance / multiprocess.py
blob96627f022a86105413601eeb13cd3a43a72294b3
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 Test
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(Test):
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')
26 # Create socketpair to connect proxy and remote processes
27 proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,
28 socket.SOCK_STREAM)
29 os.set_inheritable(proxy_sock.fileno(), True)
30 os.set_inheritable(remote_sock.fileno(), True)
32 kernel_path = self.fetch_asset(kernel_url)
33 initrd_path = self.fetch_asset(initrd_url)
35 # Create remote process
36 remote_vm = self.get_vm()
37 remote_vm.add_args('-machine', 'x-remote')
38 remote_vm.add_args('-nodefaults')
39 remote_vm.add_args('-device', 'lsi53c895a,id=lsi1')
40 remote_vm.add_args('-object', 'x-remote-object,id=robj1,'
41 'devid=lsi1,fd='+str(remote_sock.fileno()))
42 remote_vm.launch()
44 # Create proxy process
45 self.vm.set_console()
46 self.vm.add_args('-machine', machine_type)
47 self.vm.add_args('-accel', 'kvm')
48 self.vm.add_args('-cpu', 'host')
49 self.vm.add_args('-object',
50 'memory-backend-memfd,id=sysmem-file,size=2G')
51 self.vm.add_args('--numa', 'node,memdev=sysmem-file')
52 self.vm.add_args('-m', '2048')
53 self.vm.add_args('-kernel', kernel_path,
54 '-initrd', initrd_path,
55 '-append', kernel_command_line)
56 self.vm.add_args('-device',
57 'x-pci-proxy-dev,'
58 'id=lsi1,fd='+str(proxy_sock.fileno()))
59 self.vm.launch()
60 wait_for_console_pattern(self, 'as init process',
61 'Kernel panic - not syncing')
62 exec_command(self, 'mount -t sysfs sysfs /sys')
63 exec_command_and_wait_for_pattern(self,
64 'cat /sys/bus/pci/devices/*/uevent',
65 'PCI_ID=1000:0012')
67 def test_multiprocess_x86_64(self):
68 """
69 :avocado: tags=arch:x86_64
70 """
71 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
72 '/linux/releases/31/Everything/x86_64/os/images'
73 '/pxeboot/vmlinuz')
74 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
75 '/linux/releases/31/Everything/x86_64/os/images'
76 '/pxeboot/initrd.img')
77 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
78 'console=ttyS0 rdinit=/bin/bash')
79 machine_type = 'pc'
80 self.do_test(kernel_url, initrd_url, kernel_command_line, machine_type)
82 def test_multiprocess_aarch64(self):
83 """
84 :avocado: tags=arch:aarch64
85 """
86 kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
87 '/linux/releases/31/Everything/aarch64/os/images'
88 '/pxeboot/vmlinuz')
89 initrd_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
90 '/linux/releases/31/Everything/aarch64/os/images'
91 '/pxeboot/initrd.img')
92 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
93 'rdinit=/bin/bash console=ttyAMA0')
94 machine_type = 'virt,gic-version=3'
95 self.do_test(kernel_url, initrd_url, kernel_command_line, machine_type)