[PATCH v2 1/3] t/gitweb-lib.sh: print to stderr when gitweb_run has errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change the gitweb_run test subroutine to spew errors to stderr if
there are any, previously it would just silently fail, which made
tests very hard to debug.

Before you'd get this output, when running tests under `--verbose
--immediate --debug`:

    expecting success: git rm renamed_file &&
             rm -f renamed_file &&
             git commit -a -m "File removed." &&
             gitweb_run "p=.git;a=commitdiff"
    rm 'renamed_file'
    [master 8d80741] File removed.
     Author: A U Thor <author@xxxxxxxxxxx>
     1 files changed, 0 insertions(+), 1 deletions(-)
     delete mode 120000 renamed_file
    not ok - 32 commitdiff(0): file deleted
    #       git rm renamed_file &&
    #                rm -f renamed_file &&
    #                git commit -a -m "File removed." &&
    #                gitweb_run "p=.git;a=commitdiff"

Now you'll get the much more useful:

    expecting success: git rm renamed_file &&
             rm -f renamed_file &&
             git commit -a -m "File removed." &&
             gitweb_run "p=.git;a=commitdiff"
    rm 'renamed_file'
    [master 2a4214e] File removed.
     Author: A U Thor <author@xxxxxxxxxxx>
     1 files changed, 0 insertions(+), 1 deletions(-)
     delete mode 120000 renamed_file
    [Sat Feb 19 14:32:54 2011] gitweb.perl: Use of uninitialized value in subroutine entry at /home/avar/g/git/t/../gitweb/gitweb.perl line 4415.
    not ok - 32 commitdiff(0): file deleted
    #       git rm renamed_file &&
    #                rm -f renamed_file &&
    #                git commit -a -m "File removed." &&
    #                gitweb_run "p=.git;a=commitdiff"
---
 t/gitweb-lib.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index b9bb95f..2388b0f 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -82,7 +82,12 @@ gitweb_run () {
 		}
 		close O;
 	' gitweb.output &&
-	if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
+	if grep '^[[]' gitweb.log >/dev/null 2>&1; then
+		cat gitweb.log >&2
+		false
+	else
+		true
+	fi
 
 	# gitweb.log is left for debugging
 	# gitweb.output is used to parse HTTP output
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]