Add a perltidy check and apply it to the entire codebase

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2022-07-28 13:32:57 -07:00
parent ad5eb54715
commit 1a65993d36
267 changed files with 1346 additions and 1250 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
.tox/ .tox/
.coverage .coverage
coverage.xml coverage.xml
.tidyall.d/

16
.perltidyrc Normal file
View File

@ -0,0 +1,16 @@
# Workaround needed for handling non-ASCII in files.
# # See <https://github.com/houseabsolute/perl-code-tidyall/issues/84>.
--character-encoding=none
--no-valign
# 120 characters would be desired but it is not feasible right now
#-l=120 # 120 characters per line
-l=160
-fbl # don't change blank lines
-fnl # don't remove new lines
-nsfs # no spaces before semicolons
-baao # space after operators
-bbao # space before operators
-pt=2 # no spaces around ()
-bt=2 # no spaces around []
-sbt=2 # no spaces around {}
-sct # stack closing tokens )}

3
.tidyallrc Normal file
View File

@ -0,0 +1,3 @@
[PerlTidy]
select = **/*.pm
argv = --profile=$ROOT/.perltidyrc

View File

@ -6,7 +6,7 @@
- job: - job:
name: os-autoinst-perl name: os-autoinst-perl
run: ci/perl.yaml run: ci/perl.yaml
nodeset: fedora-latest-container nodeset: fedora-36-vm
- project: - project:
check: check:

View File

@ -2,7 +2,7 @@
tasks: tasks:
- name: Install required packages - name: Install required packages
package: package:
name: ['os-autoinst', 'perl-Test-Strict', 'perl-Test-Harness', 'perl-JSON', 'perl-REST-Client'] name: ['os-autoinst', 'perl-Test-Strict', 'perl-Test-Harness', 'perl-JSON', 'perl-REST-Client', 'perl-Code-TidyAll']
state: present state: present
become: yes become: yes
- name: Run perl tests - name: Run perl tests

View File

@ -28,7 +28,7 @@ sub select_disks {
); );
my %iscsi = %{$args{iscsi}}; my %iscsi = %{$args{iscsi}};
# Anaconda hub # Anaconda hub
assert_screen "anaconda_main_hub", 300; # assert_screen "anaconda_main_hub", 300;
# Damn animation delay can cause bad clicks here too - wait for it # Damn animation delay can cause bad clicks here too - wait for it
sleep 1; sleep 1;
assert_and_click "anaconda_main_hub_install_destination"; assert_and_click "anaconda_main_hub_install_destination";
@ -150,7 +150,7 @@ sub custom_blivet_add_partition {
assert_and_click "anaconda_blivet_size_unit"; assert_and_click "anaconda_blivet_size_unit";
assert_and_click "anaconda_blivet_size_unit_mib"; assert_and_click "anaconda_blivet_size_unit_mib";
send_key "shift-tab"; # input is one tab back from unit selection listbox send_key "shift-tab"; # input is one tab back from unit selection listbox
# size input can contain whole set of different values, so we can't match it with needle # size input can contain whole set of different values, so we can't match it with needle
type_safely $args{size} . "\n"; type_safely $args{size} . "\n";
@ -300,7 +300,7 @@ sub get_full_repo {
# only Server # only Server
my $variant = 'Everything'; my $variant = 'Everything';
$variant = 'Server' if (get_var("MODULAR")); $variant = 'Server' if (get_var("MODULAR"));
$repourl .= "/${variant}/".get_var("ARCH")."/os"; $repourl .= "/${variant}/" . get_var("ARCH") . "/os";
} }
return $repourl; return $repourl;
} }
@ -402,7 +402,7 @@ sub report_bug_text {
my $timestamp = time(); my $timestamp = time();
# #
# First, collect the credentials. # First, collect the credentials.
my $login = get_var("BUGZILLA_LOGIN"); my $login = get_var("BUGZILLA_LOGIN");
my $password = get_var("_SECRET_BUGZILLA_PASSWORD"); my $password = get_var("_SECRET_BUGZILLA_PASSWORD");
my $apikey = get_var("_SECRET_BUGZILLA_APIKEY"); my $apikey = get_var("_SECRET_BUGZILLA_APIKEY");
# Choose item 1 - Report the bug. # Choose item 1 - Report the bug.

View File

@ -21,7 +21,8 @@ sub post_fail_hook {
if (check_screen "anaconda_error_report", 10) { if (check_screen "anaconda_error_report", 10) {
assert_and_click "anaconda_error_report"; assert_and_click "anaconda_error_report";
$has_traceback = 1; $has_traceback = 1;
} elsif (check_screen "anaconda_text_error", 10) { # also for text install } elsif (check_screen "anaconda_text_error", 10) {
# also for text install
type_string "1\n"; type_string "1\n";
$has_traceback = 1; $has_traceback = 1;
} }
@ -77,27 +78,27 @@ sub post_fail_hook {
} }
if ($dracut) { if ($dracut) {
upload_logs "/run/initramfs/rdsosreport.txt", failok=>1; upload_logs "/run/initramfs/rdsosreport.txt", failok => 1;
# that's all that's really useful, so... # that's all that's really useful, so...
return; return;
} }
unless (script_run "df -h > /tmp/df.log") { unless (script_run "df -h > /tmp/df.log") {
upload_logs "/tmp/df.log", failok=>1; upload_logs "/tmp/df.log", failok => 1;
} }
unless (script_run "free -h > /tmp/free.log") { unless (script_run "free -h > /tmp/free.log") {
upload_logs "/tmp/free.log", failok=>1; upload_logs "/tmp/free.log", failok => 1;
} }
upload_logs "/tmp/X.log", failok=>1; upload_logs "/tmp/X.log", failok => 1;
upload_logs "/tmp/anaconda.log", failok=>1; upload_logs "/tmp/anaconda.log", failok => 1;
upload_logs "/tmp/packaging.log", failok=>1; upload_logs "/tmp/packaging.log", failok => 1;
upload_logs "/tmp/storage.log", failok=>1; upload_logs "/tmp/storage.log", failok => 1;
upload_logs "/tmp/syslog", failok=>1; upload_logs "/tmp/syslog", failok => 1;
upload_logs "/tmp/program.log", failok=>1; upload_logs "/tmp/program.log", failok => 1;
upload_logs "/tmp/dnf.log", failok=>1; upload_logs "/tmp/dnf.log", failok => 1;
upload_logs "/tmp/dnf.librepo.log", failok=>1; upload_logs "/tmp/dnf.librepo.log", failok => 1;
upload_logs "/tmp/dnf.rpm.log", failok=>1; upload_logs "/tmp/dnf.rpm.log", failok => 1;
upload_logs "/tmp/dbus.log", failok=>1; upload_logs "/tmp/dbus.log", failok => 1;
if ($has_traceback) { if ($has_traceback) {
# Upload Anaconda traceback logs # Upload Anaconda traceback logs
@ -128,7 +129,8 @@ sub root_console {
# 0 means use console_login's default, non-zero values # 0 means use console_login's default, non-zero values
# passed to console_login # passed to console_login
timeout => 0, timeout => 0,
@_); @_
);
if (get_var("SERIAL_CONSOLE")) { if (get_var("SERIAL_CONSOLE")) {
# select first virtio terminal, we rely on anaconda having run # select first virtio terminal, we rely on anaconda having run
# a root shell on it for us # a root shell on it for us
@ -141,7 +143,7 @@ sub root_console {
# tty3 has a shell on all f31+ installer and live images # tty3 has a shell on all f31+ installer and live images
send_key "ctrl-alt-f3"; send_key "ctrl-alt-f3";
} }
console_login(user=>"root", timeout=>$args{timeout}); console_login(user => "root", timeout => $args{timeout});
} }
1; 1;

View File

@ -22,7 +22,7 @@ sub start_cockpit {
# run firefox directly in X as root. never do this, kids! # run firefox directly in X as root. never do this, kids!
type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n"; type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n";
assert_screen "cockpit_login", 60; assert_screen "cockpit_login", 60;
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
if ($login) { if ($login) {
type_safely "root"; type_safely "root";
wait_screen_change { send_key "tab"; }; wait_screen_change { send_key "tab"; };
@ -56,6 +56,6 @@ sub check_updates {
my $logfile = shift; my $logfile = shift;
sleep 2; sleep 2;
my $checkresult = script_run "dnf check-update > $logfile"; my $checkresult = script_run "dnf check-update > $logfile";
upload_logs "$logfile", failok=>1; upload_logs "$logfile", failok => 1;
return($checkresult); return ($checkresult);
} }

View File

@ -59,7 +59,7 @@ sub x11_start_program {
send_key "alt-f2"; send_key "alt-f2";
assert_screen "desktop_runner"; assert_screen "desktop_runner";
type_string $program, 20; type_string $program, 20;
sleep 5; # because of KDE dialog - SUSE guys are doing the same! sleep 5; # because of KDE dialog - SUSE guys are doing the same!
send_key "ret", 1; send_key "ret", 1;
} }
@ -75,14 +75,14 @@ sub ensure_installed {
# We will check if GUI elements are present, that would suggest that we are not in the # We will check if GUI elements are present, that would suggest that we are not in the
# console but in GUI. # console but in GUI.
if (check_screen("apps_menu_button")) { if (check_screen("apps_menu_button")) {
# In that case, we want to return to GUI after the routine finishes. # In that case, we want to return to GUI after the routine finishes.
$stay_on_console = 0; $stay_on_console = 0;
# From GUI we need to switch to the console. # From GUI we need to switch to the console.
send_key("ctrl-alt-f3"); send_key("ctrl-alt-f3");
# Let's wait to allow for screen changes. # Let's wait to allow for screen changes.
sleep 5; sleep 5;
# And do the login. # And do the login.
console_login(); console_login();
} }
# Try to install the packages via dnf. If it is already installed, DNF will not do anything # Try to install the packages via dnf. If it is already installed, DNF will not do anything
# so there is no need to do any complicated magic. # so there is no need to do any complicated magic.
@ -102,21 +102,21 @@ sub become_root {
# If ROOT_PASSWORD exists, it means that the root account exists, too. # If ROOT_PASSWORD exists, it means that the root account exists, too.
# To become root, we will use the real root account and we'll switch to it. # To become root, we will use the real root account and we'll switch to it.
if (check_var("ROOT_PASSWORD")) { if (check_var("ROOT_PASSWORD")) {
my $password = get_var("ROOT_PASSWORD"); my $password = get_var("ROOT_PASSWORD");
enter_cmd("su -", max_interval => 15, wait_screen_changes => 3); enter_cmd("su -", max_interval => 15, wait_screen_changes => 3);
type_password($password, max_interval => 15); type_password($password, max_interval => 15);
send_key("ret"); send_key("ret");
} }
# If no root password is set, it means, that we are only using an administrator # If no root password is set, it means, that we are only using an administrator
# who is in the wheel group and therefore we will use the sudo command to obtain # who is in the wheel group and therefore we will use the sudo command to obtain
# the admin rights. # the admin rights.
else { else {
my $password = get_var("USER_PASSWORD") || "weakpassword"; my $password = get_var("USER_PASSWORD") || "weakpassword";
enter_cmd("sudo -i", max_interval => 15, wait_screen_changes => 3); enter_cmd("sudo -i", max_interval => 15, wait_screen_changes => 3);
# The SUDO warning might be displayed so let's wait it out a bit. # The SUDO warning might be displayed so let's wait it out a bit.
sleep 2; sleep 2;
type_password($password, max_interval => 15); type_password($password, max_interval => 15);
send_key("ret"); send_key("ret");
} }
sleep 2; sleep 2;
# Now we should be root. Let's check for root prompt. # Now we should be root. Let's check for root prompt.
@ -144,9 +144,9 @@ sub script_sudo {
my $str; my $str;
if ($wait > 0) { if ($wait > 0) {
# Create a uniqe hash from the command and the wait time. # Create a uniqe hash from the command and the wait time.
$str = testapi::hashed_string("SS$prog$wait"); $str = testapi::hashed_string("SS$prog$wait");
# Chain the commands to pass the message to the serial console. # Chain the commands to pass the message to the serial console.
$prog = "$prog; echo $str > /dev/$testapi::serialdev"; $prog = "$prog; echo $str > /dev/$testapi::serialdev";
} }
# Run the command with `sudo -k` # Run the command with `sudo -k`
@ -171,7 +171,7 @@ sub assert_script_sudo {
my ($self, $prog, $wait) = @_; my ($self, $prog, $wait) = @_;
script_sudo($prog, $wait); script_sudo($prog, $wait);
# Validate that the command exited with a correct exit code. # Validate that the command exited with a correct exit code.
validate_script_output('echo $?', sub { $_ == 0 } ); validate_script_output('echo $?', sub { $_ == 0 });
return; return;
} }

View File

@ -44,7 +44,7 @@ sub start_webui {
disable_firefox_studies; disable_firefox_studies;
type_string "startx /usr/bin/firefox -width 1024 -height 768 https://ipa001.test.openqa.fedoraproject.org\n"; type_string "startx /usr/bin/firefox -width 1024 -height 768 https://ipa001.test.openqa.fedoraproject.org\n";
assert_screen ["freeipa_webui_login", $user_screen], 60; assert_screen ["freeipa_webui_login", $user_screen], 60;
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
# softfail on kerberos ticket bugs meaning we get auto-logged in # softfail on kerberos ticket bugs meaning we get auto-logged in
# as the requested user when we don't expect to be # as the requested user when we don't expect to be
if (match_has_tag $user_screen) { if (match_has_tag $user_screen) {

View File

@ -16,9 +16,10 @@ sub root_console {
# Switch to a default or specified TTY and log in as root. # Switch to a default or specified TTY and log in as root.
my $self = shift; my $self = shift;
my %args = ( my %args = (
tty => 1, # what TTY to login to tty => 1, # what TTY to login to
timeout => 0, # passed through to console_login timeout => 0, # passed through to console_login
@_); @_
);
if (get_var("SERIAL_CONSOLE")) { if (get_var("SERIAL_CONSOLE")) {
# select the first virtio terminal, for now we assume we can # select the first virtio terminal, for now we assume we can
# always use that (we may have to make this smarter in future) # always use that (we may have to make this smarter in future)
@ -28,7 +29,7 @@ sub root_console {
# For normal terminal emulation, use key combo to reach a tty # For normal terminal emulation, use key combo to reach a tty
send_key "ctrl-alt-f$args{tty}"; send_key "ctrl-alt-f$args{tty}";
} }
console_login(timeout=>$args{timeout}); # Do the login. console_login(timeout => $args{timeout}); # Do the login.
} }
sub post_fail_hook { sub post_fail_hook {
@ -44,7 +45,7 @@ sub post_fail_hook {
assert_script_run "dhclient"; assert_script_run "dhclient";
} }
else { else {
$self->root_console(tty=>6); $self->root_console(tty => 6);
# fix up keyboard layout, if we failed before the test did this # fix up keyboard layout, if we failed before the test did this
# itself; if it's already been done, should be safe, will just # itself; if it's already been done, should be safe, will just
# fail and carry on # fail and carry on
@ -89,7 +90,7 @@ sub post_fail_hook {
} }
if ($dracut) { if ($dracut) {
upload_logs "/run/initramfs/rdsosreport.txt", failok=>1; upload_logs "/run/initramfs/rdsosreport.txt", failok => 1;
# that's all that's really useful, so... # that's all that's really useful, so...
return; return;
} }
@ -126,14 +127,14 @@ sub post_fail_hook {
} }
# Sometimes useful for diagnosing FreeIPA issues # Sometimes useful for diagnosing FreeIPA issues
upload_logs "/etc/nsswitch.conf", failok=>1; upload_logs "/etc/nsswitch.conf", failok => 1;
if (get_var("FLAVOR") eq "updates-everything-boot-iso") { if (get_var("FLAVOR") eq "updates-everything-boot-iso") {
# for installer creation test # for installer creation test
script_run "df -h"; script_run "df -h";
upload_logs "/root/imgbuild/pylorax.log", failok=>1; upload_logs "/root/imgbuild/pylorax.log", failok => 1;
upload_logs "/root/imgbuild/lorax.log", failok=>1; upload_logs "/root/imgbuild/lorax.log", failok => 1;
upload_logs "/root/imgbuild/program.log", failok=>1; upload_logs "/root/imgbuild/program.log", failok => 1;
} }
if (get_var("TEST") eq "live_build") { if (get_var("TEST") eq "live_build") {
@ -150,10 +151,10 @@ sub post_fail_hook {
} }
} }
# For update tests, let's do the update package info log stuff, # For update tests, let's do the update package info log stuff,
# it may be useful for diagnosing the cause of the failure # it may be useful for diagnosing the cause of the failure
advisory_get_installed_packages; advisory_get_installed_packages;
advisory_check_nonmatching_packages(fatal=>0); advisory_check_nonmatching_packages(fatal => 0);
1; 1;

View File

@ -37,7 +37,7 @@ sub parse_module_list {
sub is_listed { sub is_listed {
my ($module, $stream, $listref) = @_; my ($module, $stream, $listref) = @_;
my $found = 0; my $found = 0;
foreach (@{ $listref }) { foreach (@{$listref}) {
if ($_->{module} eq $module and $_->{stream} eq $stream) { if ($_->{module} eq $module and $_->{stream} eq $stream) {
$found = 1; $found = 1;
} }

View File

@ -21,9 +21,9 @@ sub run_with_error_check {
# by using 'unless' and 'expect_not_found=>1' here we avoid # by using 'unless' and 'expect_not_found=>1' here we avoid
# the web UI showing each failure to see the error message as # the web UI showing each failure to see the error message as
# a 'failed match' # a 'failed match'
die "Error screen appeared" unless (wait_serial($error_screen, timeout=>5, expect_not_found=>1)); die "Error screen appeared" unless (wait_serial($error_screen, timeout => 5, expect_not_found => 1));
$func->(); $func->();
die "Error screen appeared" unless (wait_serial($error_screen, timeout=>5, expect_not_found=>1)); die "Error screen appeared" unless (wait_serial($error_screen, timeout => 5, expect_not_found => 1));
} }
else { else {
die "Error screen appeared" if (check_screen $error_screen, 5); die "Error screen appeared" if (check_screen $error_screen, 5);
@ -39,7 +39,7 @@ sub type_safely {
type_string($string, wait_screen_change => 3, max_interval => 20); type_string($string, wait_screen_change => 3, max_interval => 20);
# similarity level 38 as there will commonly be a flashing # similarity level 38 as there will commonly be a flashing
# cursor and the default level (47) is too tight # cursor and the default level (47) is too tight
wait_still_screen(stilltime=>2, similarity_level=>38); wait_still_screen(stilltime => 2, similarity_level => 38);
} }
# high-level 'type this string extremely safely and rather slow' # high-level 'type this string extremely safely and rather slow'
@ -49,7 +49,7 @@ sub type_very_safely {
type_string($string, wait_screen_change => 1, max_interval => 1); type_string($string, wait_screen_change => 1, max_interval => 1);
# similarity level 38 as there will commonly be a flashing # similarity level 38 as there will commonly be a flashing
# cursor and the default level (47) is too tight # cursor and the default level (47) is too tight
wait_still_screen(stilltime=>5, similarity_level=>38); wait_still_screen(stilltime => 5, similarity_level => 38);
} }
sub get_release_number { sub get_release_number {
@ -59,7 +59,7 @@ sub get_release_number {
my $version = get_var("VERSION"); my $version = get_var("VERSION");
my $rawrel = get_var("RAWREL", "Rawhide"); my $rawrel = get_var("RAWREL", "Rawhide");
return $rawrel if ($version eq "Rawhide"); return $rawrel if ($version eq "Rawhide");
return $version return $version;
} }
# Wait for login screen to appear. Handle the annoying GPU buffer # Wait for login screen to appear. Handle the annoying GPU buffer
@ -71,7 +71,7 @@ sub boot_to_login_screen {
$args{timeout} //= 300; $args{timeout} //= 300;
if (testapi::is_serial_terminal) { if (testapi::is_serial_terminal) {
# For serial console, just wait for the login prompt # For serial console, just wait for the login prompt
unless (wait_serial "login:", timeout=>$args{timeout}) { unless (wait_serial "login:", timeout => $args{timeout}) {
die "No login prompt shown on serial console."; die "No login prompt shown on serial console.";
} }
} }
@ -82,14 +82,14 @@ sub boot_to_login_screen {
# The following is true for non-serial console. # The following is true for non-serial console.
my $count = 5; my $count = 5;
while (check_screen("login_screen", 3) && $count > 0) { while (check_screen("login_screen", 3) && $count > 0) {
sleep 5; sleep 5;
$count -= 1; $count -= 1;
}
assert_screen "login_screen", $args{timeout};
if (match_has_tag "graphical_login") {
wait_still_screen 10, 30;
assert_screen "login_screen";
} }
assert_screen "login_screen", $args{timeout};
if (match_has_tag "graphical_login") {
wait_still_screen 10, 30;
assert_screen "login_screen";
}
} }
} }
@ -116,7 +116,7 @@ sub desktop_switch_layout {
# if already selected, we're good # if already selected, we're good
return if (check_screen "${environment}_layout_${layout}", 3); return if (check_screen "${environment}_layout_${layout}", 3);
# otherwise we need to switch # otherwise we need to switch
my $switcher = "alt-shift"; # anaconda my $switcher = "alt-shift"; # anaconda
$switcher = "super-spc" if $environment eq 'gnome'; $switcher = "super-spc" if $environment eq 'gnome';
# KDE? not used yet # KDE? not used yet
send_key $switcher; send_key $switcher;
@ -130,7 +130,7 @@ sub desktop_switch_layout {
sub _console_login_finish { sub _console_login_finish {
# The check differs according to the console used. # The check differs according to the console used.
if (testapi::is_serial_terminal) { if (testapi::is_serial_terminal) {
unless (wait_serial("-bash-.*[#\$]", timeout=>5, expect_not_found=>1)) { unless (wait_serial("-bash-.*[#\$]", timeout => 5, expect_not_found => 1)) {
record_soft_failure "It looks like profile sourcing failed"; record_soft_failure "It looks like profile sourcing failed";
} }
} }
@ -150,7 +150,8 @@ sub console_login {
password => get_var("ROOT_PASSWORD", "weakpassword"), password => get_var("ROOT_PASSWORD", "weakpassword"),
# default is 10 seconds, set below, 0 means 'default' # default is 10 seconds, set below, 0 means 'default'
timeout => 0, timeout => 0,
@_); @_
);
$args{timeout} ||= 10; $args{timeout} ||= 10;
# Since we do not test many serial console tests, and we probably # Since we do not test many serial console tests, and we probably
@ -161,7 +162,7 @@ sub console_login {
# enable a new proper login based on the user variable. # enable a new proper login based on the user variable.
if (get_var("SERIAL_CONSOLE")) { if (get_var("SERIAL_CONSOLE")) {
# Check for the usual prompt. # Check for the usual prompt.
if (wait_serial("~\][#\$]", timeout=>5, quiet=>1)) { if (wait_serial("~\][#\$]", timeout => 5, quiet => 1)) {
type_string "logout\n"; type_string "logout\n";
# Wait a bit to let the logout properly finish. # Wait a bit to let the logout properly finish.
sleep 10; sleep 10;
@ -175,7 +176,7 @@ sub console_login {
# Let's perform a simple login test. This is the same as # Let's perform a simple login test. This is the same as
# whoami, but has the advantage of existing in installer env # whoami, but has the advantage of existing in installer env
assert_script_run "id -un"; assert_script_run "id -un";
unless (wait_serial $args{user}, timeout=>5) { unless (wait_serial $args{user}, timeout => 5) {
die "Logging onto the serial console has failed."; die "Logging onto the serial console has failed.";
} }
} }
@ -268,9 +269,9 @@ sub desktop_vt {
# stop as soon as any command fails, so we use ||: to make the # stop as soon as any command fails, so we use ||: to make the
# first grep return 0 even if it matches nothing # first grep return 0 even if it matches nothing
eval { $xout = script_output ' loginctl | grep test ||:; ps -e | egrep "(startplasma|gnome-session|Xwayland|Xorg)" | grep -o tty[0-9] ||:' }; eval { $xout = script_output ' loginctl | grep test ||:; ps -e | egrep "(startplasma|gnome-session|Xwayland|Xorg)" | grep -o tty[0-9] ||:' };
my $tty = 1; # default my $tty = 1; # default
while ($xout =~ /tty(\d)/g) { while ($xout =~ /tty(\d)/g) {
$tty = $1; # most recent match is probably best $tty = $1; # most recent match is probably best
} }
send_key "ctrl-alt-f${tty}"; send_key "ctrl-alt-f${tty}";
# work around https://gitlab.gnome.org/GNOME/gnome-software/issues/582 # work around https://gitlab.gnome.org/GNOME/gnome-software/issues/582
@ -382,7 +383,8 @@ sub do_bootloader {
# in SLOF usb-xhci driver failed sometimes in powerpc # in SLOF usb-xhci driver failed sometimes in powerpc
type_safely " $args{params}"; type_safely " $args{params}";
} }
save_screenshot; # for debug purpose # for debug purpose
save_screenshot;
# ctrl-X boots from grub editor mode # ctrl-X boots from grub editor mode
send_key "ctrl-x"; send_key "ctrl-x";
# return boots all other cases # return boots all other cases
@ -435,9 +437,9 @@ sub disable_firefox_studies {
assert_script_run 'printf "// required comment\npref(\'general.config.filename\', \'openqa-overrides.cfg\');\npref(\'general.config.obscure_value\', 0);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/browser/defaults/preferences/openqa-overrides.js'; assert_script_run 'printf "// required comment\npref(\'general.config.filename\', \'openqa-overrides.cfg\');\npref(\'general.config.obscure_value\', 0);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/browser/defaults/preferences/openqa-overrides.js';
assert_script_run 'printf "// required comment\npref(\'browser.urlbar.quicksuggest.shouldShowOnboardingDialog\', false);\npref(\'privacy.restrict3rdpartystorage.rollout.enabledByDefault\', false);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/openqa-overrides.cfg'; assert_script_run 'printf "// required comment\npref(\'browser.urlbar.quicksuggest.shouldShowOnboardingDialog\', false);\npref(\'privacy.restrict3rdpartystorage.rollout.enabledByDefault\', false);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/openqa-overrides.cfg';
# for debugging # for debugging
upload_logs "$prefix/usr/lib64/firefox/browser/defaults/preferences/openqa-overrides.js", failok=>1; upload_logs "$prefix/usr/lib64/firefox/browser/defaults/preferences/openqa-overrides.js", failok => 1;
upload_logs "$prefix/usr/lib64/firefox/openqa-overrides.cfg", failok=>1; upload_logs "$prefix/usr/lib64/firefox/openqa-overrides.cfg", failok => 1;
upload_logs "$prefix/usr/lib64/firefox/distribution/policies.json", failok=>1; upload_logs "$prefix/usr/lib64/firefox/distribution/policies.json", failok => 1;
} }
sub repos_mirrorlist { sub repos_mirrorlist {
@ -522,7 +524,7 @@ sub _repo_setup_compose {
assert_script_run 'dnf config-manager --set-disabled updates-testing updates'; assert_script_run 'dnf config-manager --set-disabled updates-testing updates';
# script_run returns the exit code, so 'unless' here means 'if the file exists' # script_run returns the exit code, so 'unless' here means 'if the file exists'
unless (script_run 'test -f /etc/yum.repos.d/fedora-updates-modular.repo') { unless (script_run 'test -f /etc/yum.repos.d/fedora-updates-modular.repo') {
assert_script_run 'dnf config-manager --set-disabled updates-testing-modular updates-modular'; assert_script_run 'dnf config-manager --set-disabled updates-testing-modular updates-modular';
} }
# we use script_run here as the rawhide and modular repo files # we use script_run here as the rawhide and modular repo files
# won't always exist and we don't want to bother testing or # won't always exist and we don't want to bother testing or
@ -532,9 +534,9 @@ sub _repo_setup_compose {
script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^mirrorlist,#mirrorlist,g' -e 's,^#baseurl.*basearch,baseurl=${location}/Modular/\$basearch,g' -e 's,^#baseurl.*source,baseurl=${location}/Modular/source,g' /etc/yum.repos.d/{fedora-modular,fedora-rawhide-modular}.repo", 0; script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^mirrorlist,#mirrorlist,g' -e 's,^#baseurl.*basearch,baseurl=${location}/Modular/\$basearch,g' -e 's,^#baseurl.*source,baseurl=${location}/Modular/source,g' /etc/yum.repos.d/{fedora-modular,fedora-rawhide-modular}.repo", 0;
# this can be used for debugging if something is going wrong # this can be used for debugging if something is going wrong
# unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') { # unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') {
# upload_logs "/etc/yum.repos.d/yumreposd.tar.gz"; # upload_logs "/etc/yum.repos.d/yumreposd.tar.gz";
# } # }
} }
sub _repo_setup_updates { sub _repo_setup_updates {
@ -545,9 +547,9 @@ sub _repo_setup_updates {
my $currrel = get_var("CURRREL", "0"); my $currrel = get_var("CURRREL", "0");
repos_mirrorlist(); repos_mirrorlist();
# this can be used for debugging repo config if something is wrong # this can be used for debugging repo config if something is wrong
# unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') { # unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') {
# upload_logs "/etc/yum.repos.d/yumreposd.tar.gz"; # upload_logs "/etc/yum.repos.d/yumreposd.tar.gz";
# } # }
if ($version > $currrel) { if ($version > $currrel) {
# Disable updates-testing so other bad updates don't break us # Disable updates-testing so other bad updates don't break us
# this will do nothing on upgrade tests as we're on a stable # this will do nothing on upgrade tests as we're on a stable
@ -650,11 +652,11 @@ sub console_initial_setup {
# Set timezone # Set timezone
type_string "2\n"; type_string "2\n";
wait_still_screen 5; wait_still_screen 5;
type_string "1\n"; # Set timezone type_string "1\n"; # Set timezone
wait_still_screen 5; wait_still_screen 5;
type_string "1\n"; # Europe type_string "1\n"; # Europe
wait_still_screen 5; wait_still_screen 5;
type_string "37\n"; # Prague type_string "37\n"; # Prague
wait_still_screen 7; wait_still_screen 7;
# Set root password # Set root password
@ -670,14 +672,14 @@ sub console_initial_setup {
# Create user # Create user
type_string "5\n"; type_string "5\n";
wait_still_screen 5; wait_still_screen 5;
type_string "1\n"; # create new type_string "1\n"; # create new
wait_still_screen 5; wait_still_screen 5;
type_string "3\n"; # set username type_string "3\n"; # set username
wait_still_screen 5; wait_still_screen 5;
type_string get_var("USER_LOGIN", "test"); type_string get_var("USER_LOGIN", "test");
send_key "ret"; send_key "ret";
wait_still_screen 5; wait_still_screen 5;
type_string "5\n"; # set password type_string "5\n"; # set password
wait_still_screen 5; wait_still_screen 5;
type_string get_var("USER_PASSWORD", "weakpassword"); type_string get_var("USER_PASSWORD", "weakpassword");
send_key "ret"; send_key "ret";
@ -685,13 +687,13 @@ sub console_initial_setup {
type_string get_var("USER_PASSWORD", "weakpassword"); type_string get_var("USER_PASSWORD", "weakpassword");
send_key "ret"; send_key "ret";
wait_still_screen 5; wait_still_screen 5;
type_string "6\n"; # make him an administrator type_string "6\n"; # make him an administrator
wait_still_screen 5; wait_still_screen 5;
type_string "c\n"; type_string "c\n";
wait_still_screen 7; wait_still_screen 7;
assert_screen "console_initial_setup_done", 30; assert_screen "console_initial_setup_done", 30;
type_string "c\n"; # continue type_string "c\n"; # continue
} }
sub handle_welcome_screen { sub handle_welcome_screen {
@ -734,17 +736,17 @@ sub gnome_initial_setup {
# https://fedoraproject.org//wiki/Changes/ReduceInitialSetupRedundancy # https://fedoraproject.org//wiki/Changes/ReduceInitialSetupRedundancy
# https://bugzilla.redhat.com/show_bug.cgi?id=1474787 , # https://bugzilla.redhat.com/show_bug.cgi?id=1474787 ,
# except 'language' is never *really* skipped (see above) # except 'language' is never *really* skipped (see above)
@nexts = grep {$_ ne 'keyboard'} @nexts; @nexts = grep { $_ ne 'keyboard' } @nexts;
@nexts = grep {$_ ne 'timezone'} @nexts; @nexts = grep { $_ ne 'timezone' } @nexts;
# 'additional software sources' screen did not display on F28-F34: # 'additional software sources' screen did not display on F28-F34:
# https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/59 # https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/59
@nexts = grep {$_ ne 'software'} @nexts if ($relnum < 35); @nexts = grep { $_ ne 'software' } @nexts if ($relnum < 35);
} }
else { else {
# 'timezone' and 'software' are suppressed for the 'existing user' # 'timezone' and 'software' are suppressed for the 'existing user'
# form of g-i-s # form of g-i-s
@nexts = grep {$_ ne 'software'} @nexts; @nexts = grep { $_ ne 'software' } @nexts;
@nexts = grep {$_ ne 'timezone'} @nexts; @nexts = grep { $_ ne 'timezone' } @nexts;
} }
# note: in g-i-s 3.37.91 and later, the first screen in systemwide # note: in g-i-s 3.37.91 and later, the first screen in systemwide
@ -763,13 +765,13 @@ sub gnome_initial_setup {
# wait a bit in case of animation # wait a bit in case of animation
wait_still_screen 3; wait_still_screen 3;
# one more check for frickin auth_required # one more check for frickin auth_required
if (check_screen "auth_required") { if (check_screen "auth_required") {
record_soft_failure "Unexpected authentication required: https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/106"; record_soft_failure "Unexpected authentication required: https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/106";
send_key "esc"; send_key "esc";
} }
# GDM 3.24.1 dumps a cursor in the middle of the screen here... # GDM 3.24.1 dumps a cursor in the middle of the screen here...
mouse_hide if ($args{prelogin}); mouse_hide if ($args{prelogin});
for my $n (1..scalar(@nexts)) { for my $n (1 .. scalar(@nexts)) {
# click 'Next' $nexts times, moving the mouse to avoid # click 'Next' $nexts times, moving the mouse to avoid
# highlight problems, sleeping to give it time to get # highlight problems, sleeping to give it time to get
# to the next screen between clicks # to the next screen between clicks
@ -799,7 +801,7 @@ sub gnome_initial_setup {
# it's not visible we may have hit # it's not visible we may have hit
# https://bugzilla.redhat.com/show_bug.cgi?id=1997310 , which # https://bugzilla.redhat.com/show_bug.cgi?id=1997310 , which
# we'll handle as a soft failure # we'll handle as a soft failure
mouse_set(100,100); mouse_set(100, 100);
if (check_screen "skip_button", 60) { if (check_screen "skip_button", 60) {
wait_screen_change { click_lastmatch; }; wait_screen_change { click_lastmatch; };
} }
@ -853,7 +855,7 @@ sub anaconda_create_user {
@_ @_
); );
my $user_login = get_var("USER_LOGIN") || "test"; my $user_login = get_var("USER_LOGIN") || "test";
assert_and_click("anaconda_install_user_creation", timeout=>$args{timeout}); assert_and_click("anaconda_install_user_creation", timeout => $args{timeout});
assert_screen "anaconda_install_user_creation_screen"; assert_screen "anaconda_install_user_creation_screen";
# wait out animation # wait out animation
wait_still_screen 2; wait_still_screen 2;
@ -934,21 +936,21 @@ sub check_desktop {
} }
sub download_modularity_tests { sub download_modularity_tests {
# Download the modularity test script, place in the system and then # Download the modularity test script, place in the system and then
# modify the access rights to make it executable. # modify the access rights to make it executable.
my ($whitelist) = @_; my ($whitelist) = @_;
# we need python3-yaml for the script to run # we need python3-yaml for the script to run
assert_script_run 'dnf -y install python3-yaml', 180; assert_script_run 'dnf -y install python3-yaml', 180;
assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py'; assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py';
if ($whitelist eq 'whitelist') { if ($whitelist eq 'whitelist') {
assert_script_run 'curl -o /root/whitelist https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/whitelist'; assert_script_run 'curl -o /root/whitelist https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/whitelist';
} }
assert_script_run 'chmod 755 /root/test.py'; assert_script_run 'chmod 755 /root/test.py';
} }
sub quit_firefox { sub quit_firefox {
# Quit Firefox, handling the 'close multiple tabs' warning screen if # Quit Firefox, handling the 'close multiple tabs' warning screen if
# it shows up. Expects to quit to a recognizable console # it shows up. Expects to quit to a recognizable console
send_key "ctrl-q"; send_key "ctrl-q";
# expect to get to either the tabs warning or a console # expect to get to either the tabs warning or a console
if (check_screen ["user_console", "root_console", "firefox_close_tabs"], 30) { if (check_screen ["user_console", "root_console", "firefox_close_tabs"], 30) {
@ -972,18 +974,18 @@ sub quit_firefox {
record_soft_failure "No console on exit from Firefox, probably RHBZ #2094137"; record_soft_failure "No console on exit from Firefox, probably RHBZ #2094137";
power "reset"; power "reset";
boot_to_login_screen; boot_to_login_screen;
console_login(user=>"root", password=>get_var("ROOT_PASSWORD")); console_login(user => "root", password => get_var("ROOT_PASSWORD"));
} }
sub start_with_launcher { sub start_with_launcher {
# Get the name of the needle with a launcher, find the launcher in the menu # Get the name of the needle with a launcher, find the launcher in the menu
# and click on it to start the application. This function works for the # and click on it to start the application. This function works for the
# Gnome desktop. # Gnome desktop.
# $launcher holds the launcher needle, but some of the apps are hidden in a submenu # $launcher holds the launcher needle, but some of the apps are hidden in a submenu
# so this must be handled first to find the launcher needle. # so this must be handled first to find the launcher needle.
my ($launcher,$submenu,$group) = @_; my ($launcher, $submenu, $group) = @_;
$submenu //= ''; $submenu //= '';
$group //= ''; $group //= '';
my $desktop = get_var('DESKTOP'); my $desktop = get_var('DESKTOP');
@ -1020,7 +1022,7 @@ sub start_with_launcher {
assert_and_click $launcher; assert_and_click $launcher;
wait_still_screen 5; wait_still_screen 5;
} }
elsif ($desktop eq 'kde'){ elsif ($desktop eq 'kde') {
# Click on the KDE launcher icon # Click on the KDE launcher icon
assert_and_click 'kde_menu_launcher'; assert_and_click 'kde_menu_launcher';
wait_still_screen 2; wait_still_screen 2;
@ -1047,7 +1049,7 @@ sub start_with_launcher {
sub quit_with_shortcut { sub quit_with_shortcut {
# Quit the application using the Alt-F4 keyboard shortcut # Quit the application using the Alt-F4 keyboard shortcut
send_key 'alt-f4'; send_key 'alt-f4';
wait_still_screen 5; wait_still_screen 5;
assert_screen 'workspace'; assert_screen 'workspace';
@ -1067,12 +1069,12 @@ sub advisory_get_installed_packages {
# occasionally, for some reason, it's unhappy about sorting; # occasionally, for some reason, it's unhappy about sorting;
# we shouldn't fail the test in this case, just upload the # we shouldn't fail the test in this case, just upload the
# files so we can see why... # files so we can see why...
upload_logs "/tmp/allpkgs.txt", failok=>1; upload_logs "/tmp/allpkgs.txt", failok => 1;
upload_logs "/var/log/updatepkgs.txt", failok=>1; upload_logs "/var/log/updatepkgs.txt", failok => 1;
} }
# we'll try and upload the output even if comm 'failed', as it # we'll try and upload the output even if comm 'failed', as it
# does in fact still write it in some cases # does in fact still write it in some cases
upload_logs "/var/log/testedpkgs.txt", failok=>1; upload_logs "/var/log/testedpkgs.txt", failok => 1;
} }
sub advisory_check_nonmatching_packages { sub advisory_check_nonmatching_packages {
@ -1106,8 +1108,8 @@ sub advisory_check_nonmatching_packages {
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --last | head -1 | cut -d" " -f1 | sed -e \'s,\^,\\\\\\\\^,g\' | xargs rpm -q --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done'; script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --last | head -1 | cut -d" " -f1 | sed -e \'s,\^,\\\\\\\\^,g\' | xargs rpm -q --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done';
script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt'; script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt';
# for debugging, may as well always upload these, can't hurt anything # for debugging, may as well always upload these, can't hurt anything
upload_logs "/tmp/installedupdatepkgs.txt", failok=>1; upload_logs "/tmp/installedupdatepkgs.txt", failok => 1;
upload_logs "/var/log/updatepkgs.txt", failok=>1; upload_logs "/var/log/updatepkgs.txt", failok => 1;
# if any line appears in installedupdatepkgs.txt but not updatepkgs.txt, # if any line appears in installedupdatepkgs.txt but not updatepkgs.txt,
# we have a problem. # we have a problem.
if (script_run 'comm -23 /tmp/installedupdatepkgs.txt /var/log/updatepkgs.txt > /var/log/installednotupdatedpkgs.txt') { if (script_run 'comm -23 /tmp/installedupdatepkgs.txt /var/log/updatepkgs.txt > /var/log/installednotupdatedpkgs.txt') {
@ -1119,7 +1121,7 @@ sub advisory_check_nonmatching_packages {
# this exits 1 if the file is zero-length, 0 if it's longer # this exits 1 if the file is zero-length, 0 if it's longer
# if it's 0, that's *BAD*: we want to upload the file and fail # if it's 0, that's *BAD*: we want to upload the file and fail
unless (script_run 'test -s /var/log/installednotupdatedpkgs.txt') { unless (script_run 'test -s /var/log/installednotupdatedpkgs.txt') {
upload_logs "/var/log/installednotupdatedpkgs.txt", failok=>1; upload_logs "/var/log/installednotupdatedpkgs.txt", failok => 1;
my $message = "Package(s) from update not installed when it should have been! See installednotupdatedpkgs.txt"; my $message = "Package(s) from update not installed when it should have been! See installednotupdatedpkgs.txt";
if ($args{fatal}) { if ($args{fatal}) {
set_var("_ACNMP_DONE", "1"); set_var("_ACNMP_DONE", "1");
@ -1172,7 +1174,7 @@ sub select_rescue_mode {
} }
} }
assert_screen "rescue_select", 180; # it takes time to start anaconda assert_screen "rescue_select", 180; # it takes time to start anaconda
} }
sub copy_devcdrom_as_isofile { sub copy_devcdrom_as_isofile {
@ -1334,10 +1336,10 @@ sub check_prerelease {
assert_screen "prerelease_note"; assert_screen "prerelease_note";
} }
elsif ($prerelease == 0) { elsif ($prerelease == 0) {
# If the prerelease note is shown, where it should not be, die! # If the prerelease note is shown, where it should not be, die!
if (check_screen "prerelease_note") { if (check_screen "prerelease_note") {
die "The PRERELEASE tag is shown, but it should NOT be."; die "The PRERELEASE tag is shown, but it should NOT be.";
} }
} }
} }
@ -1419,12 +1421,12 @@ sub click_unwanted_notifications {
my @closed; my @closed;
while ($count > 0 && check_screen "desktop_update_notification_popup", 5) { while ($count > 0 && check_screen "desktop_update_notification_popup", 5) {
$count -= 1; $count -= 1;
push (@closed, 'update'); push(@closed, 'update');
click_lastmatch; click_lastmatch;
} }
if (check_screen "akonadi_migration_agent_running", 5) { if (check_screen "akonadi_migration_agent_running", 5) {
click_lastmatch; click_lastmatch;
push (@closed, 'akonadi'); push(@closed, 'akonadi');
} }
return @closed; return @closed;
} }
@ -1447,7 +1449,7 @@ sub register_application {
sub solidify_wallpaper { sub solidify_wallpaper {
my $desktop = get_var("DESKTOP"); my $desktop = get_var("DESKTOP");
if ($desktop eq "kde") { if ($desktop eq "kde") {
# Run the Desktop settings # Run the Desktop settings
# FIXME workaround a weird bug where alt-d-s does something # FIXME workaround a weird bug where alt-d-s does something
# different until you right click on the desktop: # different until you right click on the desktop:
# https://bugzilla.redhat.com/show_bug.cgi?id=1933118 # https://bugzilla.redhat.com/show_bug.cgi?id=1933118
@ -1485,14 +1487,14 @@ sub solidify_wallpaper {
# Start the terminal to set up backgrounds. # Start the terminal to set up backgrounds.
menu_launch_type "gnome-terminal"; menu_launch_type "gnome-terminal";
# wait to be sure it's fully open # wait to be sure it's fully open
wait_still_screen(stilltime=>5, similarity_level=>38); wait_still_screen(stilltime => 5, similarity_level => 38);
# When the application opens, run command in it to set the background to black # When the application opens, run command in it to set the background to black
type_very_safely "gsettings set org.gnome.desktop.background picture-uri ''"; type_very_safely "gsettings set org.gnome.desktop.background picture-uri ''";
send_key 'ret'; send_key 'ret';
wait_still_screen(stilltime=>2, similarity_level=>38); wait_still_screen(stilltime => 2, similarity_level => 38);
type_very_safely "gsettings set org.gnome.desktop.background primary-color '#000000'"; type_very_safely "gsettings set org.gnome.desktop.background primary-color '#000000'";
send_key 'ret'; send_key 'ret';
wait_still_screen(stilltime=>2, similarity_level=>38); wait_still_screen(stilltime => 2, similarity_level => 38);
quit_with_shortcut(); quit_with_shortcut();
# check that is has changed color # check that is has changed color
assert_screen 'apps_settings_screen_black'; assert_screen 'apps_settings_screen_black';
@ -1546,7 +1548,7 @@ sub download_testdata {
# We agree that this is not the "correct" way, to enable users to type onto serial console # We agree that this is not the "correct" way, to enable users to type onto serial console
# and that it correctly should be done via groups (dialout) but that would require rebooting # and that it correctly should be done via groups (dialout) but that would require rebooting
# the virtual machine. Therefore we do it this way, which has immediate effect. # the virtual machine. Therefore we do it this way, which has immediate effect.
sub make_serial_writable{ sub make_serial_writable {
become_root(); become_root();
sleep 2; sleep 2;
# Make serial console writable for everyone. # Make serial console writable for everyone.

18
main.pm
View File

@ -33,7 +33,7 @@ testapi::set_distribution(fedoradistribution->new());
# Stolen from openSUSE. # Stolen from openSUSE.
sub unregister_needle_tags($) { sub unregister_needle_tags($) {
my $tag = shift; my $tag = shift;
my @a = @{ needle::tags($tag) }; my @a = @{needle::tags($tag)};
for my $n (@a) { $n->unregister(); } for my $n (@a) { $n->unregister(); }
} }
@ -49,14 +49,14 @@ sub unregister_needle_tags($) {
# 'LANGUAGE-' at all. # 'LANGUAGE-' at all.
sub unregister_prefix_tags { sub unregister_prefix_tags {
my ($prefix, $valueref) = @_; my ($prefix, $valueref) = @_;
NEEDLE: for my $needle ( needle::all() ) { NEEDLE: for my $needle (needle::all()) {
my $unregister = 0; my $unregister = 0;
for my $tag ( @{$needle->{'tags'}} ) { for my $tag (@{$needle->{'tags'}}) {
if ($tag =~ /^\Q$prefix/) { if ($tag =~ /^\Q$prefix/) {
# We have at least one tag matching the prefix, so we # We have at least one tag matching the prefix, so we
# *MAY* want to un-register the needle # *MAY* want to un-register the needle
$unregister = 1; $unregister = 1;
for my $value ( @{$valueref} ) { for my $value (@{$valueref}) {
# At any point if we hit a prefix-value match, we # At any point if we hit a prefix-value match, we
# know we need to keep this needle and can skip # know we need to keep this needle and can skip
# to the next # to the next
@ -85,13 +85,13 @@ sub cleanup_needles() {
# Unregister desktop needles of other desktops when DESKTOP is specified # Unregister desktop needles of other desktops when DESKTOP is specified
if (get_var('DESKTOP')) { if (get_var('DESKTOP')) {
unregister_prefix_tags('DESKTOP', [ get_var('DESKTOP') ]) unregister_prefix_tags('DESKTOP', [get_var('DESKTOP')]);
} }
# Unregister non-language-appropriate needles. See unregister_except_ # Unregister non-language-appropriate needles. See unregister_except_
# tags for details; basically all needles with at least one LANGUAGE- # tags for details; basically all needles with at least one LANGUAGE-
# tag will be unregistered unless they match the current langauge. # tag will be unregistered unless they match the current langauge.
my $langref = [ get_var('LANGUAGE') || 'english' ]; my $langref = [get_var('LANGUAGE') || 'english'];
unregister_prefix_tags('LANGUAGE', $langref); unregister_prefix_tags('LANGUAGE', $langref);
} }
$needle::cleanuphandler = \&cleanup_needles; $needle::cleanuphandler = \&cleanup_needles;
@ -192,15 +192,15 @@ sub load_install_tests() {
my $partitioning = get_var('PARTITIONING'); my $partitioning = get_var('PARTITIONING');
# if PARTITIONING is unset, or one of [...], use disk_guided_empty, # if PARTITIONING is unset, or one of [...], use disk_guided_empty,
# which is the simplest / 'default' case. # which is the simplest / 'default' case.
if (! $partitioning || $partitioning ~~ ['guided_empty', 'guided_free_space']) { if (!$partitioning || $partitioning ~~ ['guided_empty', 'guided_free_space']) {
$storage = "tests/disk_guided_empty.pm"; $storage = "tests/disk_guided_empty.pm";
} }
else { else {
$storage = "tests/disk_".$partitioning.".pm"; $storage = "tests/disk_" . $partitioning . ".pm";
} }
autotest::loadtest $storage; autotest::loadtest $storage;
if (get_var("ENCRYPT_PASSWORD")){ if (get_var("ENCRYPT_PASSWORD")) {
autotest::loadtest "tests/disk_guided_encrypted.pm"; autotest::loadtest "tests/disk_guided_encrypted.pm";
} }

7
t/00-tidy.t Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/perl
# Copyright 2021 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
use Test::Strict;
use Test::Code::TidyAll;
tidyall_ok();

View File

@ -8,7 +8,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -5,7 +5,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
$self->root_console(tty=>3); $self->root_console(tty => 3);
# figure out which packages from the update actually got installed # figure out which packages from the update actually got installed
# (if any) as part of this test # (if any) as part of this test
advisory_get_installed_packages; advisory_get_installed_packages;
@ -15,7 +15,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -7,7 +7,7 @@ sub run {
my $self = shift; my $self = shift;
# do the 'repo setup' steps, which set up a repo containing the # do the 'repo setup' steps, which set up a repo containing the
# update packages and run 'dnf update' # update packages and run 'dnf update'
$self->root_console(tty=>3); $self->root_console(tty => 3);
repo_setup; repo_setup;
if (get_var("ADVISORY_BOOT_TEST")) { if (get_var("ADVISORY_BOOT_TEST")) {
# to test boot stuff - in case the update touched grub2, or dracut, # to test boot stuff - in case the update touched grub2, or dracut,
@ -25,7 +25,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -29,7 +29,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -77,7 +77,7 @@ sub run {
# call do_bootloader with postinstall=0, the params, and the mutex, # call do_bootloader with postinstall=0, the params, and the mutex,
# unless we're a VNC install client (no bootloader there) # unless we're a VNC install client (no bootloader there)
unless (get_var("VNC_CLIENT")) { unless (get_var("VNC_CLIENT")) {
do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex, timeout=>$timeout); do_bootloader(postinstall => 0, params => $params, mutex => $mutex, timeout => $timeout);
} }
# Read variables for identification tests (see further). # Read variables for identification tests (see further).
@ -99,7 +99,7 @@ sub run {
# we direct the installer to virtio-console1, and use # we direct the installer to virtio-console1, and use
# virtio-console as a root console # virtio-console as a root console
select_console('virtio-console1'); select_console('virtio-console1');
unless (wait_serial "Use text mode", timeout=>120) { die "Anaconda has not started."; } unless (wait_serial "Use text mode", timeout => 120) { die "Anaconda has not started."; }
type_string "2\n"; type_string "2\n";
unless (wait_serial "Installation") { die "Text version of Anaconda has not started."; } unless (wait_serial "Installation") { die "Text version of Anaconda has not started."; }
} }
@ -133,17 +133,17 @@ sub run {
my $relnum = get_release_number; my $relnum = get_release_number;
my $dclick = 0; my $dclick = 0;
$dclick = 1 if (get_var("DESKTOP") eq "kde"); $dclick = 1 if (get_var("DESKTOP") eq "kde");
assert_and_click("live_start_anaconda_icon", dclick=>$dclick); assert_and_click("live_start_anaconda_icon", dclick => $dclick);
unless (check_screen "anaconda_select_install_lang", 180) { unless (check_screen "anaconda_select_install_lang", 180) {
# click it again - on KDE since 2019-10 or so it seems # click it again - on KDE since 2019-10 or so it seems
# like the first attempt sometimes just doesn't work # like the first attempt sometimes just doesn't work
assert_and_click("live_start_anaconda_icon", dclick=>$dclick, timeout=>300); assert_and_click("live_start_anaconda_icon", dclick => $dclick, timeout => 300);
} }
} }
my $language = get_var('LANGUAGE') || 'english'; my $language = get_var('LANGUAGE') || 'english';
# wait for anaconda to appear; we click to work around # wait for anaconda to appear; we click to work around
# RHBZ #1566066 if it happens # RHBZ #1566066 if it happens
assert_and_click("anaconda_select_install_lang", timeout=>300); assert_and_click("anaconda_select_install_lang", timeout => 300);
# Select install language # Select install language
wait_screen_change { assert_and_click "anaconda_select_install_lang_input"; }; wait_screen_change { assert_and_click "anaconda_select_install_lang_input"; };
@ -180,7 +180,7 @@ sub run {
# Here, we will watch for the graphical elements in Anaconda main hub. # Here, we will watch for the graphical elements in Anaconda main hub.
my $branched = get_var('VERSION'); my $branched = get_var('VERSION');
if ($identification eq 'true' or $branched ne "Rawhide") { if ($identification eq 'true' or $branched ne "Rawhide") {
check_left_bar(); # See utils.pm check_left_bar(); # See utils.pm
check_prerelease(); check_prerelease();
check_version(); check_version();
} }
@ -188,13 +188,13 @@ sub run {
# didn't match anything: if the Rawhide warning didn't # didn't match anything: if the Rawhide warning didn't
# show by now it never will, so we'll just wait for the # show by now it never will, so we'll just wait for the
# hub to show up. # hub to show up.
assert_screen "anaconda_main_hub", 900; # assert_screen "anaconda_main_hub", 900;
} }
} }
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -94,16 +94,16 @@ sub run {
} }
# just for convenience - sometimes it's useful to see this log # just for convenience - sometimes it's useful to see this log
# for a success case # for a success case
upload_logs "/tmp/packaging.log", failok=>1; upload_logs "/tmp/packaging.log", failok => 1;
send_key "ctrl-alt-f6"; send_key "ctrl-alt-f6";
# Anaconda hub # Anaconda hub
assert_screen "anaconda_main_hub", 30; # assert_screen "anaconda_main_hub", 30;
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -4,7 +4,7 @@ use testapi;
sub run { sub run {
my $self = shift; my $self = shift;
$self->root_console(tty=>4); $self->root_console(tty => 4);
assert_script_run 'top -i -n20 -b > /var/tmp/top.log', 120; assert_script_run 'top -i -n20 -b > /var/tmp/top.log', 120;
upload_logs '/var/tmp/top.log'; upload_logs '/var/tmp/top.log';
unless (get_var("CANNED")) { unless (get_var("CANNED")) {
@ -20,7 +20,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { 'ignore_failure' => 1 }; return {'ignore_failure' => 1};
} }
1; 1;

View File

@ -5,7 +5,7 @@ use testapi;
sub run { sub run {
my $self = shift; my $self = shift;
$self->root_console(tty=>3, timeout=>30); $self->root_console(tty => 3, timeout => 30);
# if this is a non-English, non-switched layout, load US layout # if this is a non-English, non-switched layout, load US layout
# at this point # at this point
# FIXME: this is all kind of a mess, as on such configs we need # FIXME: this is all kind of a mess, as on such configs we need

View File

@ -11,14 +11,14 @@ sub run {
# with a password that requires Arabic support. # with a password that requires Arabic support.
# Such attempt to log in would always fail. # Such attempt to log in would always fail.
if (get_var("LANGUAGE") ne "arabic" && get_var("USER_LOGIN") ne "false") { if (get_var("LANGUAGE") ne "arabic" && get_var("USER_LOGIN") ne "false") {
console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword")); console_login(user => get_var("USER_LOGIN", "test"), password => get_var("USER_PASSWORD", "weakpassword"));
} }
if (get_var("ROOT_PASSWORD")) { if (get_var("ROOT_PASSWORD")) {
console_login(user=>"root", password=>get_var("ROOT_PASSWORD")); console_login(user => "root", password => get_var("ROOT_PASSWORD"));
} }
} }
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;
# vim: set sw=4 et: # vim: set sw=4 et:

View File

@ -10,7 +10,7 @@ sub run {
# use the desktops' graphical shutdown methods, we just go to a # use the desktops' graphical shutdown methods, we just go to a
# console and run 'poweroff'. We can write separate tests for # console and run 'poweroff'. We can write separate tests for
# properly testing shutdown/reboot/log out from desktops. # properly testing shutdown/reboot/log out from desktops.
$self->root_console(tty=>4); $self->root_console(tty => 4);
# disable the hidden grub menu on Workstation, so post-install # disable the hidden grub menu on Workstation, so post-install
# tests that need to edit boot params will see it. Don't use # tests that need to edit boot params will see it. Don't use
# assert_script_run as this will fail when it's not set # assert_script_run as this will fail when it's not set
@ -23,7 +23,7 @@ sub run {
# even if shutdown fails. we should have a separate test for shutdown/ # even if shutdown fails. we should have a separate test for shutdown/
# logout/reboot stuff, might need some refactoring. # logout/reboot stuff, might need some refactoring.
sub test_flags { sub test_flags {
return { 'norollback' => 1, 'ignore_failure' => 1 }; return {'norollback' => 1, 'ignore_failure' => 1};
} }
1; 1;

View File

@ -11,7 +11,7 @@ sub run {
# handle bootloader, if requested # handle bootloader, if requested
if (get_var("GRUB_POSTINSTALL")) { if (get_var("GRUB_POSTINSTALL")) {
do_bootloader(postinstall=>1, params=>get_var("GRUB_POSTINSTALL"), timeout=>$wait_time); do_bootloader(postinstall => 1, params => get_var("GRUB_POSTINSTALL"), timeout => $wait_time);
$wait_time = 240; $wait_time = 240;
} }
@ -28,16 +28,16 @@ sub run {
# this avoids us waiting 90 seconds for a # to show up # this avoids us waiting 90 seconds for a # to show up
my $origprompt = $testapi::distri->{serial_term_prompt}; my $origprompt = $testapi::distri->{serial_term_prompt};
$testapi::distri->{serial_term_prompt} = '$ '; $testapi::distri->{serial_term_prompt} = '$ ';
console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword")); console_login(user => get_var("USER_LOGIN", "test"), password => get_var("USER_PASSWORD", "weakpassword"));
$testapi::distri->{serial_term_prompt} = $origprompt; $testapi::distri->{serial_term_prompt} = $origprompt;
} }
if (get_var("ROOT_PASSWORD")) { if (get_var("ROOT_PASSWORD")) {
console_login(user=>"root", password=>get_var("ROOT_PASSWORD")); console_login(user => "root", password => get_var("ROOT_PASSWORD"));
} }
} }
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -12,7 +12,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -109,20 +109,20 @@ sub run {
# there are various things we might have to do at a console here # there are various things we might have to do at a console here
# before we actually reboot. let's figure them all out first... # before we actually reboot. let's figure them all out first...
my @actions; my @actions;
push (@actions, 'consoletty0') if (get_var("ARCH") eq "aarch64"); push(@actions, 'consoletty0') if (get_var("ARCH") eq "aarch64");
push (@actions, 'abrt') if (get_var("ABRT", '') eq "system"); push(@actions, 'abrt') if (get_var("ABRT", '') eq "system");
push (@actions, 'rootpw') if (get_var("INSTALLER_NO_ROOT")); push(@actions, 'rootpw') if (get_var("INSTALLER_NO_ROOT"));
# FIXME: remove plymouth from Server install_default_upload on # FIXME: remove plymouth from Server install_default_upload on
# non-aarch64 to work around RHBZ #1933378 # non-aarch64 to work around RHBZ #1933378
unless (get_var("ARCH") eq "aarch64") { unless (get_var("ARCH") eq "aarch64") {
if (get_var("FLAVOR") eq "Server-dvd-iso" && get_var("TEST") eq "install_default_upload") { if (get_var("FLAVOR") eq "Server-dvd-iso" && get_var("TEST") eq "install_default_upload") {
push (@actions, 'noplymouth'); push(@actions, 'noplymouth');
} }
} }
# memcheck test doesn't need to reboot at all. Rebooting from GUI # memcheck test doesn't need to reboot at all. Rebooting from GUI
# for lives is unreliable. And if we're already doing something # for lives is unreliable. And if we're already doing something
# else at a console, we may as well reboot from there too # else at a console, we may as well reboot from there too
push (@actions, 'reboot') if (!get_var("MEMCHECK") && (get_var("LIVE") || @actions)); push(@actions, 'reboot') if (!get_var("MEMCHECK") && (get_var("LIVE") || @actions));
# our approach for taking all these actions doesn't work on VNC # our approach for taking all these actions doesn't work on VNC
# installs, fortunately we don't need any of them in that case # installs, fortunately we don't need any of them in that case
# yet, so for now let's just flush the list here if we're VNC # yet, so for now let's just flush the list here if we're VNC
@ -137,14 +137,14 @@ sub run {
} }
# OK, if we're here, we got actions, so head to a console. Switch # OK, if we're here, we got actions, so head to a console. Switch
# to console after liveinst sometimes takes a while, so 30 secs # to console after liveinst sometimes takes a while, so 30 secs
$self->root_console(timeout=>30); $self->root_console(timeout => 30);
# this is something a couple of actions may need to know # this is something a couple of actions may need to know
my $mount = "/mnt/sysimage"; my $mount = "/mnt/sysimage";
if (get_var("CANNED")) { if (get_var("CANNED")) {
# finding the actual host system root is fun for ostree... # finding the actual host system root is fun for ostree...
$mount = "/mnt/sysimage/ostree/deploy/fedora*/deploy/*.?"; $mount = "/mnt/sysimage/ostree/deploy/fedora*/deploy/*.?";
} }
if (grep {$_ eq 'consoletty0'} @actions) { if (grep { $_ eq 'consoletty0' } @actions) {
# somehow, by this point, localized keyboard layout has been # somehow, by this point, localized keyboard layout has been
# loaded for this tty, so for French and Arabic at least we # loaded for this tty, so for French and Arabic at least we
# need to load the 'us' layout again for the next command to # need to load the 'us' layout again for the next command to
@ -158,22 +158,22 @@ sub run {
# regenerate the bootloader config # regenerate the bootloader config
assert_script_run "chroot $mount grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg"; assert_script_run "chroot $mount grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg";
} }
if (grep {$_ eq 'abrt'} @actions) { if (grep { $_ eq 'abrt' } @actions) {
# Chroot in the newly installed system and switch on ABRT systemwide # Chroot in the newly installed system and switch on ABRT systemwide
assert_script_run "chroot $mount abrt-auto-reporting 1"; assert_script_run "chroot $mount abrt-auto-reporting 1";
} }
if (grep {$_ eq 'rootpw'} @actions) { if (grep { $_ eq 'rootpw' } @actions) {
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
assert_script_run "echo 'root:$root_password' | chpasswd -R $mount"; assert_script_run "echo 'root:$root_password' | chpasswd -R $mount";
} }
if (grep {$_ eq 'noplymouth'} @actions) { if (grep { $_ eq 'noplymouth' } @actions) {
assert_script_run "chroot $mount dnf -y remove plymouth"; assert_script_run "chroot $mount dnf -y remove plymouth";
} }
type_string "reboot\n" if (grep {$_ eq 'reboot'} @actions); type_string "reboot\n" if (grep { $_ eq 'reboot' } @actions);
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -56,7 +56,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1, always_rollback => 1 }; return {fatal => 1, always_rollback => 1};
} }
1; 1;

View File

@ -17,17 +17,17 @@ sub run {
# handle bootloader, if requested # handle bootloader, if requested
if (get_var("GRUB_POSTINSTALL")) { if (get_var("GRUB_POSTINSTALL")) {
do_bootloader(postinstall=>1, params=>get_var("GRUB_POSTINSTALL"), timeout=>$wait_time); do_bootloader(postinstall => 1, params => get_var("GRUB_POSTINSTALL"), timeout => $wait_time);
$wait_time = 300; $wait_time = 300;
} }
# Handle pre-login initial setup if we're doing INSTALL_NO_USER # Handle pre-login initial setup if we're doing INSTALL_NO_USER
if (get_var("INSTALL_NO_USER") && !get_var("_setup_done")) { if (get_var("INSTALL_NO_USER") && !get_var("_setup_done")) {
if (get_var("DESKTOP") eq 'gnome') { if (get_var("DESKTOP") eq 'gnome') {
gnome_initial_setup(prelogin=>1, timeout=>$wait_time); gnome_initial_setup(prelogin => 1, timeout => $wait_time);
} }
else { else {
anaconda_create_user(timeout=>$wait_time); anaconda_create_user(timeout => $wait_time);
# wait out animation # wait out animation
wait_still_screen 3; wait_still_screen 3;
assert_and_click "initialsetup_finish_configuration"; assert_and_click "initialsetup_finish_configuration";
@ -88,7 +88,7 @@ sub run {
# root user now, for subsequent tests to work # root user now, for subsequent tests to work
if (get_var("IMAGE_DEPLOY")) { if (get_var("IMAGE_DEPLOY")) {
send_key "ctrl-alt-f3"; send_key "ctrl-alt-f3";
console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword")); console_login(user => get_var("USER_LOGIN", "test"), password => get_var("USER_PASSWORD", "weakpassword"));
type_string "sudo su\n"; type_string "sudo su\n";
type_string "$password\n"; type_string "$password\n";
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
@ -100,11 +100,11 @@ sub run {
# Move the mouse somewhere it won't highlight the match areas # Move the mouse somewhere it won't highlight the match areas
mouse_set(300, 800); mouse_set(300, 800);
# KDE can take ages to start up # KDE can take ages to start up
check_desktop(timeout=>120); check_desktop(timeout => 120);
} }
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -26,13 +26,13 @@ sub run {
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo --repo=/etc/yum.repos.d/workarounds.repo ./results"; $cmd .= " --repo=/etc/yum.repos.d/advisory.repo --repo=/etc/yum.repos.d/workarounds.repo ./results";
assert_script_run $cmd, 2400; assert_script_run $cmd, 2400;
# good to have the log around for checks # good to have the log around for checks
upload_logs "pylorax.log", failok=>1; upload_logs "pylorax.log", failok => 1;
assert_script_run "mv results/images/boot.iso ./${advortask}-netinst-${arch}.iso"; assert_script_run "mv results/images/boot.iso ./${advortask}-netinst-${arch}.iso";
upload_asset "./${advortask}-netinst-x86_64.iso"; upload_asset "./${advortask}-netinst-x86_64.iso";
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -52,7 +52,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -39,7 +39,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -80,7 +80,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -1,17 +1,17 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
sub run { sub run {
my $self = shift; my $self = shift;
$self->root_console(); $self->root_console();
upload_logs '/tmp/memory.dat'; upload_logs '/tmp/memory.dat';
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;
# vim: set sw=4 et: # vim: set sw=4 et:

View File

@ -8,7 +8,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
$self->root_console(tty=>3); $self->root_console(tty => 3);
# wait for server to be set up # wait for server to be set up
mutex_lock "podman_server_ready"; mutex_lock "podman_server_ready";
mutex_unlock "podman_server_ready"; mutex_unlock "podman_server_ready";
@ -25,7 +25,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -13,7 +13,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -24,7 +24,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -5,7 +5,7 @@ use testapi;
sub run { sub run {
my $self = shift; my $self = shift;
# Anaconda hub # Anaconda hub
assert_screen "anaconda_main_hub", 300; # assert_screen "anaconda_main_hub", 300;
# Select package set. Minimal is the default, if 'default' is specified, skip selection, # Select package set. Minimal is the default, if 'default' is specified, skip selection,
# but verify correct default in some cases # but verify correct default in some cases
@ -41,24 +41,24 @@ sub run {
# select desired environment # select desired environment
# go through the list 20 times at max (to prevent infinite loop when it's missing) # go through the list 20 times at max (to prevent infinite loop when it's missing)
for (my $i = 0; !check_screen("anaconda_".$packageset."_highlighted", 1) && $i < 20; $i++) { for (my $i = 0; !check_screen("anaconda_" . $packageset . "_highlighted", 1) && $i < 20; $i++) {
send_key "down"; send_key "down";
} }
send_key "spc"; send_key "spc";
# check that desired environment is selected # check that desired environment is selected
assert_screen "anaconda_".$packageset."_selected"; assert_screen "anaconda_" . $packageset . "_selected";
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";
# Anaconda hub # Anaconda hub
assert_screen "anaconda_main_hub", 50; # assert_screen "anaconda_main_hub", 50;
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -74,7 +74,7 @@ sub _pxe_setup {
# download kernel and initramfs # download kernel and initramfs
my $location = get_var("LOCATION"); my $location = get_var("LOCATION");
my $kernpath = "images/pxeboot"; my $kernpath = "images/pxeboot";
# for some crazy reason these are in a different place for ppc64 # for some crazy reason these are in a different place for ppc64
$kernpath = "ppc/ppc64" if ($arch eq 'ppc64le'); $kernpath = "ppc/ppc64" if ($arch eq 'ppc64le');
assert_script_run "curl -o /var/lib/tftpboot/fedora/vmlinuz $location/Everything/${arch}/os/${kernpath}/vmlinuz"; assert_script_run "curl -o /var/lib/tftpboot/fedora/vmlinuz $location/Everything/${arch}/os/${kernpath}/vmlinuz";
assert_script_run "curl -o /var/lib/tftpboot/fedora/initrd.img $location/Everything/${arch}/os/${kernpath}/initrd.img"; assert_script_run "curl -o /var/lib/tftpboot/fedora/initrd.img $location/Everything/${arch}/os/${kernpath}/initrd.img";
@ -93,7 +93,7 @@ sub _pxe_setup {
} }
sub run { sub run {
my $self=shift; my $self = shift;
# disable systemd-resolved, it conflicts with dnsmasq # disable systemd-resolved, it conflicts with dnsmasq
unless (script_run "systemctl is-active systemd-resolved.service") { unless (script_run "systemctl is-active systemd-resolved.service") {
script_run "systemctl stop systemd-resolved.service"; script_run "systemctl stop systemd-resolved.service";
@ -168,7 +168,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -20,7 +20,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -7,7 +7,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
boot_to_login_screen(timeout => 300); boot_to_login_screen(timeout => 300);
$self->root_console(tty=>3); $self->root_console(tty => 3);
setup_tap_static('172.16.2.115', 'vnc002.test.openqa.fedoraproject.org'); setup_tap_static('172.16.2.115', 'vnc002.test.openqa.fedoraproject.org');
# test test: check if we can see the server # test test: check if we can see the server
assert_script_run "ping -c 2 172.16.2.114"; assert_script_run "ping -c 2 172.16.2.114";
@ -18,7 +18,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -13,7 +13,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -7,7 +7,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
boot_to_login_screen(timeout => 300); boot_to_login_screen(timeout => 300);
$self->root_console(tty=>3); $self->root_console(tty => 3);
setup_tap_static('172.16.2.117', 'vnc004.test.openqa.fedoraproject.org'); setup_tap_static('172.16.2.117', 'vnc004.test.openqa.fedoraproject.org');
# install tigervnc (Boxes doesn't do reverse VNC) # install tigervnc (Boxes doesn't do reverse VNC)
assert_script_run "dnf -y install tigervnc", 180; assert_script_run "dnf -y install tigervnc", 180;
@ -17,7 +17,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -50,7 +50,7 @@ sub run {
# on GNOME installs (Workstation Live and Silverblue) we don't # on GNOME installs (Workstation Live and Silverblue) we don't
# need to set a root password or create a user; on other flavors # need to set a root password or create a user; on other flavors
# we must # we must
unless (get_var("DESKTOP") eq "gnome" ) { unless (get_var("DESKTOP") eq "gnome") {
assert_and_click "anaconda_install_root_password"; assert_and_click "anaconda_install_root_password";
# from anaconda-35.22.1 onwards, we have to click 'enable root # from anaconda-35.22.1 onwards, we have to click 'enable root
# account' before typing the password. For older versions, # account' before typing the password. For older versions,

View File

@ -10,7 +10,7 @@ sub run {
my $self = shift; my $self = shift;
# At first, we need to set time and time zones manually. # At first, we need to set time and time zones manually.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Switch off automatic time. # Switch off automatic time.
assert_script_run("timedatectl set-ntp 0"); assert_script_run("timedatectl set-ntp 0");
# Set the time zone # Set the time zone

View File

@ -9,7 +9,7 @@ sub run {
my $self = shift; my $self = shift;
# Click on the Alarm button. # Click on the Alarm button.
assert_and_click("clocks_button_alarm"); assert_and_click("clocks_button_alarm");
# Add a new alarm using the Add Alarm button # Add a new alarm using the Add Alarm button
assert_and_click("clocks_button_add_alarm"); assert_and_click("clocks_button_add_alarm");

View File

@ -9,7 +9,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# Switch to console # Switch to console
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Perform git test # Perform git test
check_and_install_git(); check_and_install_git();
# Download the test data # Download the test data

View File

@ -21,7 +21,7 @@ sub run {
wait_still_screen("2"); wait_still_screen("2");
# Go to console # Go to console
$self->root_console(tty=>3); $self->root_console(tty => 3);
# List the location # List the location
assert_script_run("ls /home/test/Pictures/"); assert_script_run("ls /home/test/Pictures/");

View File

@ -10,7 +10,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# Switch to console # Switch to console
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Perform git test # Perform git test
check_and_install_git(); check_and_install_git();
# Download the test data # Download the test data

View File

@ -6,23 +6,23 @@ use utils;
# This part of the suite tests if About works. # This part of the suite tests if About works.
sub run { sub run {
my $self = shift; my $self = shift;
# Open the menu by clicking on the Burger icon # Open the menu by clicking on the Burger icon
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# In the menu, select the About item. # In the menu, select the About item.
assert_and_click("evince_menu_about", button => "left", timeout => 30); assert_and_click("evince_menu_about", button => "left", timeout => 30);
# Check that the About section has been displayed. # Check that the About section has been displayed.
assert_screen("evince_about_shown"); assert_screen("evince_about_shown");
# Click on Credits button to see the second part of the dialogue. # Click on Credits button to see the second part of the dialogue.
assert_and_click("evince_about_credits", button => "left", timeout => 30); assert_and_click("evince_about_credits", button => "left", timeout => 30);
# Check that Credits are accessible and visible, too. # Check that Credits are accessible and visible, too.
assert_screen("evince_credits_shown"); assert_screen("evince_credits_shown");
} }

View File

@ -6,37 +6,37 @@ use utils;
# This part of the suite tests an annotation can be added to the displayed content. # This part of the suite tests an annotation can be added to the displayed content.
sub run { sub run {
my $self = shift; my $self = shift;
# Click on the Pencil button. # Click on the Pencil button.
assert_and_click("evince_add_annotation", button => "left", timeout => 30); assert_and_click("evince_add_annotation", button => "left", timeout => 30);
# Click on Note text. # Click on Note text.
assert_and_click("evince_add_annotation_text", button => "left", timeout => 30); assert_and_click("evince_add_annotation_text", button => "left", timeout => 30);
# Select location to add annotation. # Select location to add annotation.
assert_and_click("evince_select_annotation_place", button => "left", timeout => 30); assert_and_click("evince_select_annotation_place", button => "left", timeout => 30);
# Enter some text to the annotation. # Enter some text to the annotation.
type_very_safely("Add note"); type_very_safely("Add note");
# Check that the annotation window has appeared with that text. # Check that the annotation window has appeared with that text.
assert_screen("evince_annotation_added"); assert_screen("evince_annotation_added");
# Close the annotation. # Close the annotation.
assert_and_click("evince_close_annotation", button => "left", timeout => 30); assert_and_click("evince_close_annotation", button => "left", timeout => 30);
# Check that the annotation is still placed in the document. # Check that the annotation is still placed in the document.
assert_screen("evince_annotation_placed"); assert_screen("evince_annotation_placed");
# Open the annotation's context menu. # Open the annotation's context menu.
assert_and_click("evince_annotation_placed", button => "right", timeout => 30); assert_and_click("evince_annotation_placed", button => "right", timeout => 30);
# Remove the annotation. # Remove the annotation.
assert_and_click("evince_remove_annotation", button => "left", timeout => 30); assert_and_click("evince_remove_annotation", button => "left", timeout => 30);
# Check that the annotation has been removed. # Check that the annotation has been removed.
assert_screen("evince_annotation_removed"); assert_screen("evince_annotation_removed");
} }

View File

@ -6,22 +6,22 @@ use utils;
# This part of the suite tests that Evince can change the zoom of the document. # This part of the suite tests that Evince can change the zoom of the document.
sub run { sub run {
my $self = shift; my $self = shift;
# Click on zoom menu to open choices. # Click on zoom menu to open choices.
assert_and_click("evince_change_zoom", button => "left", timeout => 30); assert_and_click("evince_change_zoom", button => "left", timeout => 30);
# Select 200%. # Select 200%.
assert_and_click("evince_select_zoom_200", button => "left", timeout => 30); assert_and_click("evince_select_zoom_200", button => "left", timeout => 30);
# Check that the document zoom was changed. # Check that the document zoom was changed.
assert_screen("evince_document_zoom_200"); assert_screen("evince_document_zoom_200");
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,32 +6,32 @@ use utils;
# This part of the suite tests that Evince is able to display content in a two-page mode. # This part of the suite tests that Evince is able to display content in a two-page mode.
sub run { sub run {
my $self = shift; my $self = shift;
# Click on the Zoom menu to change a different zoom for next steps. # Click on the Zoom menu to change a different zoom for next steps.
assert_and_click("evince_change_zoom", button => "left", timeout => 30); assert_and_click("evince_change_zoom", button => "left", timeout => 30);
# Select the Fit Width option to be able to see the whole layout. # Select the Fit Width option to be able to see the whole layout.
assert_and_click("evince_select_zoom_fitwidth", button => "left", timeout => 30); assert_and_click("evince_select_zoom_fitwidth", button => "left", timeout => 30);
#Dismiss the dialogue #Dismiss the dialogue
send_key("esc"); send_key("esc");
# Enter the menu # Enter the menu
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
# Select the Dual mode # Select the Dual mode
assert_and_click("evince_menu_dual", button => "left", timeout => 30); assert_and_click("evince_menu_dual", button => "left", timeout => 30);
# Dismiss the menu # Dismiss the menu
send_key("esc"); send_key("esc");
# Check that the content is displayed in dual mode. # Check that the content is displayed in dual mode.
assert_screen("evince_dual_mode", timeout => 30); assert_screen("evince_dual_mode", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,22 +6,22 @@ use utils;
# This part of the suite tests that Evince can display the Help pages. # This part of the suite tests that Evince can display the Help pages.
sub run { sub run {
my $self = shift; my $self = shift;
# Open menu with Burger icon. # Open menu with Burger icon.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Select the Help item in the menu. # Select the Help item in the menu.
assert_and_click("evince_menu_help", button => "left", timeout => 30); assert_and_click("evince_menu_help", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Check that Help has been shown. # Check that Help has been shown.
assert_screen("evince_help_shown", timeout => 30); assert_screen("evince_help_shown", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,25 +6,25 @@ use utils;
# This part of the suite tests that Evince can be switched into night mode. # This part of the suite tests that Evince can be switched into night mode.
sub run { sub run {
my $self = shift; my $self = shift;
# Click on the Menu button. # Click on the Menu button.
assert_and_click("gnome_burger_menu", timeout => 30, button => "left"); assert_and_click("gnome_burger_menu", timeout => 30, button => "left");
# Click on the Night mode to select it. # Click on the Night mode to select it.
assert_and_click("evince_toggle_night_mode", button => "left", timeout => 30); assert_and_click("evince_toggle_night_mode", button => "left", timeout => 30);
# The menu stays opened, so hit Esc to dismiss it. # The menu stays opened, so hit Esc to dismiss it.
send_key("esc"); send_key("esc");
wait_still_screen 2; wait_still_screen 2;
# Check that night mode has been activated. # Check that night mode has been activated.
assert_screen("evince_night_mode", timeout => 30); assert_screen("evince_night_mode", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,22 +6,22 @@ use utils;
# This part of the suite tests that Evince can show Document Properties. # This part of the suite tests that Evince can show Document Properties.
sub run { sub run {
my $self = shift; my $self = shift;
# Open the menu. # Open the menu.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Select the Properties item. # Select the Properties item.
assert_and_click("evince_menu_properties", button => "left", timeout => 30); assert_and_click("evince_menu_properties", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Check that Properties are shown. # Check that Properties are shown.
assert_screen("evince_properties_shown", timeout => 30); assert_screen("evince_properties_shown", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -7,28 +7,28 @@ use utils;
sub rotate_content { sub rotate_content {
# Send the key combo to rotate the content # Send the key combo to rotate the content
send_key("ctrl-right"); send_key("ctrl-right");
} }
sub run { sub run {
my $self = shift; my $self = shift;
# Rotate the content once. # Rotate the content once.
rotate_content(); rotate_content();
# Check that the window content has been rotated. # Check that the window content has been rotated.
assert_screen("evince_content_rotated_once", timeout => 30); assert_screen("evince_content_rotated_once", timeout => 30);
# Rotate the content again. # Rotate the content again.
rotate_content(); rotate_content();
# Check that the window content has been rotated. # Check that the window content has been rotated.
assert_screen("evince_content_rotated_twice", timeout => 30); assert_screen("evince_content_rotated_twice", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,36 +6,36 @@ use utils;
# This part of the suite tests tests that Evince can Save the document As another document. # This part of the suite tests tests that Evince can Save the document As another document.
sub run { sub run {
my $self = shift; my $self = shift;
# Open the menu. # Open the menu.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
# Select Save As # Select Save As
assert_and_click("evince_menu_saveas", button => "left", timeout => 30); assert_and_click("evince_menu_saveas", button => "left", timeout => 30);
# Type a new name. # Type a new name.
type_very_safely("alternative"); type_very_safely("alternative");
# Click on the Save button # Click on the Save button
assert_and_click("gnome_button_save_blue", button => "left", timeout => 30); assert_and_click("gnome_button_save_blue", button => "left", timeout => 30);
# Now the document is saved under a different name. We will switch to the # Now the document is saved under a different name. We will switch to the
# terminal console to check that it has been created. # terminal console to check that it has been created.
$self->root_console(tty=>3); $self->root_console(tty => 3);
my $filename = "alternative.pdf"; my $filename = "alternative.pdf";
if (script_run("ls /home/test/Documents/${filename}")) { if (script_run("ls /home/test/Documents/${filename}")) {
$filename = "alternativeevince.pdf"; $filename = "alternativeevince.pdf";
assert_script_run("ls /home/test/Documents/${filename}"); assert_script_run("ls /home/test/Documents/${filename}");
record_soft_failure("File name was not pre-selected in Save As dialog: https://gitlab.gnome.org/GNOME/gtk/-/issues/4768"); record_soft_failure("File name was not pre-selected in Save As dialog: https://gitlab.gnome.org/GNOME/gtk/-/issues/4768");
} }
# Now, check that the new file does not differ from the original one. # Now, check that the new file does not differ from the original one.
assert_script_run("diff /home/test/Documents/evince.pdf /home/test/Documents/${filename}"); assert_script_run("diff /home/test/Documents/evince.pdf /home/test/Documents/${filename}");
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,23 +6,23 @@ use utils;
# This part of the suite tests the ability to search string in the text. # This part of the suite tests the ability to search string in the text.
sub run { sub run {
my $self = shift; my $self = shift;
# Click on the Search button to search for text # Click on the Search button to search for text
assert_and_click("evince_search_button", button => "left", timeout => 30); assert_and_click("evince_search_button", button => "left", timeout => 30);
# Type *pages*. # Type *pages*.
type_very_safely("pages"); type_very_safely("pages");
# Press Enter. # Press Enter.
send_key("ret"); send_key("ret");
# Check that the typed text has been found. # Check that the typed text has been found.
assert_screen("evince_search_found", timeout => 30); assert_screen("evince_search_found", timeout => 30);
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,34 +6,34 @@ use utils;
# This part of the suite tests that Evince displays shortcuts. # This part of the suite tests that Evince displays shortcuts.
sub run { sub run {
my $self = shift; my $self = shift;
# Open the menu # Open the menu
assert_and_click("gnome_burger_menu", button => "left", timeout => 30); assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Select the Keyboard Shortcuts item # Select the Keyboard Shortcuts item
assert_and_click("evince_menu_shortcuts", button => "left", timeout => 30); assert_and_click("evince_menu_shortcuts", button => "left", timeout => 30);
wait_still_screen 2; wait_still_screen 2;
# Check that Shortcuts has been shown # Check that Shortcuts has been shown
assert_screen("evince_shortcuts_shown"); assert_screen("evince_shortcuts_shown");
# Click on number 2 to arrive to the second page # Click on number 2 to arrive to the second page
assert_and_click("evince_shortcuts_second", button => "left", timeout => 30); assert_and_click("evince_shortcuts_second", button => "left", timeout => 30);
# Check that Shortcuts 2 has been shown # Check that Shortcuts 2 has been shown
assert_screen("evince_shortcuts_second_shown"); assert_screen("evince_shortcuts_second_shown");
# Click on number 3 to arrive to the second page # Click on number 3 to arrive to the second page
assert_and_click("evince_shortcuts_third", button => "left", timeout => 30); assert_and_click("evince_shortcuts_third", button => "left", timeout => 30);
# Check that Shortcuts 3 has been shown # Check that Shortcuts 3 has been shown
assert_screen("evince_shortcuts_third_shown"); assert_screen("evince_shortcuts_third_shown");
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -9,7 +9,7 @@ sub run {
my $self = shift; my $self = shift;
# Go to the root console to set up the test data and necessary stuff. # Go to the root console to set up the test data and necessary stuff.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Get the test data from the test data repository. # Get the test data from the test data repository.
check_and_install_git(); check_and_install_git();
@ -47,7 +47,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -27,7 +27,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -9,7 +9,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# Click on a word on the line. # Click on a word on the line.
assert_and_click("gte_line_word", clicktime=>0.3); assert_and_click("gte_line_word", clicktime => 0.3);
wait_still_screen(2); wait_still_screen(2);
# Delete the line # Delete the line
send_key("home"); send_key("home");
@ -33,7 +33,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -59,7 +59,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -47,7 +47,7 @@ sub run {
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -37,14 +37,14 @@ sub run {
type_very_safely "list.md"; type_very_safely "list.md";
send_key("ret"); send_key("ret");
# Check that the file has been created # Check that the file has been created
$self->root_console(tty=>3); $self->root_console(tty => 3);
assert_script_run "ls /home/test/list.md"; assert_script_run "ls /home/test/list.md";
desktop_vt(); desktop_vt();
} }
sub test_flags { sub test_flags {
return { milestone => 1 }; return {milestone => 1};
} }
1; 1;

View File

@ -24,7 +24,7 @@ sub run {
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -23,7 +23,7 @@ sub run {
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -66,7 +66,7 @@ sub run {
sub test_flags { sub test_flags {
return { always_rollback => 1 }; return {always_rollback => 1};
} }
1; 1;

View File

@ -8,31 +8,31 @@ use utils;
# This subroutine opens a section, checks that its content # This subroutine opens a section, checks that its content
# is listed and returns to the main page. # is listed and returns to the main page.
sub visit_section { sub visit_section {
my $section = shift; my $section = shift;
send_key_until_needlematch("help_section_$section", "down", 40, 1 ); send_key_until_needlematch("help_section_$section", "down", 40, 1);
click_lastmatch(); click_lastmatch();
assert_screen("help_section_content_$section"); assert_screen("help_section_content_$section");
assert_and_click("help_breadcrumbs_home"); assert_and_click("help_breadcrumbs_home");
assert_screen("help_main_screen"); assert_screen("help_main_screen");
} }
sub run { sub run {
my $self = shift; my $self = shift;
# Run the application # Run the application
menu_launch_type("Help"); menu_launch_type("Help");
assert_screen("help_main_screen", timeout => 60); assert_screen("help_main_screen", timeout => 60);
# Let us click on Section to open it and check that there is content inside. # Let us click on Section to open it and check that there is content inside.
visit_section("desktop"); visit_section("desktop");
visit_section("networking"); visit_section("networking");
visit_section("sound"); visit_section("sound");
visit_section("files"); visit_section("files");
visit_section("user"); visit_section("user");
visit_section("hardware"); visit_section("hardware");
visit_section("accessibility"); visit_section("accessibility");
visit_section("tipstricks"); visit_section("tipstricks");
visit_section("morehelp"); visit_section("morehelp");
} }
sub test_flags { sub test_flags {

View File

@ -10,7 +10,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# Switch to console # Switch to console
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Perform git test # Perform git test
check_and_install_git(); check_and_install_git();
# Download the test data # Download the test data

View File

@ -32,7 +32,7 @@ sub run {
assert_screen("nautilus_test_file"); assert_screen("nautilus_test_file");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Verify that the new file exists in original location. # Verify that the new file exists in original location.
assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The test file was incorrectly removed from the old location.', quiet => '0'); assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The test file was incorrectly removed from the old location.', quiet => '0');

View File

@ -6,7 +6,7 @@ use utils;
# Create a new directory. # Create a new directory.
sub run { sub run {
my $self = shift; my $self = shift;
# Enter the Documents directory to get to the test data. # Enter the Documents directory to get to the test data.
assert_and_click("nautilus_directory_documents"); assert_and_click("nautilus_directory_documents");
@ -28,7 +28,7 @@ my $self = shift;
assert_screen("nautilus_new_directory_check"); assert_screen("nautilus_new_directory_check");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Check that the directory can be listed. # Check that the directory can be listed.
assert_script_run("ls /home/test/Documents/new_directory", fail_message => "The expected directory does not exist."); assert_script_run("ls /home/test/Documents/new_directory", fail_message => "The expected directory does not exist.");

View File

@ -57,7 +57,7 @@ sub run {
assert_screen("nautilus_test_file"); assert_screen("nautilus_test_file");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Verify that the first file still exists in the location as it was restored from the bin. # Verify that the first file still exists in the location as it was restored from the bin.
assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The file has not been found in the location.', quiet => '0'); assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The file has not been found in the location.', quiet => '0');

View File

@ -29,7 +29,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return {always_rollback => 1}; return {always_rollback => 1};
} }
1; 1;

View File

@ -6,56 +6,56 @@ use utils;
# Show and unshow hidden files. # Show and unshow hidden files.
sub run { sub run {
my $self = shift; my $self = shift;
# Enter the Documents directory. # Enter the Documents directory.
assert_and_click("nautilus_directory_documents", timeout => '30', button => 'left', mousehide => '1'); assert_and_click("nautilus_directory_documents", timeout => '30', button => 'left', mousehide => '1');
# Check that we are in the Documents directory. # Check that we are in the Documents directory.
assert_screen("nautilus_documents_active", timeout => '30', no_wait => '0'); assert_screen("nautilus_documents_active", timeout => '30', no_wait => '0');
# Check if the hidden files are set to shown. If so, let's remember this status quo for further testing. # Check if the hidden files are set to shown. If so, let's remember this status quo for further testing.
my $hidden_a = 0; my $hidden_a = 0;
my $hidden_b = 0; my $hidden_b = 0;
# Set the a variable to 1, if the hidden files are shown. # Set the a variable to 1, if the hidden files are shown.
if (check_screen("nautilus_hidden_file_shown")) { if (check_screen("nautilus_hidden_file_shown")) {
$hidden_a = 1; $hidden_a = 1;
} }
# Now toggle the status of the invisible files and check that it is changed now # Now toggle the status of the invisible files and check that it is changed now
# using the keyboard shortcut. # using the keyboard shortcut.
send_key("ctrl-h"); send_key("ctrl-h");
wait_still_screen(2); wait_still_screen(2);
# Now let us check again, if the invisible file is seen. # Now let us check again, if the invisible file is seen.
if (check_screen("nautilus_hidden_file_shown")) { if (check_screen("nautilus_hidden_file_shown")) {
$hidden_b = 1; $hidden_b = 1;
} }
# Compare the results. They should differ from each other. # Compare the results. They should differ from each other.
if ($hidden_a == $hidden_b) { if ($hidden_a == $hidden_b) {
die("The ctrl-h keyboard shortcut should have changed the status of invisible files, but the status has not been changed which indicates that the shortcut might not have worked correctly."); die("The ctrl-h keyboard shortcut should have changed the status of invisible files, but the status has not been changed which indicates that the shortcut might not have worked correctly.");
} }
# Now use the menu to change the status of the invisible files. # Now use the menu to change the status of the invisible files.
assert_and_click("gnome_burger_menu"); assert_and_click("gnome_burger_menu");
wait_still_screen(2); wait_still_screen(2);
assert_and_click("nautilus_toggle_hidden_files", timeout => '30', button => 'left', mousehide => '1'); assert_and_click("nautilus_toggle_hidden_files", timeout => '30', button => 'left', mousehide => '1');
wait_still_screen(2); wait_still_screen(2);
# Check the current status of the invisible files. # Check the current status of the invisible files.
if (check_screen("nautilus_hidden_file_shown")) { if (check_screen("nautilus_hidden_file_shown")) {
$hidden_b = 1; $hidden_b = 1;
} }
else { else {
$hidden_b = 0; $hidden_b = 0;
} }
# Compare the results. They should be the same if everything up til now has worked correctly. # Compare the results. They should be the same if everything up til now has worked correctly.
if ($hidden_a != $hidden_b) { if ($hidden_a != $hidden_b) {
die("The menu item 'Show hidden files' should have changed the status of the invisible files, but the status has not changed which indicates that the menu item might not have worked correctly."); die("The menu item 'Show hidden files' should have changed the status of the invisible files, but the status has not changed which indicates that the menu item might not have worked correctly.");
} }
} }
sub test_flags { sub test_flags {

View File

@ -32,7 +32,7 @@ sub run {
assert_screen("nautilus_test_file"); assert_screen("nautilus_test_file");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Verify that the new file does not exist in the original location. # Verify that the new file does not exist in the original location.
assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file still exists in the original location, but it should have been removed.'); assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file still exists in the original location, but it should have been removed.');

View File

@ -42,7 +42,7 @@ sub run {
assert_and_click("gnome_select_button"); assert_and_click("gnome_select_button");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Verify that the new file does not exist in the original location. # Verify that the new file does not exist in the original location.
assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file has not been deleted from its original location.'); assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file has not been deleted from its original location.');

View File

@ -52,7 +52,7 @@ sub run {
send_key("esc"); send_key("esc");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Check that the permissions have been changed. # Check that the permissions have been changed.
validate_script_output("ls -l /home/test/Documents/markdown.md", sub { m/-rw-r-----/ }); validate_script_output("ls -l /home/test/Documents/markdown.md", sub { m/-rw-r-----/ });

View File

@ -28,7 +28,7 @@ sub run {
assert_screen("nautilus_rename_check"); assert_screen("nautilus_rename_check");
# Go into the root console and verify the operation in the background. # Go into the root console and verify the operation in the background.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Verify that the new file exists in the location. # Verify that the new file exists in the location.
assert_script_run("ls /home/test/Documents/renamed.md", timeout => '60', fail_message => 'The renamed file has not been found in the location.', quiet => '0'); assert_script_run("ls /home/test/Documents/renamed.md", timeout => '60', fail_message => 'The renamed file has not been found in the location.', quiet => '0');

View File

@ -16,7 +16,7 @@ sub run {
my $side_panel = 0; my $side_panel = 0;
if (check_screen("nautilus_side_panel")) { if (check_screen("nautilus_side_panel")) {
$side_panel = 1; $side_panel = 1;
} }
# Switch off the side panel # Switch off the side panel
@ -31,7 +31,7 @@ sub run {
# Compare the results, they should be different. # Compare the results, they should be different.
if ($off_panel == $side_panel) { if ($off_panel == $side_panel) {
die("The side panel visibility should have been toggled and it is not. That indicates that the keyboard shortcut to toggle it does not work properly."); die("The side panel visibility should have been toggled and it is not. That indicates that the keyboard shortcut to toggle it does not work properly.");
} }
# Use menu to toggle the side panel back. # Use menu to toggle the side panel back.
@ -47,7 +47,7 @@ sub run {
# Compare the results. If everything has been ok until now, the values should not be different. # Compare the results. If everything has been ok until now, the values should not be different.
if ($off_panel != $side_panel) { if ($off_panel != $side_panel) {
die("The side panel visibility should have been toggled back, but it has not been. That indicates that the menu item to toggle it does not work properly."); die("The side panel visibility should have been toggled back, but it has not been. That indicates that the menu item to toggle it does not work properly.");
} }
} }

View File

@ -16,7 +16,7 @@ sub run {
# so there is no need to continue. # so there is no need to continue.
# Also, when subsequent tests fail, the suite will revert to this state for further testing. # Also, when subsequent tests fail, the suite will revert to this state for further testing.
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -22,7 +22,7 @@ sub run {
# so there is no need to continue. # so there is no need to continue.
# Also, when subsequent tests fail, the suite will revert to this state for further testing. # Also, when subsequent tests fail, the suite will revert to this state for further testing.
sub test_flags { sub test_flags {
return { fatal => 1, milestone => 1 }; return {fatal => 1, milestone => 1};
} }
1; 1;

View File

@ -14,7 +14,7 @@ sub run {
# Firewall requires password to be entered and confirmed to start. # Firewall requires password to be entered and confirmed to start.
# View password # View password
assert_screen "auth_required"; assert_screen "auth_required";
my $password = get_var('ROOT_PASSWORD','weakpassword'); my $password = get_var('ROOT_PASSWORD', 'weakpassword');
type_very_safely $password; type_very_safely $password;
send_key 'ret'; send_key 'ret';
sleep 5; sleep 5;

View File

@ -23,7 +23,7 @@ sub run {
assert_script_run "chmod ugo+w /dev/" . $serialdev; assert_script_run "chmod ugo+w /dev/" . $serialdev;
# let's go to another tty and login as regular user # let's go to another tty and login as regular user
send_key "alt-f2"; send_key "alt-f2";
console_login(user=>"test", password=>"weakpassword"); console_login(user => "test", password => "weakpassword");
assert_script_run "curl -O https://fedorapeople.org/groups/qa/tunirtests.tar.gz"; assert_script_run "curl -O https://fedorapeople.org/groups/qa/tunirtests.tar.gz";
assert_script_run "tar xvf tunirtests.tar.gz"; assert_script_run "tar xvf tunirtests.tar.gz";
assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestAtomic01Status -v"; assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestAtomic01Status -v";
@ -45,24 +45,24 @@ sub run {
assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceDisable -v"; assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceDisable -v";
type_string "sudo reboot\n"; type_string "sudo reboot\n";
boot_to_login_screen(timeout => 180); boot_to_login_screen(timeout => 180);
console_login(user=>"root", password=>"weakpassword"); console_login(user => "root", password => "weakpassword");
# we need to use script_run as regular user again # we need to use script_run as regular user again
assert_script_run "sudo chmod ugo+w /dev/" . $serialdev; assert_script_run "sudo chmod ugo+w /dev/" . $serialdev;
# let's go to another tty and login as regular user again # let's go to another tty and login as regular user again
send_key "alt-f2"; send_key "alt-f2";
console_login(user=>"test", password=>"weakpassword"); console_login(user => "test", password => "weakpassword");
_soft_fail_run "tunirtests.testreboot.TestReboot"; _soft_fail_run "tunirtests.testreboot.TestReboot";
assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceManipulation -v"; assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceManipulation -v";
# this test only works properly as a regular user # this test only works properly as a regular user
_soft_fail_run "tunirtests.cloudtests.TestJournalWrittenAfterReboot", 0; _soft_fail_run "tunirtests.cloudtests.TestJournalWrittenAfterReboot", 0;
type_string "sudo reboot\n"; type_string "sudo reboot\n";
boot_to_login_screen(timeout => 180); boot_to_login_screen(timeout => 180);
console_login(user=>"root", password=>"weakpassword"); console_login(user => "root", password => "weakpassword");
# we need to use script_run as regular user again # we need to use script_run as regular user again
assert_script_run "sudo chmod ugo+w /dev/" . $serialdev; assert_script_run "sudo chmod ugo+w /dev/" . $serialdev;
# let's go to another tty and login as regular user again # let's go to another tty and login as regular user again
send_key "alt-f2"; send_key "alt-f2";
console_login(user=>"test", password=>"weakpassword"); console_login(user => "test", password => "weakpassword");
assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceAfter -v"; assert_script_run "sudo python3 -m unittest tunirtests.cloudservice.TestServiceAfter -v";
assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestDockerInstalled -v"; assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestDockerInstalled -v";
assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestDockerStorageSetup -v"; assert_script_run "sudo python3 -m unittest tunirtests.atomictests.TestDockerStorageSetup -v";
@ -76,7 +76,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -6,7 +6,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# This test case tests that packages can be correctly installed and removed. # This test case tests that packages can be correctly installed and removed.
# We will test by installing two packages - ftp and mc. # We will test by installing two packages - ftp and mc.
@ -49,7 +49,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -19,21 +19,21 @@ sub test_routine {
sub run { sub run {
my $self = shift; my $self = shift;
# switch to TTY3 for both graphical and console tests # switch to TTY3 for both graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Run test for the first time # Run test for the first time
test_routine(); test_routine();
# Reboot the system. # Reboot the system.
type_safely "reboot\n"; type_safely "reboot\n";
# This time, we will need to login manually. # This time, we will need to login manually.
boot_to_login_screen; boot_to_login_screen;
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Run the tests for the second time. # Run the tests for the second time.
test_routine(); test_routine();
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -4,15 +4,15 @@ use testapi;
use utils; use utils;
sub run { sub run {
my $self=shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
validate_script_output 'getenforce', sub { $_ =~ m/Enforcing/ }; validate_script_output 'getenforce', sub { $_ =~ m/Enforcing/ };
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -6,7 +6,7 @@ use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# we could make this slightly more 'efficient' by assuming chronyd # we could make this slightly more 'efficient' by assuming chronyd
# is always going to be enabled/running at first, but it's safer # is always going to be enabled/running at first, but it's safer
# to force an expected starting state. # to force an expected starting state.
@ -14,7 +14,7 @@ sub run {
script_run "systemctl disable chronyd.service"; script_run "systemctl disable chronyd.service";
script_run "reboot", 0; script_run "reboot", 0;
boot_to_login_screen; boot_to_login_screen;
$self->root_console(tty=>3); $self->root_console(tty => 3);
# note the use of ! here is a bash-ism, but it sure makes life easier # note the use of ! here is a bash-ism, but it sure makes life easier
assert_script_run '! systemctl is-enabled chronyd.service'; assert_script_run '! systemctl is-enabled chronyd.service';
assert_script_run '! systemctl is-active chronyd.service'; assert_script_run '! systemctl is-active chronyd.service';
@ -33,14 +33,14 @@ sub run {
assert_script_run '! ps -C chronyd'; assert_script_run '! ps -C chronyd';
script_run "reboot", 0; script_run "reboot", 0;
boot_to_login_screen; boot_to_login_screen;
$self->root_console(tty=>3); $self->root_console(tty => 3);
assert_script_run 'systemctl is-enabled chronyd.service'; assert_script_run 'systemctl is-enabled chronyd.service';
assert_script_run 'systemctl is-active chronyd.service'; assert_script_run 'systemctl is-active chronyd.service';
assert_script_run 'ps -C chronyd'; assert_script_run 'ps -C chronyd';
script_run "systemctl disable chronyd.service"; script_run "systemctl disable chronyd.service";
script_run "reboot", 0; script_run "reboot", 0;
boot_to_login_screen; boot_to_login_screen;
$self->root_console(tty=>3); $self->root_console(tty => 3);
assert_script_run '! systemctl is-enabled chronyd.service'; assert_script_run '! systemctl is-enabled chronyd.service';
assert_script_run '! systemctl is-active chronyd.service'; assert_script_run '! systemctl is-active chronyd.service';
assert_script_run '! ps -C chronyd'; assert_script_run '! ps -C chronyd';
@ -48,7 +48,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -5,7 +5,7 @@ use testapi;
sub run { sub run {
my $self = shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# "Job foo.service/start deleted to break ordering cycle"-type # "Job foo.service/start deleted to break ordering cycle"-type
# message in the log indicates a service got taken out of the boot # message in the log indicates a service got taken out of the boot
# process to resolve some kind of dependency loop, see e.g. # process to resolve some kind of dependency loop, see e.g.
@ -42,7 +42,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -3,9 +3,9 @@ use strict;
use testapi; use testapi;
sub run { sub run {
my $self=shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Check that journalctl DOESN'T output "No entries". This is also the case when journal files are missing. # Check that journalctl DOESN'T output "No entries". This is also the case when journal files are missing.
# NOTE: We are quietly assuming that something was logged in journal in last 30 minutes. Should be boot log, # NOTE: We are quietly assuming that something was logged in journal in last 30 minutes. Should be boot log,
# switch to TTY3 etc. # switch to TTY3 etc.
@ -16,7 +16,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -6,7 +6,7 @@ use packagetest;
sub run { sub run {
my $self = shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# enable test repos and install test packages # enable test repos and install test packages
prepare_test_packages; prepare_test_packages;
# check rpm agrees they installed good # check rpm agrees they installed good
@ -24,7 +24,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -4,9 +4,9 @@ use testapi;
use utils; use utils;
sub run { sub run {
my $self=shift; my $self = shift;
# switch to TTY3 for both, graphical and console tests # switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3); $self->root_console(tty => 3);
# The pre-created image has a special file left in the home # The pre-created image has a special file left in the home
# directory. This checks that the file has been left there # directory. This checks that the file has been left there
# correctly after system reinstall. # correctly after system reinstall.
@ -15,7 +15,7 @@ sub run {
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -23,7 +23,7 @@ sub run {
menu_launch_type("terminal"); menu_launch_type("terminal");
} }
assert_screen("apps_run_terminal"); assert_screen("apps_run_terminal");
wait_still_screen(stilltime=>5, similarity_level=>42); wait_still_screen(stilltime => 5, similarity_level => 42);
# Run the test commands and record their output in the test file. # Run the test commands and record their output in the test file.
enter_cmd("fc-match sans > test.txt"); enter_cmd("fc-match sans > test.txt");
@ -42,7 +42,7 @@ sub run {
# If the language is among supported languages # If the language is among supported languages
if ($language ~~ @supported) { if ($language ~~ @supported) {
# Go to root console for script assertions. # Go to root console for script assertions.
$self->root_console(tty=>3); $self->root_console(tty => 3);
# Load us keys to be used on console # Load us keys to be used on console
script_run("loadkeys us"); script_run("loadkeys us");
# Navigate to the home directory. # Navigate to the home directory.
@ -51,7 +51,7 @@ sub run {
# Download the language reference file. # Download the language reference file.
script_run("wget https://fedorapeople.org/groups/qa/openqa-fonts/$language-reference.txt"); script_run("wget https://fedorapeople.org/groups/qa/openqa-fonts/$language-reference.txt");
# upload the log for debugging. # upload the log for debugging.
upload_logs "test.txt", failok=>1; upload_logs "test.txt", failok => 1;
# Compare the test file and the reference file. # Compare the test file and the reference file.
assert_script_run("diff -u test.txt $language-reference.txt"); assert_script_run("diff -u test.txt $language-reference.txt");
} }

View File

@ -6,7 +6,7 @@ use tapnet;
use utils; use utils;
sub run { sub run {
my $self=shift; my $self = shift;
# use compose repo, disable u-t, etc. # use compose repo, disable u-t, etc.
repo_setup(); repo_setup();
# install postgresql # install postgresql
@ -19,7 +19,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -15,7 +15,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -29,55 +29,55 @@ sub run {
my $self = shift; my $self = shift;
check_desktop; check_desktop;
# switch to a VT and disable things that can mess with the test # switch to a VT and disable things that can mess with the test
$self->root_console(tty=>3); $self->root_console(tty => 3);
disable_firefox_studies; disable_firefox_studies;
desktop_vt; desktop_vt;
send_key 'super'; send_key 'super';
# wait out animations # wait out animations
wait_still_screen(stilltime=>4, similarity_level=>45); wait_still_screen(stilltime => 4, similarity_level => 45);
assert_and_click 'browser_launcher'; assert_and_click 'browser_launcher';
assert_screen 'browser', 45; assert_screen 'browser', 45;
# firefox is quite grindy on startup, let it settle # firefox is quite grindy on startup, let it settle
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
# open a new tab so we don't race with the default page load # open a new tab so we don't race with the default page load
# (also focuses the location bar for us) # (also focuses the location bar for us)
_open_new_tab; _open_new_tab;
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
sleep 3; sleep 3;
# check FAS, typing slowly to avoid errors # check FAS, typing slowly to avoid errors
type_very_safely "https://accounts.fedoraproject.org/\n"; type_very_safely "https://accounts.fedoraproject.org/\n";
assert_screen 'browser_fas_home'; assert_screen 'browser_fas_home';
_open_new_tab; _open_new_tab;
wait_still_screen(stilltime=>2, similarity_level=>45); wait_still_screen(stilltime => 2, similarity_level => 45);
sleep 2; sleep 2;
type_very_safely "https://kernel.org\n"; type_very_safely "https://kernel.org\n";
assert_and_click "browser_kernelorg_patch"; assert_and_click "browser_kernelorg_patch";
wait_still_screen(stilltime=>2, similarity_level=>45); wait_still_screen(stilltime => 2, similarity_level => 45);
# browsers do...something...when the download completes, and we # browsers do...something...when the download completes, and we
# expect there's a single click to make it go away and return # expect there's a single click to make it go away and return
# browser to a state where we can open a new tab # browser to a state where we can open a new tab
assert_and_click "browser_download_complete"; assert_and_click "browser_download_complete";
wait_still_screen(stilltime=>2, similarity_level=>45); wait_still_screen(stilltime => 2, similarity_level => 45);
# we'll check it actually downloaded later # we'll check it actually downloaded later
# add-on test: at present all desktops we test (KDE, GNOME) are # add-on test: at present all desktops we test (KDE, GNOME) are
# using Firefox by default so we do this unconditionally, but we # using Firefox by default so we do this unconditionally, but we
# may need to conditionalize it if we ever test desktops whose # may need to conditionalize it if we ever test desktops whose
# default browser doesn't support add-ons or uses different ones # default browser doesn't support add-ons or uses different ones
_open_new_tab; _open_new_tab;
wait_still_screen(stilltime=>2, similarity_level=>45); wait_still_screen(stilltime => 2, similarity_level => 45);
sleep 2; sleep 2;
type_very_safely "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/\n"; type_very_safely "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/\n";
assert_and_click "firefox_addon_add"; assert_and_click "firefox_addon_add";
assert_and_click "firefox_addon_install"; assert_and_click "firefox_addon_install";
assert_and_click "firefox_addon_success"; assert_and_click "firefox_addon_success";
# go to a console and check download worked # go to a console and check download worked
$self->root_console(tty=>3); $self->root_console(tty => 3);
my $user = get_var("USER_LOGIN", "test"); my $user = get_var("USER_LOGIN", "test");
assert_script_run "test -e /home/$user/Downloads/patch-*.xz"; assert_script_run "test -e /home/$user/Downloads/patch-*.xz";
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -8,7 +8,7 @@ sub run {
# "Login without a (fingerprint) reader" # "Login without a (fingerprint) reader"
my $self = shift; my $self = shift;
my $user = get_var("USER_LOGIN", "test"); my $user = get_var("USER_LOGIN", "test");
$self->root_console(tty=>6); $self->root_console(tty => 6);
script_run 'dnf -y install socat', 180; script_run 'dnf -y install socat', 180;
assert_script_run 'mkdir -p /etc/systemd/system/fprintd.service.d'; assert_script_run 'mkdir -p /etc/systemd/system/fprintd.service.d';
# configure fprintd dummy reader, see # configure fprintd dummy reader, see
@ -24,22 +24,22 @@ sub run {
send_key_until_needlematch("graphical_login_input", "ret", 3, 5); send_key_until_needlematch("graphical_login_input", "ret", 3, 5);
type_very_safely "weakpassword"; type_very_safely "weakpassword";
send_key "ret"; send_key "ret";
check_desktop(timeout=>60); check_desktop(timeout => 60);
wait_still_screen 10; wait_still_screen 10;
$self->root_console(tty=>5); $self->root_console(tty => 5);
# now we enroll a fingerprint, we run the enrol process on tty5... # now we enroll a fingerprint, we run the enrol process on tty5...
type_string "fprintd-enroll $user\n"; type_string "fprintd-enroll $user\n";
sleep 2; sleep 2;
$self->root_console(tty=>6); $self->root_console(tty => 6);
# ...and do the scans (we need exactly 5) on tty4. # ...and do the scans (we need exactly 5) on tty4.
for my $n (1..5) { for my $n (1 .. 5) {
assert_script_run "echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt"; assert_script_run "echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt";
} }
# now we will reboot and do step 3: # now we will reboot and do step 3:
# "Login using fingerprint" # "Login using fingerprint"
type_string "reboot\n"; type_string "reboot\n";
assert_screen "graphical_login", 180; assert_screen "graphical_login", 180;
$self->root_console(tty=>6); $self->root_console(tty => 6);
# the GDM tty needs to be active when the scan happens, so we will # the GDM tty needs to be active when the scan happens, so we will
# schedule the scan to happen in 20 seconds then go deal with gdm # schedule the scan to happen in 20 seconds then go deal with gdm
type_string "sleep 20; echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n"; type_string "sleep 20; echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n";
@ -49,13 +49,13 @@ sub run {
# now we check that we see the "or scan fingerprint" message, then # now we check that we see the "or scan fingerprint" message, then
# just wait for the scan to happen and login to succeed # just wait for the scan to happen and login to succeed
assert_screen "graphical_login_fprint"; assert_screen "graphical_login_fprint";
check_desktop(timeout=>60); check_desktop(timeout => 60);
$self->root_console(tty=>6); $self->root_console(tty => 6);
# now we will reboot again and do step 4: # now we will reboot again and do step 4:
# "Password login after failed fingerprint login" # "Password login after failed fingerprint login"
type_string "reboot\n"; type_string "reboot\n";
assert_screen "graphical_login", 180; assert_screen "graphical_login", 180;
$self->root_console(tty=>6); $self->root_console(tty => 6);
# we're doing the same as before, but scanning the 'wrong thing' # we're doing the same as before, but scanning the 'wrong thing'
# (note finger-2 not finger-1) # (note finger-2 not finger-1)
type_string "sleep 20; echo SCAN $user-finger-2 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n"; type_string "sleep 20; echo SCAN $user-finger-2 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n";
@ -71,11 +71,11 @@ sub run {
assert_screen "graphical_login_input"; assert_screen "graphical_login_input";
type_very_safely "weakpassword"; type_very_safely "weakpassword";
send_key "ret"; send_key "ret";
check_desktop(timeout=>60); check_desktop(timeout => 60);
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

View File

@ -66,12 +66,12 @@ sub login_user {
# but rather a "screensaver" screen for the DM. If this is the # but rather a "screensaver" screen for the DM. If this is the
# case, hit Escape to bring back the user list. # case, hit Escape to bring back the user list.
send_key "esc"; send_key "esc";
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
} }
if ($method ne "unlock") { if ($method ne "unlock") {
# When we do not just want to unlock the screen, we need to select a user. # When we do not just want to unlock the screen, we need to select a user.
assert_and_click "login_$user"; assert_and_click "login_$user";
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
} }
if ($method eq "create") { if ($method eq "create") {
# With users that do not have passwords, we need to make an extra round # With users that do not have passwords, we need to make an extra round
@ -79,8 +79,8 @@ sub login_user {
type_very_safely "$password\n"; type_very_safely "$password\n";
} }
type_very_safely "$password\n"; type_very_safely "$password\n";
check_desktop(timeout=>60) if ($args{checklogin}); check_desktop(timeout => 60) if ($args{checklogin});
wait_still_screen(stilltime=>5, similarity_level=>45); wait_still_screen(stilltime => 5, similarity_level => 45);
} }
sub check_user_logged_in { sub check_user_logged_in {
@ -176,7 +176,7 @@ sub run {
our $desktop = get_var("DESKTOP"); our $desktop = get_var("DESKTOP");
# replace the wallpaper with a black image, this should work for # replace the wallpaper with a black image, this should work for
# all desktops. Takes effect after a logout / login cycle # all desktops. Takes effect after a logout / login cycle
$self->root_console(tty=>3); $self->root_console(tty => 3);
assert_script_run "dnf -y install GraphicsMagick", 300; assert_script_run "dnf -y install GraphicsMagick", 300;
assert_script_run "gm convert -size 1024x768 xc:black /usr/share/backgrounds/black.png"; assert_script_run "gm convert -size 1024x768 xc:black /usr/share/backgrounds/black.png";
assert_script_run 'for i in /usr/share/backgrounds/f*/default/*.png; do ln -sf /usr/share/backgrounds/black.png $i; done'; assert_script_run 'for i in /usr/share/backgrounds/f*/default/*.png; do ln -sf /usr/share/backgrounds/black.png $i; done';
@ -184,7 +184,7 @@ sub run {
# use solid blue background for SDDM # use solid blue background for SDDM
assert_script_run "sed -i -e 's,image,solid,g' /usr/share/sddm/themes/01-breeze-fedora/theme.conf.user"; assert_script_run "sed -i -e 's,image,solid,g' /usr/share/sddm/themes/01-breeze-fedora/theme.conf.user";
} }
adduser(name=>"Jack Sparrow", login=>"jack", password=>$jackpass); adduser(name => "Jack Sparrow", login => "jack", password => $jackpass);
if ($desktop eq "gnome") { if ($desktop eq "gnome") {
# suppress the Welcome Tour for new users in GNOME 40+ # suppress the Welcome Tour for new users in GNOME 40+
assert_script_run 'printf "[org.gnome.shell]\nwelcome-dialog-last-shown-version=\'4294967295\'\n" > /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override'; assert_script_run 'printf "[org.gnome.shell]\nwelcome-dialog-last-shown-version=\'4294967295\'\n" > /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override';
@ -195,12 +195,12 @@ sub run {
# In Gnome, we can create a passwordless user that can provide his password upon # In Gnome, we can create a passwordless user that can provide his password upon
# the first login. So we can create the second user in this way to test this feature # the first login. So we can create the second user in this way to test this feature
# later. # later.
adduser(name=>"Jim Eagle", login=>"jim", password=>"askuser"); adduser(name => "Jim Eagle", login => "jim", password => "askuser");
} }
else { else {
# In KDE, we can also create a passwordless user, but we cannot log into the system # In KDE, we can also create a passwordless user, but we cannot log into the system
# later, so we will create the second user the standard way. # later, so we will create the second user the standard way.
adduser(name=>"Jim Eagle", login=>"jim", password=>$jimpass); adduser(name => "Jim Eagle", login => "jim", password => $jimpass);
} }
# Clean boot the system, and note what accounts are listed on the login screen. # Clean boot the system, and note what accounts are listed on the login screen.
@ -210,7 +210,7 @@ sub run {
boot_to_login_screen; boot_to_login_screen;
# Log in with the first user account. # Log in with the first user account.
login_user(user=>"jack", password=>$jackpass); login_user(user => "jack", password => $jackpass);
check_user_logged_in("jack"); check_user_logged_in("jack");
# Log out the user. # Log out the user.
logout_user(); logout_user();
@ -218,31 +218,31 @@ sub run {
# Log in with the second user account. The second account, Jim Eagle, # Log in with the second user account. The second account, Jim Eagle,
if ($desktop eq "gnome") { if ($desktop eq "gnome") {
# If we are in Gnome, we will this time assign a password on first log-in. # If we are in Gnome, we will this time assign a password on first log-in.
login_user(user=>"jim", password=>$jimpass, method=>"create"); login_user(user => "jim", password => $jimpass, method => "create");
} }
else { else {
# If not, we are in KDE and we will log in normally. # If not, we are in KDE and we will log in normally.
login_user(user=>"jim", password=>$jimpass); login_user(user => "jim", password => $jimpass);
} }
check_user_logged_in("jim"); check_user_logged_in("jim");
# And this time reboot the system using the menu. # And this time reboot the system using the menu.
reboot_system(); reboot_system();
# Try to log in with either account, intentionally entering the wrong password. # Try to log in with either account, intentionally entering the wrong password.
login_user(user=>"jack", password=>"wrongpassword", checklogin=>0); login_user(user => "jack", password => "wrongpassword", checklogin => 0);
# get back to the login screen if necessary (dismiss an error message) # get back to the login screen if necessary (dismiss an error message)
send_key 'esc' unless (check_screen "login_jim"); send_key 'esc' unless (check_screen "login_jim");
# Now, log into the system again using the correct password. This will # Now, log into the system again using the correct password. This will
# only work if we were correctly denied login with the wrong password, # only work if we were correctly denied login with the wrong password,
# if we were let in with the wrong password it'll fail # if we were let in with the wrong password it'll fail
login_user(user=>"jim", password=>$jimpass); login_user(user => "jim", password => $jimpass);
check_user_logged_in("jim"); check_user_logged_in("jim");
# Lock the screen and unlock again. # Lock the screen and unlock again.
lock_screen(); lock_screen();
# Use the password to unlock the screen. # Use the password to unlock the screen.
login_user(user=>"jim", password=>$jimpass, method=>"unlock"); login_user(user => "jim", password => $jimpass, method => "unlock");
# Switch user tests # Switch user tests
if ($desktop eq "gnome") { if ($desktop eq "gnome") {
@ -257,7 +257,7 @@ sub run {
# Initiate switch user # Initiate switch user
switch_user(); switch_user();
# Now, we get a new login screen, so let's do the login into the new session. # Now, we get a new login screen, so let's do the login into the new session.
login_user(user=>"jack", password=>$jackpass); login_user(user => "jack", password => $jackpass);
# Check that it is a new session, the terminal window should not be visible. # Check that it is a new session, the terminal window should not be visible.
if (check_screen "user_confirm_jim") { if (check_screen "user_confirm_jim") {
die "The session was not switched!"; die "The session was not switched!";
@ -269,7 +269,7 @@ sub run {
logout_user(); logout_user();
# Now, let us log into the original session, this time, the terminal window # Now, let us log into the original session, this time, the terminal window
# should still be visible. # should still be visible.
login_user(user=>"jim", password=>$jimpass); login_user(user => "jim", password => $jimpass);
assert_screen "user_confirm_jim"; assert_screen "user_confirm_jim";
# We will also test another alternative - switching the user from # We will also test another alternative - switching the user from
@ -277,7 +277,7 @@ sub run {
lock_screen(); lock_screen();
send_key "ret"; send_key "ret";
switch_user(); switch_user();
login_user(user=>"jack", password=>$jackpass); login_user(user => "jack", password => $jackpass);
check_user_logged_in("jack"); check_user_logged_in("jack");
} }
# Power off the machine # Power off the machine
@ -285,7 +285,7 @@ sub run {
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return {fatal => 1};
} }
1; 1;

Some files were not shown because too many files have changed in this diff Show More