From c7a1b94c8419583c34b6d45d889d765261b148b4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 28 Oct 2020 14:20:16 -0700 Subject: [PATCH] Enable aarch64 disk image testing, related fixes This sets us up to test the release-blocking aarch64 disk images (Minimal, Server and Workstation). It also allows for testing armhfp disk images on aarch64 worker hosts (though my testing of that isn't going too well so far), and fixes the initial-setup handling for a change upstream ('use password' is now the default so we don't need to choose it). We rewire disk image deployment test loading to work through the generic loader code rather than using ENTRYPOINT, as it allows us to more gracefully handle graphical (Workstation) vs. console (Server, Minimal), moving the code for handling console initial-setup to a helper function just like the code for gnome-initial-setup and having _console_ wait_login call it when appropriate. We also tweak desktop_vt a bit because now we need to switch from a console running as test to a desktop, which breaks the assumption that the highest numbered session of user test is the desktop... Signed-off-by: Adam Williamson --- fifloader.py | 2 +- lib/utils.pm | 68 +++++++++++++++++++++++-- main.pm | 7 +-- templates.fif.json | 60 +++++++++++++++++++--- tests/_console_wait_login.pm | 12 ++--- tests/_graphical_wait_login.pm | 13 ++++- tests/install_arm_image_deployment.pm | 72 --------------------------- 7 files changed, 136 insertions(+), 98 deletions(-) delete mode 100644 tests/install_arm_image_deployment.pm diff --git a/fifloader.py b/fifloader.py index 17a8feab..25199848 100755 --- a/fifloader.py +++ b/fifloader.py @@ -211,7 +211,7 @@ def generate_job_templates(products, profiles, testsuites): jobtemplate['group_name'] = "Fedora PowerPC Updates" else: jobtemplate['group_name'] = "Fedora PowerPC" - elif jobtemplate['machine_name'] == 'aarch64': + elif jobtemplate['machine_name'] in ('aarch64', 'ARM'): if 'updates' in product['flavor']: jobtemplate['group_name'] = "Fedora AArch64 Updates" else: diff --git a/lib/utils.pm b/lib/utils.pm index c2491112..229e2311 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 repo_setup setup_workaround_repo cleanup_workaround_repo gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper/; +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 repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper/; # We introduce this global variable to hold the list of applications that have # registered during the apps_startstop_test when they have sucessfully run. @@ -66,11 +66,15 @@ sub get_release_number { # at a root console sub desktop_vt { # use loginctl or ps to find the tty of test's session (loginctl) - # or Xwayland or Xorg (ps); as of 2019-09 on F31 update tests - # ps -C is giving 'tty?', so adding loginctl works around that + # or gnome-session, Xwayland or Xorg (ps); as of 2019-09 we often + # get tty? for Xwayland and Xorg processes, so using loginctl can + # help my $xout; - # don't fail test if we don't find any process, just guess tty1 - eval { $xout = script_output ' loginctl | grep test; ps -C Xwayland,Xorg -o tty --no-headers'; }; + # don't fail test if we don't find any process, just guess tty1. + # os-autoinst calls the script with 'bash -e' which causes it to + # stop as soon as any command fails, so we use ||: to make the + # first grep return 0 even if it matches nothing + eval { $xout = script_output ' loginctl | grep test ||:; ps -e | egrep "(gnome-session|Xwayland|Xorg)" | grep -o tty[0-9]' }; my $tty = 1; # default while ($xout =~ /tty(\d)/g) { $tty = $1; # most recent match is probably best @@ -596,6 +600,60 @@ sub repo_setup { assert_script_run "rm -f /etc/yum.repos.d/fedora-cisco-openh264.repo"; } +sub console_initial_setup { + # Handle console initial-setup. Currently used only for ARM disk + # image tests. + assert_screen "console_initial_setup", 500; + # IMHO it's better to use sleeps than to have needle for every text screen + wait_still_screen 5; + + # Set timezone + type_string "2\n"; + wait_still_screen 5; + type_string "1\n"; # Set timezone + wait_still_screen 5; + type_string "1\n"; # Europe + wait_still_screen 5; + type_string "37\n"; # Prague + wait_still_screen 7; + + # Set root password + type_string "4\n"; + wait_still_screen 5; + type_string get_var("ROOT_PASSWORD") || "weakpassword"; + send_key "ret"; + wait_still_screen 5; + type_string get_var("ROOT_PASSWORD") || "weakpassword"; + send_key "ret"; + wait_still_screen 7; + + # Create user + type_string "5\n"; + wait_still_screen 5; + type_string "1\n"; # create new + wait_still_screen 5; + type_string "3\n"; # set username + wait_still_screen 5; + type_string get_var("USER_LOGIN", "test"); + send_key "ret"; + wait_still_screen 5; + type_string "5\n"; # set password + wait_still_screen 5; + type_string get_var("USER_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 5; + type_string get_var("USER_PASSWORD", "weakpassword"); + send_key "ret"; + wait_still_screen 5; + type_string "6\n"; # make him an administrator + wait_still_screen 5; + type_string "c\n"; + wait_still_screen 7; + + assert_screen "console_initial_setup_done", 30; + type_string "c\n"; # continue +} + sub gnome_initial_setup { # Handle gnome-initial-setup, with variations for the pre-login # mode (when no user was created during install) and post-login diff --git a/main.pm b/main.pm index d6fdd423..8b36feb7 100644 --- a/main.pm +++ b/main.pm @@ -365,10 +365,11 @@ if (get_var("ENTRYPOINT")) { elsif (get_var("UPGRADE")) { load_upgrade_tests; } -elsif ((!get_var("START_AFTER_TEST") && !get_var("BOOTFROM")) || get_var("INSTALL")) { +elsif ((!get_var("START_AFTER_TEST") && !get_var("BOOTFROM") && !get_var("IMAGE_DEPLOY")) || get_var("INSTALL")) { # 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 + # test picks up after an install, and IMAGE_DEPLOY means we're + # deploying a disk image (no installer) so in those cases 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 diff --git a/templates.fif.json b/templates.fif.json index b83226b6..6b3c910c 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -24,8 +24,8 @@ "QEMU_NO_KVM": "1", "QEMU_VIRTIO_RNG": "1", "SERIALDEV": "ttyAMA0", - "TIMEOUT_SCALE": "5", - "WORKER_CLASS": "qemu_x86_64" + "TIMEOUT_SCALE": "1.5", + "WORKER_CLASS": "qemu_aarch64" } }, "aarch64": { @@ -179,11 +179,21 @@ }, "version": "*" }, + "fedora-Minimal-raw_xz-raw.xz-aarch64-*": { + "arch": "aarch64", + "distri": "fedora", + "flavor": "Minimal-raw_xz-raw.xz", + "settings": { + "TEST_TARGET": "HDD_2" + }, + "version": "*" + }, "fedora-Minimal-raw_xz-raw.xz-arm-*": { "arch": "arm", "distri": "fedora", "flavor": "Minimal-raw_xz-raw.xz", "settings": { + "APPEND": "rw root=LABEL=_/ rootwait console=ttyAMA0 console=tty0 consoleblank=0", "TEST_TARGET": "HDD_2" }, "version": "*" @@ -243,6 +253,15 @@ }, "version": "*" }, + "fedora-Server-raw_xz-raw.xz-aarch64-*": { + "arch": "aarch64", + "distri": "fedora", + "flavor": "Server-raw_xz-raw.xz", + "settings": { + "TEST_TARGET": "HDD_2" + }, + "version": "*" + }, "fedora-Silverblue-dvd_ostree-iso-ppc64le-*": { "arch": "ppc64le", "distri": "fedora", @@ -293,6 +312,16 @@ }, "version": "*" }, + "fedora-Workstation-raw_xz-raw.xz-aarch64-*": { + "arch": "aarch64", + "distri": "fedora", + "flavor": "Workstation-raw_xz-raw.xz", + "settings": { + "DESKTOP": "gnome", + "TEST_TARGET": "HDD_2" + }, + "version": "*" + }, "fedora-universal-aarch64-*": { "arch": "aarch64", "distri": "fedora", @@ -370,6 +399,10 @@ "machine": "uefi", "product": "fedora-KDE-live-iso-x86_64-*" }, + "fedora-Minimal-raw_xz-raw.xz-aarch64-*-aarch64": { + "machine": "aarch64", + "product": "fedora-Minimal-raw_xz-raw.xz-aarch64-*" + }, "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": { "machine": "ARM", "product": "fedora-Minimal-raw_xz-raw.xz-arm-*" @@ -406,6 +439,10 @@ "machine": "uefi", "product": "fedora-Server-dvd-iso-x86_64-*" }, + "fedora-Server-raw_xz-raw.xz-aarch64-*-aarch64": { + "machine": "aarch64", + "product": "fedora-Server-raw_xz-raw.xz-aarch64-*" + }, "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": { "machine": "ppc64le", "product": "fedora-Silverblue-dvd_ostree-iso-ppc64le-*" @@ -430,6 +467,10 @@ "machine": "uefi", "product": "fedora-Workstation-live-iso-x86_64-*" }, + "fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": { + "machine": "aarch64", + "product": "fedora-Workstation-raw_xz-raw.xz-aarch64-*" + }, "fedora-universal-aarch64-*-aarch64": { "machine": "aarch64", "product": "fedora-universal-aarch64-*" @@ -580,10 +621,12 @@ }, "base_services_start_arm": { "profiles": { - "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": 42 + "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": 42, + "fedora-Minimal-raw_xz-raw.xz-aarch64-*-aarch64": 42, + "fedora-Server-raw_xz-raw.xz-aarch64-*-aarch64": 42, + "fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": 42 }, "settings": { - "APPEND": "rw root=LABEL=_/ rootwait console=ttyAMA0 console=tty0 consoleblank=0", "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", "NUMDISKS": "1", "POSTINSTALL": "base_services_start", @@ -843,12 +886,15 @@ }, "install_arm_image_deployment_upload": { "profiles": { - "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": 12 + "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": 12, + "fedora-Minimal-raw_xz-raw.xz-aarch64-*-aarch64": 12, + "fedora-Server-raw_xz-raw.xz-aarch64-*-aarch64": 12, + "fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": 12 }, "settings": { - "APPEND": "rw root=LABEL=_/ rootwait console=ttyAMA0 console=tty0 consoleblank=0", - "ENTRYPOINT": "install_arm_image_deployment _console_shutdown", "HDD_1": "%HDD_2%", + "IMAGE_DEPLOY": "1", + "INSTALL_NO_USER": "1", "NUMDISKS": "1", "STORE_HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2" } diff --git a/tests/_console_wait_login.pm b/tests/_console_wait_login.pm index 94538cb7..b885249e 100644 --- a/tests/_console_wait_login.pm +++ b/tests/_console_wait_login.pm @@ -15,15 +15,9 @@ sub run { $wait_time = 240; } - # handle initial-setup, if we're expecting it (IoT < F32 install test) - my $testname = get_var("TEST"); - my $subvariant = get_var("SUBVARIANT"); - my $version = get_release_number; - if ($subvariant eq "IoT" && $version < 32 && index($testname, 'install') != -1) { - assert_screen "console_initial_setup", $wait_time; - type_string "q\n"; - type_string "yes\n"; - $wait_time = 180; + # handle initial-setup, if we're expecting it (ARM disk image) + if (get_var("INSTALL_NO_USER")) { + console_initial_setup; } # Wait for the text login diff --git a/tests/_graphical_wait_login.pm b/tests/_graphical_wait_login.pm index 249bee95..88e4c850 100644 --- a/tests/_graphical_wait_login.pm +++ b/tests/_graphical_wait_login.pm @@ -5,6 +5,7 @@ use utils; sub run { my $self = shift; + my $password = get_var("USER_PASSWORD", "weakpassword"); my $version = get_var("VERSION"); # If KICKSTART is set, then the wait_time needs to consider the # install time. if UPGRADE, we have to wait for the entire upgrade @@ -49,7 +50,6 @@ sub run { send_key "ret"; } assert_screen "graphical_login_input"; - my $password = get_var("USER_PASSWORD", "weakpassword"); if (get_var("SWITCHED_LAYOUT")) { # see _do_install_and_reboot; when layout is switched # user password is doubled to contain both US and native @@ -86,6 +86,17 @@ sub run { else { record_soft_failure "'getting started' missing (probably BGO#790811)"; } + # if this was an image deployment, we also need to create + # root user now, for subsequent tests to work + if (get_var("IMAGE_DEPLOY")) { + send_key "ctrl-alt-f3"; + console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword")); + type_string "sudo su\n"; + type_string "$password\n"; + my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; + assert_script_run "echo 'root:$root_password' | chpasswd"; + desktop_vt; + } } # Move the mouse somewhere it won't highlight the match areas diff --git a/tests/install_arm_image_deployment.pm b/tests/install_arm_image_deployment.pm deleted file mode 100644 index b6cdce53..00000000 --- a/tests/install_arm_image_deployment.pm +++ /dev/null @@ -1,72 +0,0 @@ -use base "installedtest"; -use strict; -use testapi; -use utils; - -sub run { - my $self = shift; - assert_screen "console_initial_setup", 500; - # IMHO it's better to use sleeps than to have needle for every text screen - wait_still_screen 5; - - # Set timezone - type_string "2\n"; - wait_still_screen 5; - type_string "1\n"; # Set timezone - wait_still_screen 5; - type_string "1\n"; # Europe - wait_still_screen 5; - type_string "37\n"; # Prague - wait_still_screen 7; - - # Set root password - type_string "4\n"; - wait_still_screen 5; - type_string get_var("ROOT_PASSWORD") || "weakpassword"; - send_key "ret"; - wait_still_screen 5; - type_string get_var("ROOT_PASSWORD") || "weakpassword"; - send_key "ret"; - wait_still_screen 7; - - # Create user - type_string "5\n"; - wait_still_screen 5; - type_string "1\n"; # create new - wait_still_screen 5; - type_string "3\n"; # set username - wait_still_screen 5; - type_string get_var("USER_LOGIN", "test"); - send_key "ret"; - wait_still_screen 5; - type_string "4\n"; # use password - wait_still_screen 5; - type_string "5\n"; # set password - wait_still_screen 5; - type_string get_var("USER_PASSWORD", "weakpassword"); - send_key "ret"; - wait_still_screen 5; - type_string get_var("USER_PASSWORD", "weakpassword"); - send_key "ret"; - wait_still_screen 5; - type_string "6\n"; # make him an administrator - wait_still_screen 5; - type_string "c\n"; - wait_still_screen 7; - - assert_screen "console_initial_setup_done", 30; - type_string "c\n"; # continue - assert_screen "text_console_login", 60; - - # Try to log in as an user - console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword")); -} - - -sub test_flags { - return { fatal => 1 }; -} - -1; - -# vim: set sw=4 et: