From 2e7d4595e521114fa6b11974249db8722b04b72f Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 30 Nov 2017 16:40:38 -0500 Subject: [PATCH] Include verbose logs in build output for 'make test' failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building in koji or copr and a test fails, the verbose output from the tests can be very useful in determining the cause. Print the output from failing tests, borrowing heavily from the upstream code¹ used when running tests in Travis CI². This could be done inline in %check rather than in a separate script. The downside is that rpm would include each command invocation of the loop in the output, which adds a lot of useless text to the already copious build output. ¹ https://git.kernel.org/pub/scm/git/git.git/plain/ci/print-test-failures.sh ² https://travis-ci.org/git/git --- git.spec | 15 +++++++++++++-- print-failed-test-output | 11 +++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 print-failed-test-output diff --git a/git.spec b/git.spec index f5ff951..f072ebc 100644 --- a/git.spec +++ b/git.spec @@ -61,7 +61,7 @@ Name: git Version: 2.15.1 -Release: 2%{?rcrev}%{?dist} +Release: 3%{?rcrev}%{?dist} Summary: Fast Version Control System License: GPLv2 Group: Development/Tools @@ -88,6 +88,10 @@ Source13: git-gui.desktop Source14: gitweb.conf.in Source15: git@.service Source16: git.socket + +# Script to print test failure output (used in %%check) +Source99: print-failed-test-output + Patch0: git-1.8-gitweb-home-link.patch # https://bugzilla.redhat.com/490602 Patch1: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch @@ -389,6 +393,9 @@ rm -rf "$tar" "$gpghome" # Cleanup tar files and tmp gpg home dir %patch1 -p1 %patch2 -p1 +# Install print-failed-test-output script +install -p -m 755 %{SOURCE99} print-failed-test-output + # Remove git-archimport from command list sed -i '/^git-archimport/d' command-list.txt @@ -639,7 +646,8 @@ export LANG=en_US.UTF-8 export SVNSERVE_PORT=9000 # Run the tests -make %{?make_test_opts} test +GIT_TEST_OPTS='--verbose-log' make %{?make_test_opts} test || \ + ./print-failed-test-output %clean rm -rf %{buildroot} @@ -793,6 +801,9 @@ rm -rf %{buildroot} # No files for you! %changelog +* Thu Nov 30 2017 Todd Zullinger - 2.15.1-3 +- Include verbose logs in build output for 'make test' failures + * Wed Nov 29 2017 Todd Zullinger - 2.15.1-2 - Fix debuginfo for gnome-keyring and libsecret credential helpers diff --git a/print-failed-test-output b/print-failed-test-output new file mode 100644 index 0000000..f095b86 --- /dev/null +++ b/print-failed-test-output @@ -0,0 +1,11 @@ +#!/bin/sh + +# Print output from failing tests +dashes=$(printf "%80s" '' | tr ' ' '-') +for exit_file in t/test-results/*.exit; do + [ "$(cat "$exit_file")" -eq 0 ] && continue + out_file="${exit_file%exit}out" + printf '\n%s\n%s\n%s\n' "$dashes" "$out_file" "$dashes" + cat "$out_file" +done +exit 1