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