diff --git a/neon/tests/install/ubiquity_oem.pm b/neon/tests/install/ubiquity_oem.pm index 9759f82..0e413fc 100644 --- a/neon/tests/install/ubiquity_oem.pm +++ b/neon/tests/install/ubiquity_oem.pm @@ -1,193 +1,193 @@ # Copyright (C) 2016-2018 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "livetest_neon"; use strict; use testapi; sub run { my ($self) = shift; $self->boot; # Divert installation data to live data. my $user = $testapi::username; my $password = $testapi::password; $testapi::username = 'neon'; $testapi::password = ''; # wait for the desktop to appear assert_screen 'live-desktop', 360; # The oem installation itself also a tz selection, its different from the # oem-config though (which we'll intercept below, separately). select_console 'log-console'; { assert_script_run 'wget ' . data_url('geoip_service.rb'), 16; script_sudo 'systemd-run ruby `pwd`/geoip_service.rb', 16; } select_console 'x11'; # Installer assert_and_click "installer-icon"; assert_screen "oem-installer-welcome", 60; record_soft_failure 'ubiquity tab order is wrong, continue before oem label'; send_key 'tab'; # continue button send_key 'tab'; # language combobox send_key 'tab'; # oem label type_string 'frenchfries'; assert_and_click "installer-next"; assert_screen 'installer-keyboard', 16; assert_and_click 'installer-next'; assert_screen "installer-prepare", 16; assert_and_click "installer-next"; assert_screen "installer-disk", 16; assert_and_click "installer-install-now"; - assert_and_click "installer-disk-confirm", button => 'left', timeout => 16; + assert_and_click "installer-disk-confirm", timeout => 16; # Timezone has 75% fuzzyness as timezone is geoip'd so its fairly divergent. # Also, starting here only the top section of the window gets matched as # the bottom part with the buttons now has a progressbar and status # text which is non-deterministic. # NB: we give way more leeway on the new needle appearing as disk IO can # cause quite a bit of slowdown and ubiquity's transition policy is # fairly weird when moving away from the disk page. assert_screen "installer-timezone", 60; assert_and_click "installer-next"; assert_screen "oem-installer-user", 16; # We are in the password field already. Username is oem by default type_string get_var("OEM_PASSWORD"); send_key "tab", 1; # 2nd password field type_string get_var("OEM_PASSWORD"); # all fields filled (not matching hostname field) assert_screen "oem-installer-user-complete", 16; assert_and_click "installer-next"; assert_screen "installer-show", 10; # Let install finish and restart assert_screen "installer-restart", 60 * 15; assert_and_click "installer-restart-now"; assert_screen "live-remove-medium", 60; send_key "ret"; reset_consoles; # Set OEM installation data. $testapi::username = get_var("OEM_USERNAME"); $testapi::password = get_var("OEM_PASSWORD"); assert_screen 'oem-desktop', 60 * 3; # TODO: should be moved ot some lib thingy for re-use across tests # This is done here because we needn't have oem-config running as it'd lock # the database so we can't change the tz config anymore. select_console 'log-console'; { assert_script_run 'wget ' . data_url('geoip_service.rb'), 16; script_sudo 'systemd-run ruby `pwd`/geoip_service.rb', 16; } select_console 'x11'; assert_screen 'oem-desktop'; # Switch into OEM mode. assert_and_click 'oem-prepare'; assert_screen 'oem-prepare-polkit'; type_password; send_key 'ret', 1; select_console 'log-console'; script_sudo 'reboot', 0; reset_consoles; # OEM configuration. assert_screen 'oem-config', 60 * 3; # needs to reboot; can take a while. # FIXME: should install a service and be done with it select_console 'log-console'; { script_sudo 'systemd-run ruby `pwd`/geoip_service.rb', 16; } select_console 'oem-config'; # Runs on tty1 actually. != x11 assert_screen 'oem-config'; assert_and_click "installer-next"; assert_screen 'oem-config-keyboard', 16; assert_and_click 'installer-next'; assert_screen 'oem-config-timezone'; assert_and_click "installer-next"; assert_screen "oem-config-user", 16; type_string $user; # user in user field, name field (needle doesn't include hostname in match) assert_screen "oem-config-user-user", 16; send_key "tab", 1; # username field send_key "tab", 1; # 1st password field type_string $password; send_key "tab", 1; # 2nd password field type_string $password; # all fields filled (not matching hostname field) assert_screen "oem-config-user-complete", 16; assert_and_click "installer-next"; assert_screen "oem-config-show", 10; # Set final installation data. # We do this before we expect sddm. If things fail at this point the oem # user may no longer be functional; the final user should work fine though. # Otherwise a failure in the transition to sddm may result in no useful # data being archived. $testapi::username = $user; $testapi::password = $password; # NB: oem-config closes all sessions, so for all intents and purposes # it is like the system was restarted and we need to reset our console # states. reset_consoles; # Once config is done we are expected to end up on sddm. assert_screen 'sddm', 60 * 10; } sub post_fail_hook { my ($self) = shift; $self->SUPER::post_fail_hook; select_console 'log-console'; # Uploads end up in wok/ulogs/ assert_script_run 'journalctl --no-pager -b 0 > /tmp/journal.txt'; upload_logs '/tmp/journal.txt'; assert_script_sudo 'tar cfJ /tmp/installer.tar.xz /var/log/installer'; upload_logs '/tmp/installer.tar.xz'; } 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 { important => 1, fatal => 1 }; } 1; diff --git a/neon/tests/install/upgrade_bionic.pm b/neon/tests/install/upgrade_bionic.pm index d6f78c7..73a8565 100644 --- a/neon/tests/install/upgrade_bionic.pm +++ b/neon/tests/install/upgrade_bionic.pm @@ -1,304 +1,304 @@ # Copyright (C) 2018 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "basetest_neon"; use testapi; sub run { my ($self) = @_; $self->boot_to_dm; # Setup a second user with an encrypted home. In ubiquity we never really # disabled home encryption as we didn't wanna support it but then it was # working fine and we had no reason to take away something that works. # Now we pay the price for that niceness. # As a basic requirement we'll want encrypted homes to be still encrypted # and accessible after the upgrade. Since we do not install encrypted # images though we'll have to manually setup an encrypted home first. # This isn't perfectly representive of how a ubiquity encrypted home # may look like, but it should be close enough. my $encrypt_user = 'encrypty'; my $encrypt_password = 'password'; select_console 'log-console'; { # https://help.ubuntu.com/community/EncryptedHome assert_script_sudo 'apt update', 60; assert_script_sudo 'apt install -y ecryptfs-utils', 60 * 5; # Simulate an oddity where some users seem to somehow ended up with # ecryptfs-utils only being a transitive auto dep that would end up # in the remove list of the upgrade. assert_script_sudo 'apt-mark auto ecryptfs-utils', 16; script_sudo "adduser --gecos '' --encrypt-home --force $encrypt_user", 0; assert_screen 'adduser-password1'; type_string $encrypt_password; send_key 'ret'; assert_screen 'adduser-password2'; type_string $encrypt_password; send_key 'ret'; assert_screen 'adduser-done'; # Give the new user sudo privs so they may actually chown the serial # device for logging. assert_script_sudo "adduser $encrypt_user sudo"; script_run 'logout', 0; assert_screen 'tty6-selected'; type_string $encrypt_user; send_key 'ret'; assert_screen 'tty-password'; type_password $encrypt_password; send_key 'ret'; # This is a bit stupid but we don't actually have a better way to # check except for looking at a completely new needle. Go with this # for now. sleep 4; validate_script_output 'ls', sub { m/^$/ }; assert_script_run 'touch marker'; validate_script_output 'ls', sub { m/^marker$/ }; script_run 'logout', 0; reset_consoles; # Relogin by simply switching to the console again. select_console 'log-console'; # Cache sudo password & make sure the home is unmounted! # https://wiki.ubuntu.com/EncryptedHomeFolder # Sometimes pam fails to unmount your folder (esp if use # graphical login), leaving it open even though your logged out. script_sudo "umount /home/$encrypt_user"; # ...and make sure the home is encrypted! validate_script_output "sudo ls /home/$encrypt_user", sub { m/.*Access-Your-Private-Data\.desktop.*/ }; # Take away sudo access again so it doesn't show up in polkit. assert_script_sudo "deluser $encrypt_user sudo"; } select_console 'x11'; $self->login; assert_screen 'folder-desktop'; if (!check_screen('folder-desktop-color', 4)) { # TODO: drop once all images have been rotated (~mid Sept 2018) record_soft_failure 'Testing an old disk image without static wallpaper'; mouse_set 400, 300; mouse_click 'right'; assert_and_click 'plasma-context-config-folder'; assert_and_click 'plasma-folder-config-background'; assert_and_click 'plasma-folder-config-background-color'; # Should the deafault ever become undesirable: #1d99f3 is the lovely color. assert_and_click 'kcm-ok'; } # Should now be lovely blue. assert_screen 'folder-desktop-color'; # x11_start_program 'distro-release-notifier'; x11_start_program 'konsole'; assert_screen 'konsole'; # Assert that the notifier was auto-started. assert_script_run 'pidof distro-release-notifier'; # And trigger a devel upgrade. type_string 'neon-preview-upgrade; exit'; send_key 'ret'; assert_and_click 'distro-release-notifier'; assert_and_click 'distro-release-notifier-2'; assert_screen 'ubuntu-upgrade-polkit'; type_password $testapi::password; send_key 'ret'; assert_screen 'ubuntu-upgrade-fetcher-notes'; assert_and_click 'ubuntu-upgrade-fetcher-notes'; assert_screen 'ubuntu-upgrade'; # ... preparation happens ... - assert_and_click 'ubuntu-upgrade-start', button => 'left', timeout => 60 * 5; + assert_and_click 'ubuntu-upgrade-start', timeout => 60 * 5; # A config was changed by us to force the bionic upgrade to be enabled, # we should get a diff prompt. - assert_and_click 'ubuntu-upgrade-diff-2', button => 'left', timeout => 60 * 10; + assert_and_click 'ubuntu-upgrade-diff-2', timeout => 60 * 10; # (This has a super long time out because upgrading an all-packages # install takes forever) # TODO: consider finding a better way to detect problems than such a long # time out. maybe assert [remove, standardwindow], if the window gets # covered by an error or unexpected dialog we'd then abort immediately. assert_screen [qw(ubuntu-upgrade-error ubuntu-upgrade-remove)], 60 * 30; if (match_has_tag('ubuntu-upgrade-error')) { die 'We got error while upgrading.'; } assert_and_click 'ubuntu-upgrade-remove', 'left'; assert_screen 'ubuntu-upgrade-restart', 60 * 5; # upload logs in case something went wrong! select_console 'log-console'; { assert_script_sudo 'tar -cJf /tmp/dist-upgrade.tar.xz /var/log/dist-upgrade/'; upload_logs '/tmp/dist-upgrade.tar.xz'; my %type_to_path = ( 'unstable' => 'unstable', 'testing' => 'testing', 'useredition' => 'user', 'userltsedition' => 'user/lts' ); my $path = $type_to_path{get_var('TYPE')}; # NB: this hardcodes unstable, when we introduce other tests this needs # fixing somehow (map types to repos in a hash?) validate_script_output "cat /etc/apt/sources.list.d/neon.list", sub { m{.*^(\s?)deb(\s?)http://archive.neon.kde.org/$path(\s?)bionic(\s?)main.*} }; # Attempt a dist-upgrade. This should not cause any downgrades # as per T9535. Upgrading at this point would fail since downgrades # are not allowed by default and we've not enabled them either. assert_script_sudo 'DEBIAN_FRONTEND=noninteractive apt -y dist-upgrade', 30 * 60; } select_console 'x11'; assert_and_click 'ubuntu-upgrade-restart'; # Switch to bionic mode now. # This among other things makes sure the right virtual terminals will be # used for x11 etc. set_var 'OPENQA_SERIES', 'bionic', reload_needles => 1; console('x11')->set_tty(1); reset_consoles; $self->boot_to_dm; # NB: bionic has really awkward behavior if you log out of the getty # it gets closed and you get dumped back to an active VT (i.e. SDDM). # This screws up console consistency! # As a result logout is followed by reset and there's sleeps in place to # ensure VTs are fully active by the time we attempt to select another one. my $user = $testapi::username; my $password = $testapi::password; # Before handing over to subsequent tests we'll assert encrypted homes # are still working. select_console 'log-console'; { # We don't have access... validate_script_output "sudo ls /home/$encrypt_user", sub { m/.*Access-Your-Private-Data\.desktop.*/ }; # Give the encrypted user sudo privs so they may actually chown the # serial device for logging. assert_script_sudo "adduser $encrypt_user sudo"; # Switch to encrypted user and make sure it still has access to # its data after the upgrade though... script_run 'logout', 0; reset_consoles; # Wait a bit before switching around again sleep 1; } select_console 'x11'; # Wait a bit before switching back. Since x11 doesn't assert a screen we # could be switching too quickly and end up on the wrong VT. sleep 2; # Log into encrypted user next. $testapi::username = $encrypt_user; $testapi::password = $encrypt_password; select_console 'log-console'; { assert_script_run 'ls'; validate_script_output 'ls', sub { m/^marker$/ }; # And pop back to regular user. script_run 'logout', 0; reset_consoles; # Wait a bit before switching around again sleep 1; } select_console 'x11'; # Wait a bit before switching back. Since x11 doesn't assert a screen we # could be switching too quickly and end up on the wrong VT. sleep 2; # And back into regular user. $testapi::username = $user; $testapi::password = $password; # Make sure the evdev driver is installed. We prefer evdev at this time # instead of libinput since our KCMs aren't particularly awesome for # libinput. select_console 'log-console'; { # Cache sudo password & make sure the home is unmounted! # https://wiki.ubuntu.com/EncryptedHomeFolder # Sometimes pam fails to unmount your folder (esp if use # graphical login), leaving it open even though your logged out. script_sudo "umount /home/$encrypt_user"; # Delete the encrypted user. assert_script_sudo "deluser $encrypt_user"; # Make sure the evdev driver is installed. We prefer evdev at this time # instead of libinput since our KCMs aren't particularly awesome for # libinput. assert_script_run 'dpkg -s xserver-xorg-input-evdev'; validate_script_output 'grep -e "Using input driver" /var/log/Xorg.0.log', sub { m/.+evdev.+/ }; # Also assert that the upgrade's preference file is no longer present # T9535 assert_script_run '[ ! -e /etc/apt/preferences.d/98-xenial-overrides ]' } select_console 'x11'; } sub post_fail_hook { my ($self) = shift; $self->SUPER::post_fail_hook; select_console 'log-console'; # Check if the upgrader is running on the system bus. script_run 'qdbus --system | grep -i ubuntu'; save_screenshot; upload_logs '/var/log/dpkg.log'; upload_logs '/var/log/apt/term.log'; upload_logs '/var/log/apt/history.log'; # Try to get the dist upgrade log. It might not exist depending on when # the failure occured though. script_sudo 'tar -cJf /tmp/dist-upgrade.tar.xz /var/log/dist-upgrade/'; upload_logs '/tmp/dist-upgrade.tar.xz', failok => 1; } 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 { important => 1, fatal => 1 }; } 1; diff --git a/neon/tests/install_ubiquity.pm b/neon/tests/install_ubiquity.pm index 6aa8406..95db5b5 100644 --- a/neon/tests/install_ubiquity.pm +++ b/neon/tests/install_ubiquity.pm @@ -1,193 +1,193 @@ # Copyright (C) 2016-2017 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "livetest_neon"; use strict; use testapi; my $user = $testapi::username; my $password = $testapi::password; sub assert_keyboard_page { assert_screen 'installer-keyboard', 16; # On bionic the keyboard is by default !english when installing !english, # this is a problem because we need english keyboard maps to do input # via openqa. So, once we've asserted the default keyboard page, change it # to use english instead. if (match_has_tag('installer-keyboard-espanol')) { # Open the combobox assert_and_click 'installer-keyboard'; # Jump close to english (ingles). type_string 'in'; # At the time of writing there is a # crasher when selecting certain english variants, so we can't just # type this out. We'll move arrow down from 'in' until we have found # en_US. my $counter = 20; while (!check_screen('installer-keyboard-select-en-us', 1)) { if (!$counter--) { last; } send_key 'down'; sleep 1; } assert_and_click 'installer-keyboard-select-en-us'; } # Make sure we've now ended up with the standard en-us keyboard setup. assert_screen 'installer-keyboard-en-us', 2; assert_and_click 'installer-next'; } # Prepares live session for install. This expects a newly booted system. sub prepare { my ($self) = shift; select_console 'log-console'; { assert_script_run 'wget ' . data_url('geoip_service.rb'), 16; script_sudo 'systemd-run ruby `pwd`/geoip_service.rb', 16; } select_console 'x11'; $self->maybe_switch_offline; } # Runs an install. # @param disk_empty whether the disk is empty (when not empty it will be wiped) sub install { my ($self, %args) = @_; $args{disk_empty} //= 1; # Installer assert_and_click "installer-icon"; assert_screen "installer-welcome", 60; if (get_var('OPENQA_INSTALLATION_NONENGLISH')) { assert_and_click 'installer-welcome-click'; send_key 'down'; send_key 'ret'; assert_screen 'installer-welcome-espanol'; } assert_and_click "installer-next"; assert_keyboard_page; assert_screen "installer-prepare", 16; assert_and_click "installer-next"; if ($args{disk_empty}) { assert_screen "installer-disk", 16; assert_and_click "installer-install-now"; } else { assert_and_click "installer-disk-wipe"; assert_screen "installer-disk-wipe-selected", 16; assert_and_click "installer-install-now"; } - assert_and_click "installer-disk-confirm", button => 'left', timeout => 16; + assert_and_click "installer-disk-confirm", timeout => 16; # Timezone has 75% fuzzyness as timezone is geoip'd so its fairly divergent. # Also, starting here only the top section of the window gets matched as # the bottom part with the buttons now has a progressbar and status # text which is non-deterministic. # NB: we give way more leeway on the new needle appearing as disk IO can # cause quite a bit of slowdown and ubiquity's transition policy is # fairly weird when moving away from the disk page. assert_screen "installer-timezone", 60; assert_and_click "installer-next"; assert_screen "installer-user", 16; type_string $user; # user in user field, name field (needle doesn't include hostname in match) assert_screen "installer-user-user", 16; send_key "tab", 1; # username field send_key "tab", 1; # 1st password field type_string $password; send_key "tab", 1; # 2nd password field type_string $password; # all fields filled (not matching hostname field) assert_screen "installer-user-complete", 16; assert_and_click "installer-next"; assert_screen "installer-show", 15; # Let install finish assert_screen "installer-restart", 640; } sub run { my ($self) = shift; # Divert installation data to live data. $testapi::username = 'neon'; $testapi::password = ''; $self->boot; $self->prepare; $self->install; if (get_var('OPENQA_PARTITIONING')) { # Reset the system and redo the entire installation to ensure partitioning # works on pre-existing partition tables. This is broken in bionic as of # the user edition ISO from 2018-09-15. power 'reset'; reset_consoles; $self->boot; $self->prepare; $self->install(disk_empty => 0); } select_console 'log-console'; { # Make sure networking is on (we disable it during installation). $self->online; $self->upload_ubiquity_logs; } select_console 'x11'; assert_and_click "installer-restart-now"; $self->live_reboot; # Set installation data. $testapi::username = $user; $testapi::password = $password; } sub upload_ubiquity_logs { # Uploads end up in wok/ulogs/ assert_script_sudo 'tar cfJ /tmp/installer.tar.xz /var/log/installer'; upload_logs '/tmp/installer.tar.xz', failok => 1; } sub post_fail_hook { my ($self) = shift; $self->SUPER::post_fail_hook; $self->upload_ubiquity_logs; } 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 { important => 1, fatal => 1 }; } 1;