[PATCH v3 part 3/3] test: implement and document NOTMUCH_TEST_QUIET variable usage
authorTomi Ollila <tomi.ollila@iki.fi>
Thu, 5 Dec 2013 12:46:00 +0000 (14:46 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:38 +0000 (09:58 -0800)
32/49446c621ccf9cfb86013173e8b8cd7a9f0626 [new file with mode: 0644]

diff --git a/32/49446c621ccf9cfb86013173e8b8cd7a9f0626 b/32/49446c621ccf9cfb86013173e8b8cd7a9f0626
new file mode 100644 (file)
index 0000000..8e10134
--- /dev/null
@@ -0,0 +1,149 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id F27F2431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Dec 2013 04:46:18 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 8bzz4As-IuXL for <notmuch@notmuchmail.org>;\r
+       Thu,  5 Dec 2013 04:46:14 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 74EB5431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Dec 2013 04:46:14 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id D24E01001E5; Thu,  5 Dec 2013 14:46:02 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 part 3/3] test: implement and document NOTMUCH_TEST_QUIET\r
+       variable usage\r
+Date: Thu,  5 Dec 2013 14:46:00 +0200\r
+Message-Id: <1386247560-31903-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1385399299-12936-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1385399299-12936-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 05 Dec 2013 12:46:19 -0000\r
+\r
+When NOTMUCH_TEST_QUIET environment variable is set to non-null value\r
+messages when new test script starts and when test PASSes are disabled.\r
+This eases picking the cases when tests FAIL (as those are still printed).\r
+---\r
+\r
+Diffdiff of part 3 to previous.\r
+\r
+| diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+| index 9d4a807..d8e0d91 100644\r
+| --- a/test/test-lib.sh\r
+| +++ b/test/test-lib.sh\r
+| @@ -733,9 +733,7 @@ test_failure_ () {\r
+|              return\r
+|      fi\r
+|      test_failure=$(($test_failure + 1))\r
+| -    if test -n "$NOTMUCH_TEST_QUIET"; then\r
+| -            print_test_description\r
+| -    fi\r
+| +    print_test_description\r
+|      test_failure_message_ "FAIL" "$test_subtest_name" "$@"\r
+|      test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }\r
+|      return 1\r
+\r
+\r
+ test/README      | 8 ++++++++\r
+ test/basic       | 4 ++--\r
+ test/test-lib.sh | 9 ++++++++-\r
+ 3 files changed, 18 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/test/README b/test/README\r
+index d12cff2..79a9b1b 100644\r
+--- a/test/README\r
++++ b/test/README\r
+@@ -76,6 +76,14 @@ the tests in one of the following ways.\r
+       TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs\r
+       make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient\r
\r
++Quiet Execution\r
++---------------\r
++\r
++Normally, when new script starts and when test PASSes you get a message\r
++printed on screen. This printing can be disabled by setting the\r
++NOTMUCH_TEST_QUIET variable to a non-null value. Message on test\r
++failures and skips are still printed.\r
++\r
+ Skipping Tests\r
+ --------------\r
+ If, for any reason, you need to skip one or more tests, you can do so\r
+diff --git a/test/basic b/test/basic\r
+index 64eb7d7..f7eed32 100755\r
+--- a/test/basic\r
++++ b/test/basic\r
+@@ -74,12 +74,12 @@ suppress_diff_date() {\r
+ }\r
\r
+ test_begin_subtest "Ensure that test output is suppressed unless the test fails"\r
+-output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date)\r
++output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose 2>&1 | suppress_diff_date)\r
+ expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)\r
+ test_expect_equal "$output" "$expected"\r
\r
+ test_begin_subtest "Ensure that -v does not suppress test output"\r
+-output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date)\r
++output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose -v 2>&1 | suppress_diff_date)\r
+ expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)\r
+ # Do not include the results of test-verbose in totals\r
+ rm $TEST_DIRECTORY/test-results/test-verbose\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 34e0db6..d8e0d91 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -198,7 +198,10 @@ print_test_description ()\r
+       echo $this_test: "Testing ${test_description}"\r
+       test_description_printed=1\r
+ }\r
+-print_test_description\r
++if [ -z "$NOTMUCH_TEST_QUIET" ]\r
++then\r
++      print_test_description\r
++fi\r
\r
+ exec 5>&1\r
\r
+@@ -717,6 +720,9 @@ test_ok_ () {\r
+               return\r
+       fi\r
+       test_success=$(($test_success + 1))\r
++      if test -n "$NOTMUCH_TEST_QUIET"; then\r
++              return 0\r
++      fi\r
+       say_color pass "%-6s" "PASS"\r
+       echo " $test_subtest_name"\r
+ }\r
+@@ -727,6 +733,7 @@ test_failure_ () {\r
+               return\r
+       fi\r
+       test_failure=$(($test_failure + 1))\r
++      print_test_description\r
+       test_failure_message_ "FAIL" "$test_subtest_name" "$@"\r
+       test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }\r
+       return 1\r
+-- \r
+1.8.0\r
+\r