From ba90ef631a5ee73e03e7ed82ed599192fe11c44c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 27 Apr 2016 09:36:28 -0700 Subject: [PATCH] fix installedtest post-fail hook when no /var/tmp/abrt Summary: you can't use validate_script_output like this, it doesn't just return a bool, it actually kills the test if the output doesn't validate. So any time we didn't have anything in /var/tmp/abrt, the post_fail_hook would die at that point and not upload the contents of /var/log as we wanted it to. Note that even script_output will kill the test if the return code is >0. That's OK in this case, but always be careful with these subroutines. Test Plan: Run a test that fails in post-install but doesn't produce anything in /var/tmp/abrt (you may have to artificially break something). Check that it now uploads /var/log. I noticed this while working on FreeIPA tests... Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D830 --- lib/installedtest.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/installedtest.pm b/lib/installedtest.pm index 1ecaabc5..1280302f 100644 --- a/lib/installedtest.pm +++ b/lib/installedtest.pm @@ -25,7 +25,8 @@ sub post_fail_hook { $self->root_console(tty=>2); # If /var/tmp/abrt directory isn't empty (ls doesn't return empty string) - if (validate_script_output "ls /var/tmp/abrt", sub { $_ ne '' }) { + my $vartmp = script_output "ls /var/tmp/abrt"; + if ($vartmp ne '') { # Upload all ABRT logs script_run "cd /var/tmp/abrt && tar czvf abrt.tar.gz *"; upload_logs "/var/tmp/abrt/abrt.tar.gz";