Skip to content

Commit

Permalink
Merge pull request #19337 from rfan1/patch_before_upgrade
Browse files Browse the repository at this point in the history
Patch the system for leap upgrade tests
  • Loading branch information
rfan1 authored May 27, 2024
2 parents cc77123 + 6b66d79 commit 96120d1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/opensusebasetest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ When bootloader appears, make sure to boot from local disk when it is on aarch64
sub wait_grub_to_boot_on_local_disk {
# assuming the cursor is on 'installation' by default and 'boot from
# harddisk' is above
send_key_until_needlematch 'inst-bootmenu-boot-harddisk', 'up';
my $switch_key = (is_opensuse && get_var('LIVECD')) ? 'down' : 'up';
send_key_until_needlematch 'inst-bootmenu-boot-harddisk', "$switch_key";
boot_local_disk;
my @tags = qw(grub2 tianocore-mainmenu);
push @tags, 'encrypted-disk-password-prompt' if (get_var('ENCRYPT'));
Expand Down
2 changes: 1 addition & 1 deletion lib/power_action_utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ sub power_action {
# We should only reset consoles if the system really rebooted.
# Otherwise the next select_console will check for a login prompt
# instead of handling the still logged in system.
handle_livecd_reboot_failure if get_var('LIVECD') && $action eq 'reboot';
handle_livecd_reboot_failure if get_var('LIVECD') && !get_var('PATCH_BEFORE_MIGRATION') && $action eq 'reboot';
# Look aside before we are sure 'sut' console on VMware is ready, see poo#47150
select_console('svirt') if is_vmware && $action eq 'reboot' && !get_var('UEFI');
reset_consoles;
Expand Down
2 changes: 1 addition & 1 deletion lib/susedistribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ sub handle_password_prompt {
my ($console) = @_;
$console //= '';

return if (get_var("LIVETEST") || get_var('LIVECD')) && (get_var('VERSION') !~ /agama/);
return if (get_var("LIVETEST") || (get_var('LIVECD') && !get_var('PATCH_BEFORE_MIGRATION'))) && (get_var('VERSION') !~ /agama/);
if (is_serial_terminal()) {
wait_serial(qr/Password:\s*$/i, timeout => 30);
} else {
Expand Down
19 changes: 18 additions & 1 deletion products/opensuse/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use warnings;
use testapi qw(check_var get_var get_required_var set_var);
use lockapi;
use needle;
use version_utils ':VERSION';
use version_utils qw(:VERSION is_upgrade);
use File::Find;
use File::Basename;
use DistributionProvider;
Expand Down Expand Up @@ -332,6 +332,11 @@ elsif (get_var('XFSTESTS')) {
}
else {
if (get_var("LIVETEST") || get_var('LIVE_INSTALLATION') || get_var('LIVE_UPGRADE')) {
if (get_var('PATCH_BEFORE_MIGRATION')) {
boot_hdd_image;
loadtest 'migration/patch_and_reboot_system';
loadtest 'migration/reboot_to_upgrade';
}
load_boot_tests();
loadtest "installation/finish_desktop";
loadtest "installation/opensuse_welcome" if opensuse_welcome_applicable;
Expand All @@ -348,10 +353,22 @@ else {
load_reboot_tests();
}
elsif (installzdupstep_is_applicable()) {
if (is_upgrade && get_var('PATCH_BEFORE_MIGRATION')) {
boot_hdd_image;
loadtest 'migration/patch_and_reboot_system';
loadtest 'migration/reboot_to_upgrade';
}
load_zdup_tests();
}
elsif (get_var("BOOT_HDD_IMAGE")) {
boot_hdd_image;
if (is_upgrade && get_var('PATCH_BEFORE_MIGRATION')) {
loadtest 'migration/patch_and_reboot_system';
loadtest 'migration/reboot_to_upgrade';
load_boot_tests();
load_inst_tests();
load_reboot_tests();
}
if (get_var("ISCSI_SERVER")) {
set_var('INSTALLONLY', 1);
loadtest "iscsi/iscsi_server";
Expand Down
7 changes: 7 additions & 0 deletions tests/migration/reboot_to_upgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ sub run {
if (get_var('UPGRADE') || get_var('AUTOUPGRADE')) {
set_var('BOOT_HDD_IMAGE', 0) unless (is_aarch64 && !check_var('ZDUP', '1'));
}
if (get_var('LIVE_UPGRADE') && get_var('PATCH_BEFORE_MIGRATION')) {
record_info 'Switch to live upgrade process';
set_var('BOOT_HDD_IMAGE', 0);
}
assert_script_run "sync", 300;
power_action('reboot', textmode => 1, keepconsole => 1);

Expand All @@ -49,6 +53,9 @@ sub run {
# for x86_64 we need to make sure the start item is installation for needle matching.
stop_grub_timeout if is_x86_64;
save_screenshot;

# Switch back to live upgrade process
set_var('PATCH_BEFORE_MIGRATION', 0) if (get_var('LIVE_UPGRADE') && get_var('PATCH_BEFORE_MIGRATION'));
}

1;
Expand Down
2 changes: 1 addition & 1 deletion tests/update/updates_packagekit_kde.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sub run {
}
}
# Close tray updater
send_key("alt-f4");
send_key_until_needlematch('generic-desktop', 'alt-f4', 3, 5);
}

if (check_screen "updates_installed-restart") {
Expand Down
1 change: 1 addition & 0 deletions variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ KEEP_ONLINE_REPOS | boolean | false | openSUSE specific variable, not to replace
KEEP_PERSISTENT_NET_RULES | boolean | false | Keep udev rules 70-persistent-net.rules, which are deleted on backends with image support (qemu, svirt) by default.
LAPTOP |||
LIBC_LIVEPATCH | boolean | false | If set, run userspace livepatching tests
PATCH_BEFORE_MIGRATION | boolean | false | If set, patch the system before migration/upgrade
LINUX_BOOT_IPV6_DISABLE | boolean | false | If set, boots linux kernel with option named "ipv6.disable=1" which disables IPv6 from startup.
LINUXRC_KEXEC | integer | | linuxrc has the capability to download and run a new kernel and initrd pair from the repository.<br> There are four settings for the kexec option:<br> 0: feature disabled;<br> 1: always restart with kernel/initrd from repository (without bothering to check if it's necessary);<br>2: restart only if needed - that is, if linuxrc detects that the booted initrd is outdated (this is the default);<br>3: like kexec=2 but without user interaction.<br> *More details [here](https://en.opensuse.org/SDB:Linuxrc)*.
LIVECD | boolean | false | Indicates live image being used.
Expand Down

0 comments on commit 96120d1

Please sign in to comment.