diff --git a/qemu/tests/cfg/seabios.cfg b/qemu/tests/cfg/seabios.cfg index bb66b1dac6d42e6aa22c0d10ec70919a397f5873..35dde78dfb25194a2fa6a636d7cabb81bdb9aea2 100644 --- a/qemu/tests/cfg/seabios.cfg +++ b/qemu/tests/cfg/seabios.cfg @@ -1,26 +1,31 @@ - seabios: install setup image_copy unattended_install.cdrom no Host_RHEL.m5 - only i386, x86_64 - type = seabios start_vm = no - restart_vm = no - kill_vm = yes - boot_menu = on - enable_sga = yes - image_verify_bootable = no - boot_menu_key = "f12" - Host_RHEL.m7: - boot_menu_key = "esc" - boot_menu_hint = "Press .*(F12|ESC) for boot menu" - # Specify the boot device name which you want to test here. - boot_device = "iPXE" - Host_RHEL.m6: - boot_device = "gPXE" - # SGA Bios info message, using sep as ";" - # Please update this message to suit for your own system. - restart_key = "ctrl-alt-delete" - Host_RHEL: - sgabios_info = "Google, Inc.\s" - sgabios_info += "Serial Graphics Adapter .*\s" - sgabios_info += "SGABIOS \$Id: sgabios.S .*\s" - sgabios_info += "\d \d\s" + variants: + - basic: + only i386, x86_64 + type = seabios + restart_vm = no + kill_vm = yes + boot_menu = on + enable_sga = yes + image_verify_bootable = no + boot_menu_key = "f12" + Host_RHEL.m7: + boot_menu_key = "esc" + boot_menu_hint = "Press .*(F12|ESC) for boot menu" + # Specify the boot device name which you want to test here. + boot_device = "iPXE" + Host_RHEL.m6: + boot_device = "gPXE" + # SGA Bios info message, using sep as ";" + # Please update this message to suit for your own system. + restart_key = "ctrl-alt-delete" + Host_RHEL: + sgabios_info = "Google, Inc.\s" + sgabios_info += "Serial Graphics Adapter .*\s" + sgabios_info += "SGABIOS \$Id: sgabios.S .*\s" + sgabios_info += "\d \d\s" + - bin_file: + type = seabios_bin + machine_type_remove = "Supported none pc q35" diff --git a/qemu/tests/seabios_bin.py b/qemu/tests/seabios_bin.py new file mode 100644 index 0000000000000000000000000000000000000000..09897fd41688a048a9211372811e1bb80cf69fd6 --- /dev/null +++ b/qemu/tests/seabios_bin.py @@ -0,0 +1,60 @@ +import logging + +from virttest import error_context +from virttest import env_process +from virttest import utils_misc + +from avocado.utils import process + + +@error_context.context_aware +def run(test, params, env): + """ + KVM Seabios bin file test: + 1) Get available bin files + 2) Get supported machine types + 3) Check bin file in use + + :param test: QEMU test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment. + """ + + bin_dict = {'rhel6': 'bios.bin', 'rhel7': 'bios-256k.bin'} + + error_context.context("Get available bin files", logging.info) + output = process.system_output('ls /usr/share/seabios', shell=True).decode() + for value in bin_dict.values(): + if value not in output: + test.fail("%s is not available" % value) + + error_context.context("Get supported machine types", logging.info) + qemu_binary = utils_misc.get_qemu_binary(params) + machine_type_cmd = qemu_binary + " -machine help | awk '{ print $1 }'" + output = process.system_output(machine_type_cmd, shell=True).decode() + machine_types = output.splitlines() + machine_type_remove = params['machine_type_remove'].split() + for i in machine_type_remove: + machine_types.remove(i) + logging.info(machine_types) + + for machine in machine_types: + error_context.context("Check bin file with machine type: %s" % machine, + logging.info) + for key in bin_dict: + if key in machine: + bin_file = bin_dict[key] + break + else: + test.error("Uncertain which bin file in use for machine type: %s" + % machine) + + params['machine_type'] = machine + params['start_vm'] = 'yes' + env_process.preprocess_vm(test, params, env, params.get("main_vm")) + vm = env.get_vm(params["main_vm"]) + info_roms = vm.monitor.info("roms") + if bin_file not in info_roms: + test.fail("Checking bin file fails with %s, info roms: %s" + % (machine, info_roms)) + vm.destroy()