1 # Functional test that boots a complete Linux system via a cloud image
3 # Copyright (c) 2018-2020 Red Hat, Inc.
6 # Cleber Rosa <crosa@redhat.com>
8 # This work is licensed under the terms of the GNU GPL, version 2 or
9 # later. See the COPYING file in the top-level directory.
13 from avocado_qemu
import LinuxTest
, BUILD_DIR
15 from avocado
import skipIf
18 class BootLinuxX8664(LinuxTest
):
20 :avocado: tags=arch:x86_64
23 def test_pc_i440fx_tcg(self
):
25 :avocado: tags=machine:pc
26 :avocado: tags=accel:tcg
28 self
.require_accelerator("tcg")
29 self
.vm
.add_args("-accel", "tcg")
30 self
.launch_and_wait(set_up_ssh_connection
=False)
32 def test_pc_i440fx_kvm(self
):
34 :avocado: tags=machine:pc
35 :avocado: tags=accel:kvm
37 self
.require_accelerator("kvm")
38 self
.vm
.add_args("-accel", "kvm")
39 self
.launch_and_wait(set_up_ssh_connection
=False)
41 def test_pc_q35_tcg(self
):
43 :avocado: tags=machine:q35
44 :avocado: tags=accel:tcg
46 self
.require_accelerator("tcg")
47 self
.vm
.add_args("-accel", "tcg")
48 self
.launch_and_wait(set_up_ssh_connection
=False)
50 def test_pc_q35_kvm(self
):
52 :avocado: tags=machine:q35
53 :avocado: tags=accel:kvm
55 self
.require_accelerator("kvm")
56 self
.vm
.add_args("-accel", "kvm")
57 self
.launch_and_wait(set_up_ssh_connection
=False)
60 class BootLinuxAarch64(LinuxTest
):
62 :avocado: tags=arch:aarch64
63 :avocado: tags=machine:virt
64 :avocado: tags=machine:gic-version=2
67 def add_common_args(self
):
68 self
.vm
.add_args('-bios',
69 os
.path
.join(BUILD_DIR
, 'pc-bios',
70 'edk2-aarch64-code.fd'))
71 self
.vm
.add_args('-device', 'virtio-rng-pci,rng=rng0')
72 self
.vm
.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
74 def test_virt_tcg_gicv2(self
):
76 :avocado: tags=accel:tcg
77 :avocado: tags=cpu:max
78 :avocado: tags=device:gicv2
80 self
.require_accelerator("tcg")
81 self
.vm
.add_args("-accel", "tcg")
82 self
.vm
.add_args("-machine", "virt,gic-version=2")
83 self
.add_common_args()
84 self
.launch_and_wait(set_up_ssh_connection
=False)
86 def test_virt_tcg_gicv3(self
):
88 :avocado: tags=accel:tcg
89 :avocado: tags=cpu:max
90 :avocado: tags=device:gicv3
92 self
.require_accelerator("tcg")
93 self
.vm
.add_args("-accel", "tcg")
94 self
.vm
.add_args("-machine", "virt,gic-version=3")
95 self
.add_common_args()
96 self
.launch_and_wait(set_up_ssh_connection
=False)
98 def test_virt_kvm(self
):
100 :avocado: tags=accel:kvm
101 :avocado: tags=cpu:host
103 self
.require_accelerator("kvm")
104 self
.vm
.add_args("-accel", "kvm")
105 self
.vm
.add_args("-machine", "virt,gic-version=host")
106 self
.add_common_args()
107 self
.launch_and_wait(set_up_ssh_connection
=False)
110 class BootLinuxPPC64(LinuxTest
):
112 :avocado: tags=arch:ppc64
115 def test_pseries_tcg(self
):
117 :avocado: tags=machine:pseries
118 :avocado: tags=accel:tcg
120 self
.require_accelerator("tcg")
121 self
.vm
.add_args("-accel", "tcg")
122 self
.launch_and_wait(set_up_ssh_connection
=False)
125 class BootLinuxS390X(LinuxTest
):
127 :avocado: tags=arch:s390x
130 @skipIf(os
.getenv('GITLAB_CI'), 'Running on GitLab')
131 def test_s390_ccw_virtio_tcg(self
):
133 :avocado: tags=machine:s390-ccw-virtio
134 :avocado: tags=accel:tcg
136 self
.require_accelerator("tcg")
137 self
.vm
.add_args("-accel", "tcg")
138 self
.launch_and_wait(set_up_ssh_connection
=False)