From 338b4bf51395a69d519249b548a37439af6ca6b1 Mon Sep 17 00:00:00 2001 From: Petr Schindler Date: Tue, 15 Sep 2015 11:04:01 +0200 Subject: [PATCH] Adds uefi support to tests where it makes sense What changed: * There is a new needle for uefi bootloader. * UEFI postinstallation phase * UEFI tests and machine added to template --- VARIABLES.md | 1 + main.pm | 4 + needles/bootloader_uefi.json | 21 +++++ needles/bootloader_uefi.png | Bin 0 -> 2710 bytes templates | 152 +++++++++++++++++++++++++++++++++++ tests/_boot_to_anaconda.pm | 25 +++++- tests/uefi_postinstall.pm | 27 +++++++ 7 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 needles/bootloader_uefi.json create mode 100644 needles/bootloader_uefi.png create mode 100644 tests/uefi_postinstall.pm diff --git a/VARIABLES.md b/VARIABLES.md index 8ce54873..49f30429 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -69,6 +69,7 @@ it also means that `B` conflicts `A` even if not shown in the table). | `USER_LOGIN` | string | not set | should be used with `USER_PASSWORD` | when set, user login is set to this value | | `USER_PASSWORD` | string | not set | should be used with `USER_LOGIN` | when set, user password is set to this value | | `BOOT_UPDATES_IMG_URL` | boolean | `false`/not set | set to indicate that path to updates.img was appended to kernel line | +| `UEFI` | boolean | `false`/not set | nothing | whether to use UEFI, this variable isn't usually set in test suites but in machine definition | Run variables ------------- diff --git a/main.pm b/main.pm index 3bad6325..df15e6cc 100644 --- a/main.pm +++ b/main.pm @@ -161,6 +161,10 @@ else $storagepost = $loc if (-e $loc); } autotest::loadtest $storagepost if ($storagepost); + + if (get_var("UEFI")) { + autotest::loadtest get_var('CASEDIR')."/tests/uefi_postinstall.pm"; + } } diff --git a/needles/bootloader_uefi.json b/needles/bootloader_uefi.json new file mode 100644 index 00000000..359e4115 --- /dev/null +++ b/needles/bootloader_uefi.json @@ -0,0 +1,21 @@ +{ + "tags": [ + "ENV-DESKTOP-gnome", + "ENV-DISTRI-fedora", + "ENV-FLAVOR-server_boot", + "ENV-FLAVOR-workstation_live", + "ENV-LANGUAGE-ALL", + "ENV-UEFI-1", + "bootloader_uefi" + ], + "area": [ + { + "width": 140, + "height": 14, + "xpos": 126, + "type": "match", + "ypos": 140 + } + ], + "properties": [] +} diff --git a/needles/bootloader_uefi.png b/needles/bootloader_uefi.png new file mode 100644 index 0000000000000000000000000000000000000000..e0e61b3a0fb0fb9cbf5e60dec6ad8968dfdf57d4 GIT binary patch literal 2710 zcmdT^`BT&P7X5sa2nJb1#XdHHG9m)97#1A}L=6u_Br!rj!4L|;mQ_I6m#@BurYu^Q zKq|W<3W10X280lZr79%?zCIJyB*2rULI8;nFf0%IH@unl-Cxd~xijaSxp&U}p6KVL zrD31}0MI(=jVA$s+G>#if!u=E@7Bw=08RAu_uRtN)Kn&u*__gh1wh05B>tFx>X3Z+ zSmJQ&uG}%(f)Kuj4lms!#lupYpLf=%DxDDzNDm^cUF=+%_OD*F3d1}9Z43kDc@+%a zwb@)7`(}&sFIYNA;$cj5K3$w)mv}M<(YPw+a3+$z za6movC?aTJn_#$(viK`B8wlb!j|~xZr0Q8iL3B6cJY!wc-nx8`>G841`{1Cbw{F;B zOv|LR%fA(f0ew@7-kq=CM2J7TA>v9yqOlYFgg>@EatKse0uX}T zAL$(9zUJ7WjPlSiZEE0$tGYj}=+%_#kII*1(D;wgh`ZWK&E!dlT>a30rglB>R~2g{ z`;$z87Zkgjnt48ZLX5E76UX-QR$|bZ7O*j}cnz6)-OOO3+EJB%x61ycPu*(*xv7j6 z8UP_%?>Q5h3?D(bElt6*wAzAI`sFCRmFRt*_c~0t))6vSH6=q=R%kC^H(mbe_7{xa z|Ffmh9biwABqk&#{{Dm8siSWq=Xgu&_WprF$^DWxeuf5F&VoPJ{~q%lqBi#)irCp zcWyZ;_h;YRVR=8?Wbern>uEHL^>lBcsEyXTd4stE@GH&9RIQ-)?G|DmYEKlp|vpqQ##Y?}zSuw1ipumZUz z&mWs2TyyYh9Ml)Qu^A6>c+A@^s1k+kDo{su$&ZU2zi#%sh=0GVpMtk~UC&f>(hKN9 za_v29MpR<;zHhg$i5JhLY*_1U{{S@z|Pn-4KC4h2_0Z(G-=c&i-=1$Nsk z`8f*t&U|jki+;_XAuZTB4qOPq4k?jF9-P_ujXhB{S2~O{x?<)ww+q%&Y-_VaLH5e} zV=#a7qc@nB7A^OVAf8Kd)e%8lnNCbX*TJ>Kv;iXHOGRnmY`St6| zHL)VrySJ?0j6vzVa+!Wvr(@g^B~=g28@LXCqdA=TOyQ77*ycD~=#uzj8-K23p_>%>`E$ z0>ag6etH!Pj{tFyxg8KcHv~PRmnANDFO))oEw^Sbs|^^iWr(*B4z#JSNC<@$J1$|- zufnvS>t>cs!o(2h7gzW>dZ$dANKVeuAL(o`dXj9u;xl2N=n9K>=a7VXB1cK0wSx#XO-wn=F=p6DXH>^ z)>S#T4$%EoO { name => "default_install" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "workstation_live", + version => "*", + }, + test_suite => { name => "default_install" }, + }, { machine => { name => "64bit" }, product => { @@ -26,6 +36,16 @@ }, test_suite => { name => "default_install" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "server_boot", + version => "*", + }, + test_suite => { name => "default_install" }, + }, { machine => { name => "64bit" }, product => { @@ -36,6 +56,16 @@ }, test_suite => { name => "default_install" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "generic_boot", + version => "*", + }, + test_suite => { name => "default_install" }, + }, { machine => { name => "64bit" }, product => { @@ -96,6 +126,16 @@ }, test_suite => { name => "server_delete_pata" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_delete_pata" }, + }, { machine => { name => "64bit" }, product => { @@ -126,6 +166,16 @@ }, test_suite => { name => "server_sata_multi" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_sata_multi" }, + }, { machine => { name => "64bit" }, product => { @@ -216,6 +266,96 @@ }, test_suite => { name => "server_no_swap" }, }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_simple_encrypted" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_simple_free_space" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_multi_empty" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_software_raid" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_delete_partial" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_btrfs" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_ext3" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_lvmthin" }, + }, + { + machine => { name => "uefi" }, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "server_no_swap" }, + }, { machine => { name => "64bit" }, product => { @@ -570,6 +710,18 @@ ], variables => "", }, + { + backend => "qemu", + name => "uefi", + settings => [ + { key => "QEMUCPU", value => "qemu64" }, + { key => "QEMUCPUS", value => "2"}, + { key => "QEMUVGA", value => "std"}, + { key => "QEMURAM", value => "2048"}, + { key => "UEFI", value => "1"} + ], + variables => "", + }, ], Products => [ { diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index efa9b6bc..787f63fc 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -2,9 +2,25 @@ use base "anacondatest"; use strict; use testapi; +# get_kernel_line switches to menu edit screen and sets the cursor to the end of kernel line +sub get_kernel_line { + if( get_var("UEFI")){ + send_key "e"; + send_key "down"; + send_key "down"; + send_key "end"; + } else { + send_key "tab"; + } +} + sub run { # Wait for bootloader to appear - assert_screen "bootloader", 30; + if( get_var("UEFI")){ + assert_screen "bootloader_uefi", 30; + } else { + assert_screen "bootloader", 30; + } # Make sure we skip media check if it's selected by default. Standard # 'boot installer' menu entry is always first. @@ -13,7 +29,7 @@ sub run { # if variable GRUB is set, add its value into kernel line in grub if( get_var("GRUB")){ - send_key "tab"; + get_kernel_line; type_string " ".get_var("GRUB"); } @@ -21,7 +37,7 @@ sub run { # if variable REPOSITORY_VARIATION is set, construct inst.repo url and add it to kernel line if (get_var("REPOSITORY_VARIATION")){ unless (get_var("GRUB")){ - send_key "tab"; + get_kernel_line; } my $fedora_version = ""; my $repourl = ""; @@ -35,6 +51,9 @@ sub run { } # now we are on the correct "boot" menu item + # hit Ctrl+x for the case when the uefi kernel line was edited + send_key "ctrl-x"; + # Return starts boot in all other cases send_key "ret"; unless (get_var("KICKSTART")) diff --git a/tests/uefi_postinstall.pm b/tests/uefi_postinstall.pm new file mode 100644 index 00000000..e2807361 --- /dev/null +++ b/tests/uefi_postinstall.pm @@ -0,0 +1,27 @@ +use base "installedtest"; +use strict; +use testapi; + +sub run { + my $self=shift; + if (not( check_screen "root_console", 0)) { + $self->root_console(tty=>3); + } + assert_screen "root_console"; + # this test shows if the system is booted with efi + type_string 'reset; [ -d /sys/firmware/efi/ ]; echo $?'; + send_key "ret"; + assert_screen "console_command_success"; +} + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: