From 092cc5dd05375a6b764f68a379c6d6dc4d823400 Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Thu, 26 Sep 2024 10:54:16 +0200 Subject: [PATCH] Move the content from i3 library to the files. Over the time, we have changed the test scripts so that the code in the i3.pm library was no more needed. The only leftover was the user config subroutine that could be moved to the only file that was using it and we could get rid of the library file. --- lib/fedoradistribution.pm | 1 - lib/i3.pm | 24 ------------------------ lib/utils.pm | 2 -- tests/desktop_login.pm | 1 - tests/desktop_notifications.pm | 13 ++++++++++++- tests/i3_tilling.pm | 2 -- 6 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 lib/i3.pm diff --git a/lib/fedoradistribution.pm b/lib/fedoradistribution.pm index 50921dde..92f35393 100644 --- a/lib/fedoradistribution.pm +++ b/lib/fedoradistribution.pm @@ -4,7 +4,6 @@ use strict; use base 'distribution'; use Cwd; -use i3; # Fedora distribution class diff --git a/lib/i3.pm b/lib/i3.pm deleted file mode 100644 index 2451281b..00000000 --- a/lib/i3.pm +++ /dev/null @@ -1,24 +0,0 @@ -package i3; - -use strict; - -use base 'Exporter'; -use Exporter; - -use testapi; -use utils; - -our @EXPORT = qw/create_user_i3_config/; - -sub create_user_i3_config { - my %args = @_; - my $login = $args{login}; - - assert_script_run("mkdir -p /home/$login/.config/i3/"); - # ensure that no alias of cp prevents an existing config from being overwritten - assert_script_run("/usr/bin/cp -f /etc/i3/config /home/$login/.config/i3/config"); - assert_script_run("sed -i '/i3-config-wizard/d' /home/$login/.config/i3/config"); - assert_script_run "chown -R $login:$login /home/$login/.config"; - assert_script_run "restorecon -vr /home/$login/.config"; -} - diff --git a/lib/utils.pm b/lib/utils.pm index 5c575140..9d22b6f2 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -4,8 +4,6 @@ use strict; use base 'Exporter'; use Exporter; -use i3; - use lockapi; use testapi qw(is_serial_terminal :DEFAULT); our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type setup_repos repo_setup get_workarounds disable_updates_repos cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop quit_firefox advisory_get_installed_packages acnp_handle_output advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log repos_mirrorlist register_application get_registered_applications solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround dm_perform_login/; diff --git a/tests/desktop_login.pm b/tests/desktop_login.pm index cbe0109e..672a8ab4 100644 --- a/tests/desktop_login.pm +++ b/tests/desktop_login.pm @@ -2,7 +2,6 @@ use base "installedtest"; use strict; use testapi; use utils; -use i3; our $desktop = get_var("DESKTOP"); our $syspwd = get_var("USER_PASSWORD") || "weakpassword"; diff --git a/tests/desktop_notifications.pm b/tests/desktop_notifications.pm index 9e423e0c..b5f597d2 100644 --- a/tests/desktop_notifications.pm +++ b/tests/desktop_notifications.pm @@ -3,7 +3,6 @@ use strict; use testapi; use utils; use packagetest; -use i3; # This test sort of covers QA:Testcase_desktop_update_notification # and QA:Testcase_desktop_error_checks . If it fails, probably *one* @@ -11,6 +10,18 @@ use i3; # tricky and involves likely-fragile needles to try and figure out # what notifications we have). +sub create_user_i3_config { + my %args = @_; + my $login = $args{login}; + + assert_script_run("mkdir -p /home/$login/.config/i3/"); + # ensure that no alias of cp prevents an existing config from being overwritten + assert_script_run("/usr/bin/cp -f /etc/i3/config /home/$login/.config/i3/config"); + assert_script_run("sed -i '/i3-config-wizard/d' /home/$login/.config/i3/config"); + assert_script_run "chown -R $login:$login /home/$login/.config"; + assert_script_run "restorecon -vr /home/$login/.config"; +} + sub run { my $self = shift; my $desktop = get_var("DESKTOP"); diff --git a/tests/i3_tilling.pm b/tests/i3_tilling.pm index fba5fe04..f854d92f 100644 --- a/tests/i3_tilling.pm +++ b/tests/i3_tilling.pm @@ -2,8 +2,6 @@ use base "installedtest"; use strict; use testapi; use utils; -use i3; - sub run { my $password = get_var('USER_PASSWORD', 'weakpassword');