update tests: don't fail if comm is unhappy about the alphabet

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>
This commit is contained in:
Adam Williamson 2018-11-08 16:59:06 -08:00
parent b999ee93fe
commit ddf6ba5a6b

View File

@ -11,8 +11,17 @@ sub run {
assert_script_run 'rpm -qa --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -u > /tmp/allpkgs.txt'; 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 # 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 # http://www.unix.com/unix-for-dummies-questions-and-answers/34549-find-matching-lines-between-2-files.html
assert_script_run 'comm -12 /tmp/allpkgs.txt /var/log/updatepkgs.txt > /var/log/testedpkgs.txt'; if (script_run 'comm -12 /tmp/allpkgs.txt /var/log/updatepkgs.txt > /var/log/testedpkgs.txt') {
upload_logs "/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 { sub test_flags {