From ddf6ba5a6bbe61b4b2b0a8fbb78693411e544749 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 8 Nov 2018 16:59:06 -0800 Subject: [PATCH] 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 --- tests/_advisory_post.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/_advisory_post.pm b/tests/_advisory_post.pm index 4aacebd5..39597a4b 100644 --- a/tests/_advisory_post.pm +++ b/tests/_advisory_post.pm @@ -11,8 +11,17 @@ sub run { 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 - assert_script_run 'comm -12 /tmp/allpkgs.txt /var/log/updatepkgs.txt > /var/log/testedpkgs.txt'; - upload_logs "/var/log/testedpkgs.txt"; + 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 {