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 00000000..b24cc2a2 Binary files /dev/null and b/needles/console/anaconda_rescue_shell_prompt.png differ 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: