From 29070a54f10e203f37af618e334fe20b21ef6051 Mon Sep 17 00:00:00 2001 From: Guy Menanteau Date: Mon, 4 Feb 2019 14:46:31 +0000 Subject: [PATCH] New install_repository_hd_variation use a new PREINSTALL to execute a rescue script before install. This is covering the Hard_drive_variation test as per: https://fedoraproject.org/wiki/QA:Testcase_install_repository_Hard_drive_variation Signed-off-by: Guy Menanteau --- VARIABLES.md | 1 + lib/anaconda.pm | 6 +-- lib/utils.pm | 17 ++++++- main.pm | 11 +++++ .../console/anaconda_rescue_shell_prompt.json | 22 +++++++++ .../console/anaconda_rescue_shell_prompt.png | Bin 0 -> 7031 bytes templates | 44 ++++++++++++++++++ tests/_check_install_source.pm | 5 +- tests/preinstall_iso_in_hd.pm | 26 +++++++++++ 9 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 needles/console/anaconda_rescue_shell_prompt.json create mode 100644 needles/console/anaconda_rescue_shell_prompt.png create mode 100644 tests/preinstall_iso_in_hd.pm diff --git a/VARIABLES.md b/VARIABLES.md index 1cfc1d70..4738bcf7 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -73,6 +73,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` (unless `false`) | when set, user login is set to this value. If not set, default value `test` is used for console installs, no login is done for graphical installs. If set to `false`, no user login will be done | | `USER_PASSWORD` | string | not set | should be used with `USER_LOGIN` | when set, user password is set to this value. If not set, default value `weakpassword` is used for console installs, no login is done for graphical installs | | `TEST_UPDATES` | boolean | `false`/not set | set to indicate that this test checks updates.img loading, so we should check for the expected effect of the updates image used for this testing | +| `PREINSTALL` | string | not set | nothing | If set, specified module will be loaded before reboot and install; module supposed to be starting as rescue mode | | `POSTINSTALL` | string | not set | nothing | If set, `tests/(value)_postinstall.pm` will be loaded after install, boot, login, and other postinstall tests | `UEFI` | boolean | `false`/not set | nothing | whether to use UEFI, this variable isn't usually set in test suites but in machine definition | | `ANACONDA_TEXT` | boolean | `false`/not set | all | when specified, anaconda will run in text mode | diff --git a/lib/anaconda.pm b/lib/anaconda.pm index 5887e6a6..41f6ea8a 100644 --- a/lib/anaconda.pm +++ b/lib/anaconda.pm @@ -246,9 +246,9 @@ sub custom_delete_part { sub get_full_repo { my ($repourl) = @_; # trivial thing we kept repeating: fill out an HTTP or HTTPS - # repo URL with flavor and arch, leave NFS ones alone (as for - # NFS tests we just use a mounted ISO and the URL is complete) - if ($repourl !~ m/^nfs/) { + # repo URL with flavor and arch, leave hd & NFS ones alone + # (as for those tests we just use a mounted ISO and URL is complete) + if ($repourl !~ m/^(nfs|hd:)/) { # Everything variant doesn't exist for modular composes atm, # only Server my $variant = 'Everything'; diff --git a/lib/utils.pm b/lib/utils.pm index 1d30ca5e..d4d9e8f7 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -7,7 +7,7 @@ use Exporter; use lockapi; use testapi; -our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode/; +our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -902,3 +902,18 @@ sub select_rescue_mode { assert_screen "rescue_select", 120; # it takes time to start anaconda } + +sub copy_devcdrom_as_isofile { + # copy /dev/cdrom as iso file and verify checksum is same + # as cdrom previously retrieved from ISO_URL + my $isoname = shift; + assert_script_run "dd if=/dev/cdrom of=$isoname", 360; + # verify iso checksum + my $cdurl = get_var('ISO_URL'); + my $cmd = </tmp/x +sha256sum -c /tmp/x +EOF + assert_script_run($_) foreach (split /\n/, $cmd); +} diff --git a/main.pm b/main.pm index ce868f87..878e5f39 100644 --- a/main.pm +++ b/main.pm @@ -356,6 +356,17 @@ elsif ((!get_var("START_AFTER_TEST") && !get_var("BOOTFROM")) || get_var("INSTAL # for now we can assume START_AFTER_TEST and BOOTFROM mean the # test picks up after an install, so we skip to post-install, # unless the override INSTALL var is set + + if (get_var("PREINSTALL")) { + # specified module supposed to first boot to rescue mode + # do any required actions before to exit rescue mode (triggering reboot). + # reboot will run through next normal install steps of load_install_tests. + my @pis = split(/ /, get_var("PREINSTALL")); + foreach my $pi (@pis) { + autotest::loadtest "tests/${pi}.pm"; + } + } + load_install_tests; } diff --git a/needles/console/anaconda_rescue_shell_prompt.json b/needles/console/anaconda_rescue_shell_prompt.json new file mode 100644 index 00000000..1293e767 --- /dev/null +++ b/needles/console/anaconda_rescue_shell_prompt.json @@ -0,0 +1,22 @@ +{ + "area": [ + { + "xpos": 0, + "ypos": 527, + "width": 21, + "height": 108, + "type": "match" + }, + { + "xpos": 49, + "ypos": 528, + "width": 169, + "height": 16, + "type": "match" + } + ], + "properties": [], + "tags": [ + "rescue_shell_prompt" + ] +} \ No newline at end of file diff --git a/needles/console/anaconda_rescue_shell_prompt.png b/needles/console/anaconda_rescue_shell_prompt.png new file mode 100644 index 0000000000000000000000000000000000000000..b24cc2a25818483ac2eafd4583da3e7a676554c6 GIT binary patch literal 7031 zcmd6McUTk8*YE5mfzSzEP)bArg-|S1A@D^35dv6|-cb-ir4!gFDhdK35*rYej)F*$ z8Y4)tAqoi66{JfqF%Wp;@80iy-uM1<|Gm%7K4;GCIkPiocFugx*&8<2W&*s@yZ`_J z3v*LD0MMK&3cx51Y3^WWa0tK6kz)rr6o7)iS3$w)$E+s+$n3N*H9i*B^E=%tvA6c? zRl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b{_oUp~zPZ359%1_H4u4o4KT+%BnP5pn9Ly=wX0FR057 zube42vtB1fjnUH z7;A_lbXo_xAiA6Hqulu+(mmwQyGz^iEl>eXw(-OONoYgF5Y*SV4AC~bGcBQarABRQG{sY zgAf-#6bs-xa@T?@09N==y1w1vHAZ;>rf%h>DDe*NncU`K?Q8@aKnihlKeL)R&_wP0i;L)JfHY)Z+6b z&G(B7zD@}xkprT%DUXDbBu%>E_{*Zqt^$8eLek#i--+vAIJg_(sGKLMYc`!rD4{no z7qToj7hRm}Fk!o4|5xg{=x&2)HibRaV25P8qxWb+@8((#>@RB=^6M5N|xn7hWq-$a?sjJS$~t%@T*;n zoT)Xdu13yVi+aT%!;R7jXE~O$sZ6NcnzP|YHP@ha$C9lQ>?A4acO24>Wo}l$1`^Py#9TLa zPD%;-xdn2TD*$Ad>Jm=$JN3_Q&OL3-H^-XO#)KK*iN8_SJaa3Tl!-Bppl+hh@Dh1& z3F7#Cr_DYRtlDF?+J#{*{Q5oNwN}|5;1TtmfbMRpRAPjG?3}?%4~u5C**P&Y z`{mr%nV)lFzC{vKg){@Ih1fZfGfQvIv^O&Q&gqd&BiO>jIg!8jr<)$Is|jgutej8` zc+X1OEc4rZd!;R8ZGpMM{5?Olzv)%;`QG!{qEX>dkqPtJs`;T5s+rT~j_5VkT2g)g zcdz!EjqYzwQA!mttr9xl62`pxGr))EHIc%ui-7^(*R2!%>%zm-A^N?2I*XglxI-g4 UhDNvk{y?)hXl+_#;(GbN03Zg(8~^|S literal 0 HcmV?d00001 diff --git a/templates b/templates index 6293baf5..07b171da 100755 --- a/templates +++ b/templates @@ -710,6 +710,17 @@ }, test_suite => { name => "install_repository_nfs_graphical" }, }, + { + machine => { name => "64bit" }, + prio => 30, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "install_repository_hd_variation" }, + }, { machine => { name => "64bit" }, prio => 20, @@ -2124,6 +2135,18 @@ }, test_suite => { name => "install_repository_nfs_graphical" }, }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 30, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "install_repository_hd_variation" }, + }, { group_name => "Fedora PowerPC", machine => { name => "ppc64le" }, @@ -3744,6 +3767,18 @@ }, test_suite => { name => "install_repository_nfs_graphical" }, }, + { + group_name => "Fedora AArch64", + machine => { name => "aarch64" }, + prio => 30, + product => { + arch => "aarch64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "install_repository_hd_variation" }, + }, { group_name => "Fedora AArch64", machine => { name => "aarch64" }, @@ -4941,6 +4976,15 @@ { key => "WORKER_CLASS", value => "tap" }, ], }, + { + name => "install_repository_hd_variation", + settings => [ + { key => "PREINSTALL", value => "preinstall_iso_in_hd" }, + { key => "REPOSITORY_VARIATION", value => "hd:vdb1:/fedora_image.iso;" }, + { key => "NUMDISKS", value => "2" }, + { key => "HDD_2", value => "disk_full_mbr.img" }, + ], + }, { name => "install_delete_partial", settings => [ diff --git a/tests/_check_install_source.pm b/tests/_check_install_source.pm index a1b07ee7..09efb72f 100644 --- a/tests/_check_install_source.pm +++ b/tests/_check_install_source.pm @@ -31,7 +31,10 @@ sub run { assert_script_run 'grep "enabled repo.*nfs" /tmp/packaging.log'; } } - if ($repourl =~ s/^nfs://) { + if ($repourl =~ /^hd:/) { + assert_script_run "mount |grep 'fedora_image.iso'"; + } + elsif ($repourl =~ s/^nfs://) { $repourl =~ s/^nfsvers=.://; # the above both checks if we're dealing with an NFS URL, and # strips the 'nfs:' and 'nfsvers=.:' from it if so diff --git a/tests/preinstall_iso_in_hd.pm b/tests/preinstall_iso_in_hd.pm new file mode 100644 index 00000000..f8dd4435 --- /dev/null +++ b/tests/preinstall_iso_in_hd.pm @@ -0,0 +1,26 @@ +use base "anacondatest"; +use strict; +use testapi; +use utils; + +sub run { + select_rescue_mode; + # select rescue shell and expect shell prompt + type_string "3\n"; + send_key "ret"; + assert_screen "rescue_shell_prompt", 5; # should be shell prompt + assert_script_run "fdisk -l | head -n20"; + assert_script_run "mkdir -p /hd"; + assert_script_run "mount /dev/vdb1 /hd"; + copy_devcdrom_as_isofile('/hd/fedora_image.iso'); + assert_script_run "umount /hd"; + type_string "exit\n"; # leave rescue mode. +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: