From 4e6695cb080b177a40941c8bd78095c4c0237181 Mon Sep 17 00:00:00 2001 From: guoxuguang Date: Mon, 27 Nov 2023 16:28:46 +0100 Subject: [PATCH] virt_autotest: enhancement for 15sp6 s390x kvm tests --- products/sle/main.pm | 6 +++-- tests/virt_autotest/guest_installation_run.pm | 13 +++++++++-- tests/virt_autotest/guest_upgrade_run.pm | 21 ++++++++--------- tests/virt_autotest/update_package.pm | 23 +++++++++---------- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/products/sle/main.pm b/products/sle/main.pm index fdeac206bfda..d542beef9b7c 100644 --- a/products/sle/main.pm +++ b/products/sle/main.pm @@ -863,8 +863,10 @@ elsif (get_var("VIRT_AUTOTEST")) { loadtest "virt_autotest/login_console"; loadtest "virt_autotest/install_package"; loadtest "virt_autotest/update_package"; - loadtest "virt_autotest/reset_partition"; - loadtest "virt_autotest/reboot_and_wait_up_normal" if (!get_var('AUTOYAST') && get_var('REPO_0_TO_INSTALL')); + # Skip reset_partition for s390x due to there just be 42Gib disk space for each s390x LPAR + loadtest "virt_autotest/reset_partition" if (!is_s390x); + # Skip reboot_and_wait_up_normal for s390x due to new changes from svirt backend for power_action_utils::power_action (see poo#151786) + loadtest "virt_autotest/reboot_and_wait_up_normal" if (!get_var('AUTOYAST') && get_var('REPO_0_TO_INSTALL') && (!is_s390x)); loadtest "virt_autotest/download_guest_assets" if get_var("SKIP_GUEST_INSTALL") && is_x86_64; } if (get_var("VIRT_PRJ1_GUEST_INSTALL")) { diff --git a/tests/virt_autotest/guest_installation_run.pm b/tests/virt_autotest/guest_installation_run.pm index 25519c37c97a..ee243ca73e52 100644 --- a/tests/virt_autotest/guest_installation_run.pm +++ b/tests/virt_autotest/guest_installation_run.pm @@ -1,6 +1,6 @@ # SUSE's openQA tests # -# Copyright 2012-2016 SUSE LLC +# Copyright 2012-2024 SUSE LLC # SPDX-License-Identifier: FSFAP # # Summary: guest_installation_run: This test is used to verify if different products can be installed successfully as guest on specify host. @@ -16,7 +16,9 @@ use virt_utils; sub get_script_run { my $pre_test_cmd = ""; if (is_s390x) { - $pre_test_cmd = "/usr/share/qa/tools/test_virtualization-virt_install_withopt-run"; + #Use pipefail to keep the correct returns from test_virtualization-virt_install_withopt-run + $pre_test_cmd = "set -o pipefail;"; + $pre_test_cmd .= "/usr/share/qa/tools/test_virtualization-virt_install_withopt-run"; } else { my $prd_version = script_output("cat /etc/issue"); @@ -33,6 +35,7 @@ sub get_script_run { my $parallel_num = get_var("PARALLEL_NUM", "2"); $pre_test_cmd = $pre_test_cmd . " -f " . $guest_pattern . " -n " . $parallel_num . " -r "; + $pre_test_cmd .= " 2>&1 | tee /tmp/s390x_guest_install_test.log" if (is_s390x); return $pre_test_cmd; } @@ -87,6 +90,12 @@ sub run { } $self->run_test(7600, "", "yes", "yes", "/var/log/qa/", "guest-installation-logs", $upload_guest_assets_flag); + #upload testing logs for s390x guest installation test + if (is_s390x) { + #upload s390x_guest_install_test.log + upload_asset("/tmp/s390x_guest_install_test.log", 1, 1); + lpar_cmd("rm -r /tmp/s390x_guest_install_test.log"); + } } 1; diff --git a/tests/virt_autotest/guest_upgrade_run.pm b/tests/virt_autotest/guest_upgrade_run.pm index 2f8ea79ac6ec..ba775de499bf 100644 --- a/tests/virt_autotest/guest_upgrade_run.pm +++ b/tests/virt_autotest/guest_upgrade_run.pm @@ -1,6 +1,6 @@ # SUSE's openQA tests # -# Copyright 2016 SUSE LLC +# Copyright 2016-2024 SUSE LLC # SPDX-License-Identifier: FSFAP # # Summary: This test verifies whether on host installed with specific product, the guests can successfully upgrade to the target upgrade product. @@ -44,6 +44,12 @@ sub get_script_run { my $guest_list = get_required_var("GUEST_LIST"); $pre_test_cmd = "$pre_test_cmd -p $product_upgrade -r $product_upgrade_repo -g \"$guest_list\""; + my $do_registration = check_var('GUEST_SCC_REGISTER', 'installation') ? "true" : "false"; + my $registration_server = get_var('SCC_URL', 'https://scc.suse.com'); + my $registration_code = get_var('SCC_REGCODE', 'INVALID_REGCODE'); + $pre_test_cmd .= " -e $do_registration"; + $pre_test_cmd .= " -s $registration_server"; + $pre_test_cmd .= " -c $registration_code"; if (is_s390x) { $pre_test_cmd .= " 2>&1 | tee /tmp/s390x_guest_upgrade_test.log"; } else { @@ -53,13 +59,6 @@ sub get_script_run { $pre_test_cmd .= " -k $vm_xml_dir"; } - my $do_registration = check_var('GUEST_SCC_REGISTER', 'installation') ? "true" : "false"; - my $registration_server = get_var('SCC_URL', 'https://scc.suse.com'); - my $registration_code = get_var('SCC_REGCODE', 'INVALID_REGCODE'); - $pre_test_cmd .= " -e $do_registration"; - $pre_test_cmd .= " -s $registration_server"; - $pre_test_cmd .= " -c $registration_code"; - return $pre_test_cmd; } @@ -140,8 +139,7 @@ sub run { if (is_s390x) { #upload s390x_guest_upgrade_test.log upload_asset("/tmp/s390x_guest_upgrade_test.log", 1, 1); - #ues die_on_timeout=> 0 as workaround for s390x test during call script_run, refer to poo#106765 - script_run "rm -rf /tmp/s390x_guest_upgrade_test.log", die_on_timeout => 0; + lpar_cmd("rm -rf /tmp/s390x_guest_upgrade_test.log"); } } @@ -154,8 +152,7 @@ sub post_fail_hook { if (is_s390x) { #upload s390x_guest_upgrade_test.log upload_asset("/tmp/s390x_guest_upgrade_test.log", 1, 1); - #ues die_on_timeout=> 0 as workaround for s390x test during call script_run, refer to poo#106765 - script_run "rm -rf /tmp/s390x_guest_upgrade_test.log", die_on_timeout => 0; + lpar_cmd("rm -rf /tmp/s390x_guest_upgrade_test.log"); } } diff --git a/tests/virt_autotest/update_package.pm b/tests/virt_autotest/update_package.pm index 6e695592436f..984e0286d17b 100644 --- a/tests/virt_autotest/update_package.pm +++ b/tests/virt_autotest/update_package.pm @@ -1,6 +1,6 @@ # SUSE's openQA tests # -# Copyright 2016 SUSE LLC +# Copyright 2016-2024 SUSE LLC # SPDX-License-Identifier: FSFAP # package update_package; @@ -49,12 +49,12 @@ sub run { my $self = shift; #workaroud: skip update package for registered aarch64 tests and because there are conflicts on sles15sp2 XEN $self->update_package() unless (!!get_var('AUTOYAST') || is_registered_sles && is_aarch64); - unless (!!get_var('AUTOYAST') || (is_registered_sles && is_aarch64) || is_s390x) { - set_grub_on_vh('', '', 'xen') if is_xen_host; - set_grub_on_vh('', '', 'kvm') if is_kvm_host; - } else { + if (!!get_var('AUTOYAST') || (is_registered_sles && is_aarch64)) { my @files_to_upload = ("/boot/grub2/grub.cfg", "/etc/default/grub"); upload_logs($_, failok => 1) foreach (@files_to_upload); + } elsif (!is_s390x) { + set_grub_on_vh('', '', 'xen') if is_xen_host; + set_grub_on_vh('', '', 'kvm') if is_kvm_host; } update_guest_configurations_with_daily_build(); @@ -64,16 +64,15 @@ sub run { #workaround of bsc#1177790 #disable DNSSEC validation as it is turned on by default but the forwarders donnot support it, refer to bsc#1177790 if (is_sle('>=12-sp5')) { - #ues die_on_timeout=> 0 as workaround for s390x test during call script_run, refer to poo#106765 - my %args = (); if (is_s390x) { - $args{die_on_timeout} = 0; + lpar_cmd("sed -i 's/#dnssec-validation auto;/dnssec-validation no;/g' /etc/named.conf"); + lpar_cmd("grep 'dnssec-validation' /etc/named.conf"); + lpar_cmd("systemctl restart named"); } else { - $args{die_on_timeout} = 1; + script_run "sed -i 's/#dnssec-validation auto;/dnssec-validation no;/g' /etc/named.conf"; + script_run "grep 'dnssec-validation' /etc/named.conf"; + script_run "systemctl restart named"; } - script_run "sed -i 's/#dnssec-validation auto;/dnssec-validation no;/g' /etc/named.conf", %args; - script_run "grep 'dnssec-validation' /etc/named.conf", %args; - script_run "systemctl restart named", %args; save_screenshot; }