diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 000000000000..cf0feeb83fea --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,9 @@ +[-Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval] + +[Perl::Critic::Policy::HashKeyQuotes] + +[Perl::Critic::Policy::ConsistentQuoteLikeWords] + +[Perl::Critic::Policy::ControlStructures::ProhibitDeepNests] +severity = 5 +max_nests = 5 diff --git a/Makefile b/Makefile index 3c1ac3026392..f29f1e5e9382 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ test-merge: FILES=$$(git diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD master 2>/dev/null` | grep 'tests.*pm') ;\ for file in $$FILES; do if test -f $$file; then \ tools/check_metadata $$file || touch failed; \ - git grep wait_idle $$file && touch failed; \ + git grep -q wait_idle $$file && touch failed; \ ${PERLCRITIC} $$file || (echo $$file ; touch failed) ;\ fi ; done; \ fi @@ -74,7 +74,7 @@ test-dry: .PHONY: test-no-wait_idle test-no-wait_idle: - @! git grep wait_idle lib/ tests/ + @! git grep -q wait_idle lib/ tests/ .PHONY: test-static test-static: tidy test-merge test-dry test-no-wait_idle test-unused-modules test-soft_failure-no-reference @@ -83,14 +83,14 @@ test-static: tidy test-merge test-dry test-no-wait_idle test-unused-modules test ifeq ($(TESTS),compile) test: test-compile else -test: unit-test test-static test-compile +test: unit-test test-static test-compile perlcritic endif -PERLCRITIC=PERL5LIB=tools/lib/perlcritic:$$PERL5LIB perlcritic --quiet --gentle --include Perl::Critic::Policy::HashKeyQuote --include Perl::Critic::Policy::ConsistentQuoteLikeWords +PERLCRITIC=PERL5LIB=tools/lib/perlcritic:$$PERL5LIB perlcritic --quiet --gentle .PHONY: perlcritic perlcritic: tools/lib/ - ${PERLCRITIC} . + ${PERLCRITIC} $$(git ls-files "*.p[ml]") .PHONY: test-unused-modules test-unused-modules: @@ -98,4 +98,4 @@ test-unused-modules: .PHONY: test-soft_failure-no-reference test-soft_failure-no-reference: - @! git grep -E -e 'soft_failure\>.*\;' --and --not -e '([$$0-9a-z]+#[$$0-9]+|fate.suse.com/[0-9]|\$$[a-z]+)' lib/ tests/ + @! git grep -q -E -e 'soft_failure\>.*\;' --and --not -e '([$$0-9a-z]+#[$$0-9]+|fate.suse.com/[0-9]|\$$[a-z]+)' lib/ tests/ diff --git a/lib/apachetest.pm b/lib/apachetest.pm index 0488c53cea06..3ee80a57310e 100644 --- a/lib/apachetest.pm +++ b/lib/apachetest.pm @@ -64,7 +64,7 @@ sub setup_apache2 { } # Create x509 certificate for this apache server if ($mode eq "SSL") { - my $gensslcert_C_opt = '-C $(hostname)' unless is_sle('15+'); + my $gensslcert_C_opt = !is_sle('15+') ? '-C $(hostname)' : ''; assert_script_run "gensslcert -n \$(hostname) $gensslcert_C_opt -e webmaster@\$(hostname)", 900; assert_script_run 'ls /etc/apache2/ssl.crt/$(hostname)-server.crt /etc/apache2/ssl.key/$(hostname)-server.key'; } diff --git a/lib/hacluster.pm b/lib/hacluster.pm index 70da63551cb3..3991bad8c769 100644 --- a/lib/hacluster.pm +++ b/lib/hacluster.pm @@ -214,7 +214,7 @@ sub ha_export_logs { my $corosync_conf = '/etc/corosync/corosync.conf'; my $hb_log = '/var/log/hb_report'; my $packages_list = '/tmp/packages.list'; - my $report_opt = '-f0' unless is_sle('12-sp4+'); + my $report_opt = !is_sle('12-sp4+') ? '-f0' : ''; my @y2logs; # Extract HA logs and upload them diff --git a/lib/ipmi_backend_utils.pm b/lib/ipmi_backend_utils.pm index b5791379a074..97e7e14aa77b 100644 --- a/lib/ipmi_backend_utils.pm +++ b/lib/ipmi_backend_utils.pm @@ -17,7 +17,7 @@ use Exporter; use strict; use warnings; use testapi; -use version_utils qw/is_storage_ng is_sle/; +use version_utils qw(is_storage_ng is_sle); use utils; use power_action_utils 'prepare_system_shutdown'; diff --git a/lib/kdump_utils.pm b/lib/kdump_utils.pm index b4568e41d003..7cc561d634c1 100644 --- a/lib/kdump_utils.pm +++ b/lib/kdump_utils.pm @@ -13,7 +13,7 @@ use Exporter; use strict; use testapi; use utils; -use List::Util qw(maxstr); +use List::Util 'maxstr'; use version_utils qw(is_sle is_jeos); our @EXPORT = qw(install_kernel_debuginfo prepare_for_kdump activate_kdump kdump_is_active do_kdump); diff --git a/lib/main_common.pm b/lib/main_common.pm index 009a56116451..df4d50d70c9f 100644 --- a/lib/main_common.pm +++ b/lib/main_common.pm @@ -260,10 +260,10 @@ sub get_ltp_tag { { local $@; - eval 'use main_ltp;'; + eval 'use main_ltp'; if ($@) { bmwqemu::fctwarn("Failed to load main_ltp.pm:\n$@", 'main_common.pm'); - eval q% + eval q%{ sub load_kernel_tests { if (is_kernel_test()) { @@ -331,7 +331,7 @@ sub is_desktop_module_selected { sub default_desktop { return 'textmode' if (get_var('SYSTEM_ROLE') && !check_var('SYSTEM_ROLE', 'default')); - return undef if get_var('VERSION', '') lt '12'; + return if get_var('VERSION', '') lt '12'; return 'gnome' if get_var('VERSION', '') lt '15'; # with SLE 15 LeanOS only the default is textmode return 'gnome' if get_var('BASE_VERSION', '') =~ /^12/; diff --git a/lib/main_ltp.pm b/lib/main_ltp.pm index 69d5b36b7380..659777b0bdf0 100644 --- a/lib/main_ltp.pm +++ b/lib/main_ltp.pm @@ -20,7 +20,7 @@ use Exporter; use testapi qw(check_var get_var); use autotest; use utils; -use LTP::TestInfo qw(testinfo); +use LTP::TestInfo 'testinfo'; use File::Basename 'basename'; use main_common qw(load_bootloader_s390x boot_hdd_image get_ltp_tag); use 5.018; @@ -40,7 +40,7 @@ sub shutdown_ltp { sub parse_openposix_runfile { my ($path, $cmd_pattern, $cmd_exclude, $test_result_export) = @_; - open(my $rfile, $path) or die "Can not open runfile asset $path: $!"; + open(my $rfile, $path) or die "Can not open runfile asset $path: $!"; ## no critic while (my $line = <$rfile>) { chomp($line); if ($line =~ m/$cmd_pattern/ && !($line =~ m/$cmd_exclude/)) { @@ -54,7 +54,7 @@ sub parse_openposix_runfile { sub parse_runtest_file { my ($path, $cmd_pattern, $cmd_exclude, $test_result_export) = @_; - open(my $rfile, $path) or die "Can not open runtest asset $path: $!"; + open(my $rfile, $path) or die "Can not open runtest asset $path: $!"; ## no critic while (my $line = <$rfile>) { next if ($line =~ /(^#)|(^$)/); diff --git a/lib/migration.pm b/lib/migration.pm index b0f93787ed9e..37643d29ee44 100644 --- a/lib/migration.pm +++ b/lib/migration.pm @@ -23,7 +23,7 @@ use strict; use testapi; use utils; use registration; -use qam qw/remove_test_repositories/; +use qam 'remove_test_repositories'; use version_utils qw(is_sle is_sles4sap); our @EXPORT = qw( diff --git a/lib/publiccloud/basetest.pm b/lib/publiccloud/basetest.pm index d24006439cb7..0c80642a5ff2 100644 --- a/lib/publiccloud/basetest.pm +++ b/lib/publiccloud/basetest.pm @@ -17,6 +17,7 @@ use testapi; use publiccloud::azure; use publiccloud::ec2; use publiccloud::gce; +use strict; sub provider_factory { my ($self) = @_; diff --git a/lib/registration.pm b/lib/registration.pm index 1caee383be52..5b7f1b9890fb 100644 --- a/lib/registration.pm +++ b/lib/registration.pm @@ -203,6 +203,179 @@ sub verify_preselected_modules { die 'Scroll reached to bottom not finding individual needles for each module.' if @needles; } +sub process_scc_register_addons { + # The value of SCC_ADDONS is a list of abbreviation of addons/modules + # Following are abbreviations defined for modules and some addons + # + # asmm - Advanced System Management Module + # certm - Certifications Module + # contm - Containers Module + # geo - Geo Clustering for SUSE Linux Enterprise High Availability + # ha - High Availability + # hpcm - HPC Module + # ids - IBM DLPAR sdk (ppc64le only) + # idu - IBM DLPAR Utils (ppc64le only) + # lgm - Legacy Module + # live - Live Patching + # ltss - Long Term Service Pack Support + # pcm - Public Cloud Module + # phub - PackageHub + # sdk - Software Development Kit + # ses - SUSE Enterprise Storage + # tcm - Toolchain Module + # tsm - Transactional Server Module + # we - Workstation + # wsm - Web and Scripting Module + if (get_var('SCC_ADDONS')) { + if (check_screen('scc-beta-filter-checkbox', 5)) { + if (get_var('SP3ORLATER')) { + send_key 'alt-i'; # uncheck 'Hide Beta Versions' + } + else { + send_key 'alt-f'; # uncheck 'Filter Out Beta Version' + } + assert_screen('scc-beta-filter-unchecked'); + } + my @scc_addons = split(/,/, get_var('SCC_ADDONS', '')); + # remove empty elements + @scc_addons = grep { $_ ne '' } @scc_addons; + + for my $addon (@scc_addons) { + if (check_var('VIDEOMODE', 'text') || check_var('SCC_REGISTER', 'console')) { + # The actions of selecting scc addons have been changed on SP2 or later in textmode + # For online migration, we have to do registration on pre-created HDD, set a flag + # to distinguish the sle version of HDD and perform addons selection based on it + if (get_var('ONLINE_MIGRATION') || get_var('PATCH')) { + select_addons_in_textmode($addon, get_var('HDD_SP2ORLATER')); + } + else { + select_addons_in_textmode($addon, get_var('SP2ORLATER')); + } + } + else { + # go to the top of the list before looking for the addon + send_key "home"; + # move the list of addons down until the current addon is found + if ($addon eq 'phub') { + # Record soft-failure when we do not have phub yet + my $bugref = + is_sle('=15-SP1') ? 'bsc#1106085' + : undef; + if ($bugref) { + record_soft_failure $bugref; + next; + } + } + send_key_until_needlematch ["scc-module-$addon", "scc-module-$addon-selected"], "down", ADDONS_COUNT; + if (match_has_tag("scc-module-$addon")) { + # checkmark the requested addon + assert_and_click "scc-module-$addon"; + } + else { + record_info("Module preselected", "Module $addon is already selected and installed by default"); + } + } + } + save_screenshot; + # go back and forward, checked checkboxes have to remember state poo#17840 + if (check_var('SCC_REGISTER', 'yast')) { + wait_screen_change { send_key 'alt-b' }; + assert_screen 'scc-registration-already-registered'; + wait_screen_change { send_key $cmd{next} }; + for my $addon (@scc_addons) { + send_key_until_needlematch "scc-module-$addon-selected", "down", ADDONS_COUNT; + } + } + wait_screen_change { send_key $cmd{next} }; # all addons selected + wait_still_screen 2; + # Process addons licenses + accept_addons_license @scc_addons; + # Press next only if entered reg code for any addon + if (register_addons @scc_addons) { + assert_screen 'ext-modules-reg-codes'; + send_key $cmd{next}; + wait_still_screen 2; + } + # start addons/modules registration, it needs longer time if select multiple or all addons/modules + my $counter = ADDONS_COUNT; + while ($counter--) { + die 'Addon registration repeated too much. Check if SCC is down.' if ($counter eq 1); + assert_screen [ + qw(import-untrusted-gpg-key yast_scc-pkgtoinstall yast-scc-emptypkg inst-addon contacting-registration-server refreshing-repository)]; + if (match_has_tag('import-untrusted-gpg-key')) { + handle_untrusted_gpg_key; + next; + } + elsif (match_has_tag('yast_scc-pkgtoinstall')) { + # yast shows the software install dialog + wait_screen_change { send_key 'alt-a' }; + while ( + # install packages take time if select many extensions and modules + assert_screen( + ['yast_scc-license-dialog', 'yast_scc-automatic-changes', 'yast_scc-prompt-reboot', 'yast_scc-installation-summary'], 1800 + )) + { + if (match_has_tag('yast_scc-license-dialog')) { + send_key 'alt-a'; + next; + } + # yast may pop up dependencies or reboot prompt window + if (match_has_tag('yast_scc-automatic-changes') or match_has_tag('unsupported-packages') or match_has_tag('yast_scc-prompt-reboot')) { + send_key 'alt-o'; + next; + } + if (match_has_tag('yast_scc-installation-summary')) { + send_key 'alt-f'; + last; + } + } + last; + } + # yast would display empty pkg install screen if no addon selected on sle12 sp0 + # set check_screen timeout longer to ensure the screen checked in this case + elsif (match_has_tag('yast-scc-emptypkg')) { + if (check_screen('yast-scc-emptypkg', 5)) { + send_key 'alt-a'; + last; # Exit yast scc register, no package need be install + } + else { + record_soft_failure 'bsc#1040758'; + next; # Yast may popup dependencies or software install dialog, enter determine statement again. + } + } + elsif (match_has_tag('contacting-registration-server')) { + sleep 5; + next; + } + elsif (match_has_tag('refreshing-repository')) { + sleep 5; + next; + } + elsif (match_has_tag('inst-addon')) { + # it would show Add On Product screen if scc registration correctly during installation + # it would show software install dialog if scc registration correctly by yast2 scc + last; + } + } + } + else { + send_key $cmd{next}; + if (check_var('HDDVERSION', '12')) { + assert_screen 'yast-scc-emptypkg'; + send_key 'alt-a'; + } + } +} + +sub process_scc_register { + if (check_var('SCC_REGISTER', 'installation') || check_var('SCC_REGISTER', 'yast') || check_var('SCC_REGISTER', 'console')) { + process_scc_register_addons; + } + elsif (!get_var('SCC_REGISTER', '') =~ /addon|network/) { + send_key $cmd{next}; + } +} + sub fill_in_registration_data { my ($addon, $uc_addon); fill_in_reg_server() if (!get_var("HDD_SCC_REGISTERED")); @@ -295,174 +468,7 @@ sub fill_in_registration_data { } } - if (check_var('SCC_REGISTER', 'installation') || check_var('SCC_REGISTER', 'yast') || check_var('SCC_REGISTER', 'console')) { - # The value of SCC_ADDONS is a list of abbreviation of addons/modules - # Following are abbreviations defined for modules and some addons - # - # asmm - Advanced System Management Module - # certm - Certifications Module - # contm - Containers Module - # geo - Geo Clustering for SUSE Linux Enterprise High Availability - # ha - High Availability - # hpcm - HPC Module - # ids - IBM DLPAR sdk (ppc64le only) - # idu - IBM DLPAR Utils (ppc64le only) - # lgm - Legacy Module - # live - Live Patching - # ltss - Long Term Service Pack Support - # pcm - Public Cloud Module - # phub - PackageHub - # sdk - Software Development Kit - # ses - SUSE Enterprise Storage - # tcm - Toolchain Module - # tsm - Transactional Server Module - # we - Workstation - # wsm - Web and Scripting Module - if (get_var('SCC_ADDONS')) { - if (check_screen('scc-beta-filter-checkbox', 5)) { - if (get_var('SP3ORLATER')) { - send_key 'alt-i'; # uncheck 'Hide Beta Versions' - } - else { - send_key 'alt-f'; # uncheck 'Filter Out Beta Version' - } - assert_screen('scc-beta-filter-unchecked'); - } - my @scc_addons = split(/,/, get_var('SCC_ADDONS', '')); - # remove empty elements - @scc_addons = grep { $_ ne '' } @scc_addons; - - for my $addon (@scc_addons) { - if (check_var('VIDEOMODE', 'text') || check_var('SCC_REGISTER', 'console')) { - # The actions of selecting scc addons have been changed on SP2 or later in textmode - # For online migration, we have to do registration on pre-created HDD, set a flag - # to distinguish the sle version of HDD and perform addons selection based on it - if (get_var('ONLINE_MIGRATION') || get_var('PATCH')) { - select_addons_in_textmode($addon, get_var('HDD_SP2ORLATER')); - } - else { - select_addons_in_textmode($addon, get_var('SP2ORLATER')); - } - } - else { - # go to the top of the list before looking for the addon - send_key "home"; - # move the list of addons down until the current addon is found - if ($addon eq 'phub') { - # Record soft-failure when we do not have phub yet - my $bugref = - is_sle('=15-SP1') ? 'bsc#1106085' - : undef; - if ($bugref) { - record_soft_failure $bugref; - next; - } - } - send_key_until_needlematch ["scc-module-$addon", "scc-module-$addon-selected"], "down", ADDONS_COUNT; - if (match_has_tag("scc-module-$addon")) { - # checkmark the requested addon - assert_and_click "scc-module-$addon"; - } - else { - record_info("Module preselected", "Module $addon is already selected and installed by default"); - } - } - } - save_screenshot; - # go back and forward, checked checkboxes have to remember state poo#17840 - if (check_var('SCC_REGISTER', 'yast')) { - wait_screen_change { send_key 'alt-b' }; - assert_screen 'scc-registration-already-registered'; - wait_screen_change { send_key $cmd{next} }; - for my $addon (@scc_addons) { - send_key_until_needlematch "scc-module-$addon-selected", "down", ADDONS_COUNT; - } - } - wait_screen_change { send_key $cmd{next} }; # all addons selected - wait_still_screen 2; - # Process addons licenses - accept_addons_license @scc_addons; - # Press next only if entered reg code for any addon - if (register_addons @scc_addons) { - assert_screen 'ext-modules-reg-codes'; - send_key $cmd{next}; - wait_still_screen 2; - } - # start addons/modules registration, it needs longer time if select multiple or all addons/modules - my $counter = ADDONS_COUNT; - while ($counter--) { - die 'Addon registration repeated too much. Check if SCC is down.' if ($counter eq 1); - assert_screen [ - qw(import-untrusted-gpg-key yast_scc-pkgtoinstall yast-scc-emptypkg inst-addon contacting-registration-server refreshing-repository)]; - if (match_has_tag('import-untrusted-gpg-key')) { - handle_untrusted_gpg_key; - next; - } - elsif (match_has_tag('yast_scc-pkgtoinstall')) { - # yast shows the software install dialog - wait_screen_change { send_key 'alt-a' }; - while ( - # install packages take time if select many extensions and modules - assert_screen( - ['yast_scc-license-dialog', 'yast_scc-automatic-changes', 'yast_scc-prompt-reboot', 'yast_scc-installation-summary'], 1800 - )) - { - if (match_has_tag('yast_scc-license-dialog')) { - send_key 'alt-a'; - next; - } - # yast may pop up dependencies or reboot prompt window - if (match_has_tag('yast_scc-automatic-changes') or match_has_tag('unsupported-packages') or match_has_tag('yast_scc-prompt-reboot')) { - send_key 'alt-o'; - next; - } - if (match_has_tag('yast_scc-installation-summary')) { - send_key 'alt-f'; - last; - } - } - last; - } - # yast would display empty pkg install screen if no addon selected on sle12 sp0 - # set check_screen timeout longer to ensure the screen checked in this case - elsif (match_has_tag('yast-scc-emptypkg')) { - if (check_screen('yast-scc-emptypkg', 5)) { - send_key 'alt-a'; - last; # Exit yast scc register, no package need be install - } - else { - record_soft_failure 'bsc#1040758'; - next; # Yast may popup dependencies or software install dialog, enter determine statement again. - } - } - elsif (match_has_tag('contacting-registration-server')) { - sleep 5; - next; - } - elsif (match_has_tag('refreshing-repository')) { - sleep 5; - next; - } - elsif (match_has_tag('inst-addon')) { - # it would show Add On Product screen if scc registration correctly during installation - # it would show software install dialog if scc registration correctly by yast2 scc - last; - } - } - } - else { - send_key $cmd{next}; - if (check_var('HDDVERSION', '12')) { - assert_screen 'yast-scc-emptypkg'; - send_key 'alt-a'; - } - } - } - else { - if (!get_var('SCC_REGISTER', '') =~ /addon|network/) { - send_key $cmd{next}; - } - } + process_scc_register; } sub select_addons_in_textmode { @@ -545,25 +551,25 @@ sub get_addon_fullname { # extensions product list my %product_list = ( - 'ha' => 'sle-ha', - 'geo' => 'sle-ha-geo', - 'we' => 'sle-we', - 'sdk' => is_sle('15+') ? 'sle-module-development-tools' : 'sle-sdk', - 'ses' => 'ses', - 'live' => is_sle('15+') ? 'sle-module-live-patching' : 'sle-live-patching', - 'asmm' => 'sle-module-adv-systems-management', - 'base' => 'sle-module-basesystem', - 'contm' => 'sle-module-containers', - 'desktop' => 'sle-module-desktop-applications', - 'hpcm' => 'sle-module-hpc', - 'legacy' => 'sle-module-legacy', - 'lgm' => 'sle-module-legacy', - 'ltss' => 'SLES-LTSS', - 'pcm' => 'sle-module-public-cloud', - 'script' => 'sle-module-web-scripting', - 'serverapp' => 'sle-module-server-applications', - 'tcm' => 'sle-module-toolchain', - 'wsm' => 'sle-module-web-scripting', + ha => 'sle-ha', + geo => 'sle-ha-geo', + we => 'sle-we', + sdk => is_sle('15+') ? 'sle-module-development-tools' : 'sle-sdk', + ses => 'ses', + live => is_sle('15+') ? 'sle-module-live-patching' : 'sle-live-patching', + asmm => 'sle-module-adv-systems-management', + base => 'sle-module-basesystem', + contm => 'sle-module-containers', + desktop => 'sle-module-desktop-applications', + hpcm => 'sle-module-hpc', + legacy => 'sle-module-legacy', + lgm => 'sle-module-legacy', + ltss => 'SLES-LTSS', + pcm => 'sle-module-public-cloud', + script => 'sle-module-web-scripting', + serverapp => 'sle-module-server-applications', + tcm => 'sle-module-toolchain', + wsm => 'sle-module-web-scripting', ); return $product_list{"$addon"}; } diff --git a/lib/repo_tools.pm b/lib/repo_tools.pm index ace6fd8c9452..216a69a61ca0 100644 --- a/lib/repo_tools.pm +++ b/lib/repo_tools.pm @@ -21,7 +21,7 @@ use testapi; use utils; use version_utils qw(is_sle is_leap is_tumbleweed); -our @EXPORT = qw (smt_wizard smt_mirror_repo rmt_wizard rmt_mirror_repo prepare_source_repo disable_source_repo get_repo_var_name prepare_oss_repo disable_oss_repo); +our @EXPORT = qw(smt_wizard smt_mirror_repo rmt_wizard rmt_mirror_repo prepare_source_repo disable_source_repo get_repo_var_name prepare_oss_repo disable_oss_repo); =head2 get_repo_var_name This takes something like "MODULE_BASESYSTEM_SOURCE" as parameter diff --git a/lib/selenium.pm b/lib/selenium.pm index 323aee748c4c..070187c1b2f9 100644 --- a/lib/selenium.pm +++ b/lib/selenium.pm @@ -35,7 +35,7 @@ use version_utils 'is_sle'; use Selenium::Remote::Driver; use Selenium::Chrome; -use Selenium::Waiter qw/wait_until/; +use Selenium::Waiter 'wait_until'; use Selenium::Remote::WDKeys; my $port = 4444; @@ -191,8 +191,8 @@ sub select_input { my ($id) = @_; $driver->mouse_move_to_location(element => wait_for_xpath("//input[\@id=\'$id\']")); $driver->click(); - $driver->send_keys_to_active_element(KEYS->{'control'}, 'a'); - $driver->send_keys_to_active_element(KEYS->{'control'}); + $driver->send_keys_to_active_element(KEYS->{control}, 'a'); + $driver->send_keys_to_active_element(KEYS->{control}); } 1; diff --git a/lib/suseconnect_register.pm b/lib/suseconnect_register.pm index 6e8bc6e6f059..ee007ce326c5 100644 --- a/lib/suseconnect_register.pm +++ b/lib/suseconnect_register.pm @@ -21,7 +21,7 @@ use utils; use registration; -our @EXPORT = qw (suseconnect_registration command_register is_module assert_module); +our @EXPORT = qw(suseconnect_registration command_register is_module assert_module); sub suseconnect_registration { my $product_version = get_required_var('VERSION'); @@ -52,9 +52,8 @@ sub command_register { my $reg_code = get_required_var("SCC_REGCODE"); $version =~ s/\-SP/./; script_run("(SUSEConnect -p SLES/$version/$arch --regcode $reg_code) | tee /dev/$serialdev", 0); - my $out = wait_serial($zypper_conflict, 240) if (get_var("ZDUP")); # zdup migration will have confilct - my $out = wait_serial($registered) if (!get_var("ZDUP")); # just register a bare system - + # zdup migration will have conflict or just register a bare system + my $out = get_var("ZDUP") ? wait_serial($zypper_conflict, 240) : wait_serial($registered); #resolve potential conflict by zypper if ($out =~ $zypper_conflict) { save_screenshot; diff --git a/lib/susedistribution.pm b/lib/susedistribution.pm index 62b79212f455..a54dea2840cd 100644 --- a/lib/susedistribution.pm +++ b/lib/susedistribution.pm @@ -288,7 +288,7 @@ sub ensure_installed { send_key("alt-f4"); # close xterm } -sub script_sudo($$) { +sub script_sudo { my ($self, $prog, $wait) = @_; my $str = time; diff --git a/lib/wickedbase.pm b/lib/wickedbase.pm index 9f9026236385..22314472aa6b 100644 --- a/lib/wickedbase.pm +++ b/lib/wickedbase.pm @@ -19,6 +19,7 @@ use lockapi; use testapi qw(is_serial_terminal :DEFAULT); use serial_terminal; use Carp; +use strict; =head2 wicked_command diff --git a/lib/y2logsstep.pm b/lib/y2logsstep.pm index 128b64b717bc..d8c938db1963 100644 --- a/lib/y2logsstep.pm +++ b/lib/y2logsstep.pm @@ -281,7 +281,7 @@ sub save_upload_y2logs { } sub get_available_compression { - my %extensions = ('bzip2' => '.bz2', 'gzip' => '.gz', 'xz' => '.xz'); + my %extensions = (bzip2 => '.bz2', gzip => '.gz', xz => '.xz'); foreach my $binary (sort keys %extensions) { return $extensions{$binary} unless script_run("type $binary"); } diff --git a/products/sle/main.pm b/products/sle/main.pm index e2000c59a7dd..7e15f30445d7 100644 --- a/products/sle/main.pm +++ b/products/sle/main.pm @@ -222,22 +222,22 @@ if (check_var('SCC_REGISTER', 'installation') && get_var('ALL_ADDONS') && !get_v my %common_modules = ('12-SP3' => 'pcm,tcm,wsm'); #Below $external* store external extensions/modules list on each ARCH. my %external_addons_12SP3 = ( - 'x86_64' => 'ha,geo,we,live,asmm,contm,lgm,hpcm', - 'ppc64le' => 'ha,live,asmm,contm,lgm', - 's390x' => 'ha,geo,asmm,contm,lgm', - 'aarch64' => 'hpcm' + 'x86_64' => 'ha,geo,we,live,asmm,contm,lgm,hpcm', + ppc64le => 'ha,live,asmm,contm,lgm', + s390x => 'ha,geo,asmm,contm,lgm', + aarch64 => 'hpcm' ); my %external_modules_12SP3 = ( - 'x86_64' => 'asmm,contm,lgm,hpcm', - 'ppc64le' => 'asmm,contm,lgm', - 's390x' => 'asmm,contm,lgm', - 'aarch64' => 'hpcm' + 'x86_64' => 'asmm,contm,lgm,hpcm', + ppc64le => 'asmm,contm,lgm', + s390x => 'asmm,contm,lgm', + aarch64 => 'hpcm' ); my %external_extensions_12SP3 = ( - 'x86_64' => 'ha,geo,we,live', - 'ppc64le' => 'ha,live', - 's390x' => 'ha,geo', - 'aarch64' => '' + 'x86_64' => 'ha,geo,we,live', + ppc64le => 'ha,live', + s390x => 'ha,geo', + aarch64 => '' ); # ALL_ADDONS = 'addons' : all addons, 'extensions' : all extensions, 'modules' : all modules. if (is_sle('12-SP3+')) { diff --git a/t/01_version_utils.t b/t/01_version_utils.t index e58d7c3945fb..7422fe8ea761 100644 --- a/t/01_version_utils.t +++ b/t/01_version_utils.t @@ -15,19 +15,19 @@ use testapi qw(check_var get_var set_var); subtest 'check_version' => sub { # compare versions if possible - ok version_utils::check_version($_, '15.5'), "check $_, 15.5" for qw[ >15.0 <15.10 ]; - ok !version_utils::check_version($_, '15.5'), "check $_, 15.5" for qw[ =15.50 >=15.10 ]; + ok version_utils::check_version($_, '15.5'), "check $_, 15.5" for qw(>15.0 <15.10); + ok !version_utils::check_version($_, '15.5'), "check $_, 15.5" for qw(=15.50 >=15.10); # compare strings if not - ok version_utils::check_version($_, 'klm'), "check $_, klm" for qw[ abc+ 1+ =KLM ]; + ok version_utils::check_version($_, 'klm'), "check $_, klm" for qw(abc+ 1+ =KLM); # die if regex does not match - for (qw[ 1.3+ 11-sp1+ ]) { + for (qw(1.3+ 11-sp1+)) { dies_ok { version_utils::check_version($_, '12-sp3', qr/^\d{2}/) } "check $_, 12-sp3, ^\\d{2}"; } # die if compare symbols are wrong - for (qw[ =1.3+ >1.3+ <>1.3 > 12 abc ]) { + for (qw(=1.3+ >1.3+ <>1.3 > 12 abc)) { dies_ok { version_utils::check_version($_, '12-sp3') } "check $_, 12-sp3"; } }; @@ -52,12 +52,12 @@ subtest 'is_leap' => sub { set_var('VERSION', '42.3'); ok is_leap, "check is_leap"; - ok is_leap($_), "check $_" for qw[ =42.3 <=15.0 >42.1 >=42.3 ]; - ok !is_leap($_), "check $_" for qw[ =15.0 >42.3 <42.3 <13.0 ]; - dies_ok { is_leap $_ } "check $_" for (qw[ 13+ <=15 =42 42+ 42.1:S:A+ =42.3:S:A ]); + ok is_leap($_), "check $_" for qw(=42.3 <=15.0 >42.1 >=42.3); + ok !is_leap($_), "check $_" for qw(=15.0 >42.3 <42.3 <13.0); + dies_ok { is_leap $_ } "check $_" for (qw(13+ <=15 =42 42+ 42.1:S:A+ =42.3:S:A)); set_var('VERSION', '42.3:S:A'); - ok is_leap($_), "check $_" for qw[ =42.3 <=15.0 ]; + ok is_leap($_), "check $_" for qw(=42.3 <=15.0); }; subtest 'is_sle' => sub { @@ -71,12 +71,12 @@ subtest 'is_sle' => sub { set_var('VERSION', '12'); ok is_sle, "check is_sle"; - ok is_sle($_), "check $_" for qw[ =12 >=12 <=12 12+ <12-sp1 <=15-sp2 <15 11+ >11 >=11 11-sp1+ ]; - ok !is_sle($_), "check $_" for qw[ >12 <12 >12-sp1 15-sp1+ >=15 <=11 <11-sp2 ]; - dies_ok { is_sle $_ } "check $_" for (qw[ 12 15- =12+ >1 1-sp1+ <15+ 15-sp1 ]); + ok is_sle($_), "check $_" for qw(=12 >=12 <=12 12+ <12-sp1 <=15-sp2 <15 11+ >11 >=11 11-sp1+); + ok !is_sle($_), "check $_" for qw(>12 <12 >12-sp1 15-sp1+ >=15 <=11 <11-sp2); + dies_ok { is_sle $_ } "check $_" for (qw(12 15- =12+ >1 1-sp1+ <15+ 15-sp1)); set_var('VERSION', '12-SP2'); - ok is_sle($_), "check $_" for qw[ =12-sp2 =12-sP2 <=15 >11-sp3 <12-sp3 >12-sp1 <12-SP3 >12-SP1]; + ok is_sle($_), "check $_" for qw(=12-sp2 =12-sP2 <=15 >11-sp3 <12-sp3 >12-sp1 <12-SP3 >12-SP1); }; done_testing;