Skip to content

Commit

Permalink
Merge pull request #21038 from pevik/GRUB_PARAM-fix-trailing-semicolon
Browse files Browse the repository at this point in the history
Workaround for failing add_custom_grub_entries (install_ltp) on SLE Micro
  • Loading branch information
pevik authored Jan 28, 2025
2 parents 2a68a31 + ba23167 commit 5196225
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ And of course the new entries have C<ima_policy=tcb> added to kernel parameters.
=cut

sub add_custom_grub_entries {
my @grub_params = split(/\s*;\s*/, trim(get_var('GRUB_PARAM', '')));
# grep: ignore empty items (helps to avoid trailing semicolon)
my @grub_params = grep { /\S/ } split(/\s*;\s*/, trim(get_var('GRUB_PARAM', '')));

bmwqemu::fctinfo("Number of GRUB_PARAM params (empty skipped): " . $#grub_params);

return unless $#grub_params >= 0;

my $script_old = "/etc/grub.d/10_linux";
Expand Down Expand Up @@ -149,6 +153,7 @@ sub add_custom_grub_entries {
foreach my $grub_param (@grub_params) {
$i++;
my $script_new = "/etc/grub.d/${i}_linux_openqa";
bmwqemu::fctinfo("Processing script '$script_new'");
my $script_new_esc = $script_new =~ s~/~\\/~rg;
assert_script_run("cp -v $script_old $script_new");

Expand Down
19 changes: 13 additions & 6 deletions lib/main_ltp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,22 @@ sub load_kernel_tests {
if (get_var('FLAVOR', '') =~ /Incidents-Kernel/) {
loadtest_kernel 'update_kernel';
}
if (is_transactional && (get_var('FLAVOR', '') =~ /-Staging|-Updates/)) {
if (get_var('KGRAFT')) {
loadtest_kernel 'update_kernel';
} else {
loadtest 'transactional/install_updates';
}

# transactional needs to first run install_ltp due broken grub menu
# counting detection in add_custom_grub_entries():
# Test died: Unexpected number of grub entries: 5, expected: 3 at lib/bootloader_setup.pm line 166.
my $needs_update = is_transactional && (get_var('FLAVOR', '') =~ /-Staging|-Updates/);

if ($needs_update && get_var('KGRAFT')) {
loadtest_kernel 'update_kernel';
}

loadtest_kernel 'install_ltp';

if ($needs_update && !get_var('KGRAFT')) {
loadtest 'transactional/install_updates';
}

if (get_var('LIBC_LIVEPATCH')) {
die 'LTP_COMMAND_FILE and LIBC_LIVEPATCH are mutually exclusive'
if get_var('LTP_COMMAND_FILE');
Expand Down

0 comments on commit 5196225

Please sign in to comment.