mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-11-18 19:21:28 +00:00
ddf6ba5a6b
Weirdly, occasionally some update tests seem to fail because the 'comm' util we use to produce the list of packages from the update that were actually tested during the job doesn't think one of the input files is in alphabetical order, even though we sort them both when they're produced. I don't know if this is possibly due to the definition of 'alphabetical order' changing as part of the update, or what. But we really shouldn't *fail* the test when this happens, as it's not part of the functional test, we're just producing convenience data. So, let's handle the command failing, and if it happens, upload the input files so we can maybe figure out why it's unhappy... Signed-off-by: Adam Williamson <awilliam@redhat.com>
34 lines
1.0 KiB
Perl
34 lines
1.0 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
# figure out which packages from the update actually got installed
|
|
# (if any) as part of this test
|
|
$self->root_console(tty=>3);
|
|
assert_script_run 'rpm -qa --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -u > /tmp/allpkgs.txt';
|
|
# this finds lines which appear in both files
|
|
# http://www.unix.com/unix-for-dummies-questions-and-answers/34549-find-matching-lines-between-2-files.html
|
|
if (script_run 'comm -12 /tmp/allpkgs.txt /var/log/updatepkgs.txt > /var/log/testedpkgs.txt') {
|
|
# occasionally, for some reason, it's unhappy about sorting;
|
|
# we shouldn't fail the test in this case, just upload the
|
|
# files so we can see why...
|
|
upload_logs "/tmp/allpkgs.txt", failok=>1;
|
|
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
|
}
|
|
else {
|
|
# here, it worked.
|
|
upload_logs "/var/log/testedpkgs.txt";
|
|
}
|
|
}
|
|
|
|
sub test_flags {
|
|
return { fatal => 1 };
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|