1# Functional test that boots a complete Linux system via a cloud image 2# 3# Copyright (c) 2018-2020 Red Hat, Inc. 4# 5# Author: 6# Cleber Rosa <crosa@redhat.com> 7# 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. 10 11import os 12 13from avocado_qemu import LinuxTest, BUILD_DIR 14 15from avocado import skipIf 16 17 18class BootLinuxX8664(LinuxTest): 19 """ 20 :avocado: tags=arch:x86_64 21 """ 22 23 def test_pc_i440fx_tcg(self): 24 """ 25 :avocado: tags=machine:pc 26 :avocado: tags=accel:tcg 27 """ 28 self.require_accelerator("tcg") 29 self.vm.add_args("-accel", "tcg") 30 self.launch_and_wait(set_up_ssh_connection=False) 31 32 def test_pc_i440fx_kvm(self): 33 """ 34 :avocado: tags=machine:pc 35 :avocado: tags=accel:kvm 36 """ 37 self.require_accelerator("kvm") 38 self.vm.add_args("-accel", "kvm") 39 self.launch_and_wait(set_up_ssh_connection=False) 40 41 def test_pc_q35_tcg(self): 42 """ 43 :avocado: tags=machine:q35 44 :avocado: tags=accel:tcg 45 """ 46 self.require_accelerator("tcg") 47 self.vm.add_args("-accel", "tcg") 48 self.launch_and_wait(set_up_ssh_connection=False) 49 50 def test_pc_q35_kvm(self): 51 """ 52 :avocado: tags=machine:q35 53 :avocado: tags=accel:kvm 54 """ 55 self.require_accelerator("kvm") 56 self.vm.add_args("-accel", "kvm") 57 self.launch_and_wait(set_up_ssh_connection=False) 58 59 60class BootLinuxAarch64(LinuxTest): 61 """ 62 :avocado: tags=arch:aarch64 63 :avocado: tags=machine:virt 64 :avocado: tags=machine:gic-version=2 65 """ 66 timeout = 240 67 68 def add_common_args(self): 69 self.vm.add_args('-bios', 70 os.path.join(BUILD_DIR, 'pc-bios', 71 'edk2-aarch64-code.fd')) 72 self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0') 73 self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom') 74 75 def test_virt_tcg_gicv2(self): 76 """ 77 :avocado: tags=accel:tcg 78 :avocado: tags=cpu:max 79 :avocado: tags=device:gicv2 80 """ 81 self.require_accelerator("tcg") 82 self.vm.add_args("-accel", "tcg") 83 self.vm.add_args("-cpu", "max,lpa2=off") 84 self.vm.add_args("-machine", "virt,gic-version=2") 85 self.add_common_args() 86 self.launch_and_wait(set_up_ssh_connection=False) 87 88 def test_virt_tcg_gicv3(self): 89 """ 90 :avocado: tags=accel:tcg 91 :avocado: tags=cpu:max 92 :avocado: tags=device:gicv3 93 """ 94 self.require_accelerator("tcg") 95 self.vm.add_args("-accel", "tcg") 96 self.vm.add_args("-cpu", "max,lpa2=off") 97 self.vm.add_args("-machine", "virt,gic-version=3") 98 self.add_common_args() 99 self.launch_and_wait(set_up_ssh_connection=False) 100 101 def test_virt_kvm(self): 102 """ 103 :avocado: tags=accel:kvm 104 :avocado: tags=cpu:host 105 """ 106 self.require_accelerator("kvm") 107 self.vm.add_args("-accel", "kvm") 108 self.vm.add_args("-machine", "virt,gic-version=host") 109 self.add_common_args() 110 self.launch_and_wait(set_up_ssh_connection=False) 111 112 113class BootLinuxPPC64(LinuxTest): 114 """ 115 :avocado: tags=arch:ppc64 116 """ 117 118 timeout = 180 119 120 def test_pseries_tcg(self): 121 """ 122 :avocado: tags=machine:pseries 123 :avocado: tags=accel:tcg 124 """ 125 self.require_accelerator("tcg") 126 self.vm.add_args("-accel", "tcg") 127 self.launch_and_wait(set_up_ssh_connection=False) 128 129 130class BootLinuxS390X(LinuxTest): 131 """ 132 :avocado: tags=arch:s390x 133 """ 134 135 timeout = 240 136 137 @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') 138 def test_s390_ccw_virtio_tcg(self): 139 """ 140 :avocado: tags=machine:s390-ccw-virtio 141 :avocado: tags=accel:tcg 142 """ 143 self.require_accelerator("tcg") 144 self.vm.add_args("-accel", "tcg") 145 self.launch_and_wait(set_up_ssh_connection=False) 146