test: suppress diff for broken test without V=1
authorJani Nikula <jani@nikula.org>
Sun, 26 Feb 2017 17:36:50 +0000 (19:36 +0200)
committerDavid Bremner <david@tethera.net>
Thu, 9 Mar 2017 12:48:08 +0000 (08:48 -0400)
Known broken tests are, well, known broken. Do not print the result
diff for them unless V=1 is specified. Now that the test description
is printed also when known broken tests fail, the user can also skip
to running the individual failing tests.

test/Makefile.local
test/test-lib.sh

index f8cf90d07e2dc5c1acd59ad13531800a783eb7a5..4680597292cf5bdb7bb8f593769842e8f12f66b7 100644 (file)
@@ -61,7 +61,7 @@ test-binaries: $(TEST_BINARIES)
 
 test:  all test-binaries
 ifeq ($V,)
 
 test:  all test-binaries
 ifeq ($V,)
-       @echo 'Use "$(MAKE) V=1" to print test headings and PASSing results.'
+       @echo 'Use "$(MAKE) V=1" to see the details for passing and known broken tests.'
        @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
 else
 # The user has explicitly enabled quiet execution.
        @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
 else
 # The user has explicitly enabled quiet execution.
index 79dc8419950c5db76d8310bc0f0d5b22ce7c341a..98203b9bc1655bd016e0f1a52ad490ed4f9deffb 100644 (file)
@@ -866,7 +866,9 @@ test_failure_message_ () {
        say_color error "%-6s" "$1"
        echo " $2"
        shift 2
        say_color error "%-6s" "$1"
        echo " $2"
        shift 2
-       echo "$@" | sed -e 's/^/        /'
+       if [ "$#" != "0" ]; then
+               echo "$@" | sed -e 's/^/        /'
+       fi
        if test "$verbose" != "t"; then cat test.output; fi
 }
 
        if test "$verbose" != "t"; then cat test.output; fi
 }
 
@@ -880,7 +882,11 @@ test_known_broken_ok_ () {
 test_known_broken_failure_ () {
        test_reset_state_
        test_broken=$(($test_broken+1))
 test_known_broken_failure_ () {
        test_reset_state_
        test_broken=$(($test_broken+1))
-       test_failure_message_ "BROKEN" "$test_subtest_name" "$@"
+       if [ -z "$NOTMUCH_TEST_QUIET" ]; then
+               test_failure_message_ "BROKEN" "$test_subtest_name" "$@"
+       else
+               test_failure_message_ "BROKEN" "$test_subtest_name"
+       fi
        return 1
 }
 
        return 1
 }