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.linuxtest import LinuxTest 14from avocado_qemu import BUILD_DIR 15 16from avocado import skipUnless 17 18 19class BootLinuxX8664(LinuxTest): 20 """ 21 :avocado: tags=arch:x86_64 22 """ 23 timeout = 480 24 25 def test_pc_i440fx_tcg(self): 26 """ 27 :avocado: tags=machine:pc 28 :avocado: tags=accel:tcg 29 """ 30 self.require_accelerator("tcg") 31 self.vm.add_args("-accel", "tcg") 32 self.launch_and_wait(set_up_ssh_connection=False) 33 34 def test_pc_i440fx_kvm(self): 35 """ 36 :avocado: tags=machine:pc 37 :avocado: tags=accel:kvm 38 """ 39 self.require_accelerator("kvm") 40 self.vm.add_args("-accel", "kvm") 41 self.launch_and_wait(set_up_ssh_connection=False) 42 43 def test_pc_q35_tcg(self): 44 """ 45 :avocado: tags=machine:q35 46 :avocado: tags=accel:tcg 47 """ 48 self.require_accelerator("tcg") 49 self.vm.add_args("-accel", "tcg") 50 self.launch_and_wait(set_up_ssh_connection=False) 51 52 def test_pc_q35_kvm(self): 53 """ 54 :avocado: tags=machine:q35 55 :avocado: tags=accel:kvm 56 """ 57 self.require_accelerator("kvm") 58 self.vm.add_args("-accel", "kvm") 59 self.launch_and_wait(set_up_ssh_connection=False) 60 61 62# For Aarch64 we only boot KVM tests in CI as booting the current 63# Fedora OS in TCG tests is very heavyweight. There are lighter weight 64# distros which we use in the machine_aarch64_virt.py tests. 65class BootLinuxAarch64(LinuxTest): 66 """ 67 :avocado: tags=arch:aarch64 68 :avocado: tags=machine:virt 69 """ 70 timeout = 720 71 72 def test_virt_kvm(self): 73 """ 74 :avocado: tags=accel:kvm 75 :avocado: tags=cpu:host 76 """ 77 self.require_accelerator("kvm") 78 self.vm.add_args("-accel", "kvm") 79 self.vm.add_args("-machine", "virt,gic-version=host") 80 self.vm.add_args('-bios', 81 os.path.join(BUILD_DIR, 'pc-bios', 82 'edk2-aarch64-code.fd')) 83 self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0') 84 self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom') 85 self.launch_and_wait(set_up_ssh_connection=False) 86 87 88# See the tux_baseline.py tests for almost the same coverage in a lot 89# less time. 90class BootLinuxPPC64(LinuxTest): 91 """ 92 :avocado: tags=arch:ppc64 93 """ 94 95 timeout = 360 96 97 @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited') 98 def test_pseries_tcg(self): 99 """ 100 :avocado: tags=machine:pseries 101 :avocado: tags=accel:tcg 102 """ 103 self.require_accelerator("tcg") 104 self.vm.add_args("-accel", "tcg") 105 self.launch_and_wait(set_up_ssh_connection=False) 106 107 def test_pseries_kvm(self): 108 """ 109 :avocado: tags=machine:pseries 110 :avocado: tags=accel:kvm 111 """ 112 self.require_accelerator("kvm") 113 self.vm.add_args("-accel", "kvm") 114 self.vm.add_args("-machine", "cap-ccf-assist=off") 115 self.launch_and_wait(set_up_ssh_connection=False) 116 117class BootLinuxS390X(LinuxTest): 118 """ 119 :avocado: tags=arch:s390x 120 """ 121 122 timeout = 240 123 124 @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited') 125 def test_s390_ccw_virtio_tcg(self): 126 """ 127 :avocado: tags=machine:s390-ccw-virtio 128 :avocado: tags=accel:tcg 129 """ 130 self.require_accelerator("tcg") 131 self.vm.add_args("-accel", "tcg") 132 self.launch_and_wait(set_up_ssh_connection=False) 133