Skip to content

Commit

Permalink
Update perl-bootloader test
Browse files Browse the repository at this point in the history
  • Loading branch information
cedvid committed Jan 23, 2024
1 parent 7135bb8 commit eb1a7fa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
1 change: 1 addition & 0 deletions lib/main_common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,7 @@ sub load_extra_tests_console {
loadtest 'console/wpa_supplicant' unless (!is_x86_64 || is_sle('<15') || is_leap('<15.1') || is_jeos || is_public_cloud);
loadtest 'console/python_scientific' unless (is_sle("<15"));
loadtest "console/parsec" if is_tumbleweed;
loadtest "console/perl_bootloader" unless get_var('PUBLIC_CLOUD');
}

sub load_extra_tests_sdk {
Expand Down
11 changes: 11 additions & 0 deletions schedule/qam/common/mau-bootloader.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: mau-bootloader
description: >
perl-bootloader test
https://progress.opensuse.org/issues/139091
schedule:
- installation/bootloader_start
- boot/boot_to_desktop
- console/system_prepare
- console/consoletest_setup
- console/perl_bootloader
47 changes: 37 additions & 10 deletions tests/console/perl_bootloader.pm
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# SUSE's openQA tests
#
# Copyright 2019 SUSE LLC
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Package: perl-Bootloader dracut
# Summary: Test the perl-Bootloader package by generating the initrd,
# calling update-bootloader and rebooting the host
# Maintainer: Paolo Stivanin <pstivanin@suse.com>
# Package: perl-Bootloader
# Summary: Basic functional test for pbl package
# Maintainer: QE Core <qe-core@suse.de>

use base 'opensusebasetest';
use testapi;
Expand All @@ -15,7 +14,7 @@ use strict;
use warnings;
use utils 'zypper_call';
use power_action_utils 'power_action';
use version_utils 'is_sle';
use version_utils qw(is_sle is_opensuse);

sub run {
my ($self) = @_;
Expand All @@ -24,15 +23,43 @@ sub run {
if (script_run 'rpm -q perl-Bootloader' == 1) {
zypper_call 'in perl-Bootloader';
}
assert_script_run 'mkinitrd';
assert_script_run 'update-bootloader';

if (is_sle('>=12-SP2')) {
validate_script_output('pbl --show', sub { /grub2/ });
# pbl --loader is not available on <15-SP3
if (is_sle(">=15-SP3") || is_opensuse) {
if (get_var('UEFI')) {
assert_script_run 'pbl --loader grub2-efi';
validate_script_output 'cat /etc/sysconfig/bootloader', qr/LOADER_TYPE="grub2-efi"/;
}
else {
assert_script_run 'pbl --loader grub2';
validate_script_output 'cat /etc/sysconfig/bootloader', qr/LOADER_TYPE="grub2"/;
}
}
assert_script_run 'pbl --install';
assert_script_run 'pbl --config';
power_action('reboot', textmode => 1);
$self->wait_boot;
select_serial_terminal;

# Add new option and check if it exists
assert_script_run 'pbl --add-option TEST_OPTION="test_value"';
validate_script_output 'cat /etc/default/grub', qr/test_value/;

# Delete option and check if it was deleted
assert_script_run 'pbl --del-option "TEST_OPTION"';
assert_script_run('! grep -q "TEST_OPTION" /etc/default/grub');

# Create new log file and check if it exists and contains pbl log
assert_script_run 'pbl --log /var/log/pbl-test.log';
validate_script_output 'cat /var/log/pbl-test.log', qr/pbl/;

power_action('reboot', textmode => 1);
$self->wait_boot;

}

sub post_fail_hook {
upload_logs('/var/log/pbl.log');
}

1;

0 comments on commit eb1a7fa

Please sign in to comment.