forked from os-autoinst/os-autoinst-distri-opensuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perl_bootloader.pm
61 lines (50 loc) · 1.86 KB
/
perl_bootloader.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP
# Package: perl-Bootloader
# Summary: Basic functional test for pbl package
# Maintainer: QE Core <qe-core@suse.de>
use base 'opensusebasetest';
use testapi;
use serial_terminal 'select_serial_terminal';
use strict;
use warnings;
use power_action_utils 'power_action';
use version_utils 'is_sle';
use package_utils qw(install_package);
sub run {
my ($self) = @_;
select_serial_terminal;
install_package 'in perl-Bootloader';
unless (!is_sle(">=15-SP3")) {
if (get_var('UEFI')) {
assert_script_run 'pbl --loader grub2-efi';
validate_script_output 'cat /etc/sysconfig/bootloader | grep "^LOADER_TYPE=\"grub2-efi\"$"', sub { m/^LOADER_TYPE="grub2-efi"$/ };
}
else {
assert_script_run 'pbl --loader grub2';
validate_script_output 'cat /etc/sysconfig/bootloader | grep "^LOADER_TYPE=\"grub2\"$"', sub { m/^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 | grep "TEST_OPTION"', sub { m/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', sub { m/pbl/ };
power_action('reboot', textmode => 1);
$self->wait_boot;
}
sub post_fail_hook {
upload_logs('/var/log/pbl.log');
}
1;