Skip to content

Commit

Permalink
LTP/boot_ltp: Fix runtime failure on Micro
Browse files Browse the repository at this point in the history
rpm -qi /tmp/kernel-pkg.txt 2>&1 needs to be in trup_shell for valid rpm
packages, but also cannot be in trup shell, because then file is created
somewhere else. Therefore instead using trup shell use
'transactional-update -c run' (as was in the original proposal os-autoinst#19983).

This fixes error in boot_ltp
cat: /tmp/ver_linux_before.txt:

Also run ver_linux via 'transactional-update -c run' to get updated
packages version.

Fixes: 80bee23 ("LTP: Adapt record_info() output to Micro")
Fixes: https://progress.opensuse.org/issues/165731
Reported-by: Petr Cervinka <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Aug 23, 2024
1 parent 6cc1616 commit a18cc39
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/LTP/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use Utils::Architectures;
use repo_tools 'add_qa_head_repo';
use utils;
use kernel 'get_kernel_flavor';
use transactional;

our @EXPORT = qw(
check_kernel_taint
Expand Down Expand Up @@ -98,16 +97,14 @@ sub log_versions {
(is_rt ? 'kernel-rt' : get_kernel_flavor);
my $kernel_pkg_log = '/tmp/kernel-pkg.txt';
my $ver_linux_log = '/tmp/ver_linux_before.txt';

enter_trup_shell(global_options => '-c') if is_transactional;

my $kernel_config = script_output('for f in "/boot/config-$(uname -r)" "/usr/lib/modules/$(uname -r)/config" /proc/config.gz; do if [ -f "$f" ]; then echo "$f"; break; fi; done');
my $run_cmd = is_transactional ? 'transactional-update -c run ' : '';

script_run("rpm -qi $kernel_pkg > $kernel_pkg_log 2>&1");
script_run("$run_cmd rpm -qi $kernel_pkg > $kernel_pkg_log 2>&1");
upload_logs($kernel_pkg_log, failok => 1);

if (get_var('LTP_COMMAND_FILE') || get_var('LIBC_LIVEPATCH')) {
script_run(get_ltproot . "/ver_linux > $ver_linux_log 2>&1");
script_run("$run_cmd " . get_ltproot . "/ver_linux > $ver_linux_log 2>&1");
upload_logs($ver_linux_log, failok => 1);
}

Expand All @@ -133,17 +130,15 @@ sub log_versions {

record_info('KERNEL VERSION', script_output('uname -a'));
record_info('KERNEL DEFAULT PKG', script_output("cat $kernel_pkg_log", proceed_on_failure => 1));
record_info('KERNEL EXTRA PKG', script_output('rpm -qi kernel-default-extra', proceed_on_failure => 1));

record_info('KERNEL pkg', script_output('rpm -qa | grep kernel', proceed_on_failure => 1));
record_info('KERNEL EXTRA PKG', script_output("$run_cmd rpm -qi kernel-default-extra", proceed_on_failure => 1));
record_info('KERNEL pkg', script_output("$run_cmd rpm -qa | grep kernel", proceed_on_failure => 1));

if (get_var('LTP_COMMAND_FILE') || get_var('LIBC_LIVEPATCH')) {
record_info('ver_linux', script_output("cat $ver_linux_log", proceed_on_failure => 1));
}

script_run('env');
script_run('aa-enabled; aa-status');
exit_trup_shell if is_transactional;
}

sub export_ltp_env {
Expand Down

0 comments on commit a18cc39

Please sign in to comment.