From 35d80d03e8effef3c74d79ff3b1d0adfa18186be Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 5 Dec 2013 11:18:49 +1900 Subject: [PATCH] Re: [PATCH 3/3] test: implement and document NOTMUCH_TEST_QUIET variable usage --- 1a/625e39519662911405c4dfa22113da2ec0c34b | 204 ++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 1a/625e39519662911405c4dfa22113da2ec0c34b diff --git a/1a/625e39519662911405c4dfa22113da2ec0c34b b/1a/625e39519662911405c4dfa22113da2ec0c34b new file mode 100644 index 000000000..4da2a3cf8 --- /dev/null +++ b/1a/625e39519662911405c4dfa22113da2ec0c34b @@ -0,0 +1,204 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 491E2431FC4 + for ; Wed, 4 Dec 2013 08:19:06 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id UgQ5SofP4Zj8 for ; + Wed, 4 Dec 2013 08:18:58 -0800 (PST) +Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu + [18.9.25.13]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 41ED9431FC2 + for ; Wed, 4 Dec 2013 08:18:58 -0800 (PST) +X-AuditID: 1209190d-b7ef66d000000c40-6c-529f55ee8d92 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id 03.BC.03136.EE55F925; Wed, 4 Dec 2013 11:18:54 -0500 (EST) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id rB4GIrsb008045; + Wed, 4 Dec 2013 11:18:53 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rB4GIom7001226 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Wed, 4 Dec 2013 11:18:52 -0500 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1VoFA2-0000WV-7x; Wed, 04 Dec 2013 11:18:50 -0500 +From: Austin Clements +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 3/3] test: implement and document NOTMUCH_TEST_QUIET + variable usage +In-Reply-To: <1385399299-12936-3-git-send-email-tomi.ollila@iki.fi> +References: <1384288868-23903-1-git-send-email-tomi.ollila@iki.fi> + <1385399299-12936-1-git-send-email-tomi.ollila@iki.fi> + <1385399299-12936-3-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.16+154~g96c0ce2 (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Wed, 04 Dec 2013 11:18:49 -0500 +Message-ID: <87vbz437yu.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsUixG6nrvsudH6QwfVP5hbXb85ktnizch6r + A5PH4a8LWTyerbrFHMAUxWWTkpqTWZZapG+XwJXxesdGxoKjShXP555namBskuli5OSQEDCR + 6LlzgB3CFpO4cG89WxcjF4eQwGwmiYlT+6CcDYwS3Wt+M0M4p5gk3i+7wAThLGGUaNrymBmk + n01AQ2Lb/uWMILaIgK3ElSUnWbsYOTiYgea2zwsBCQsLhEss7TvOCBLmFHCWmPZcGG7BkW87 + mUBqRAXiJaYt3Ak2kkVAVWL99gcsIPW8QKf+2K4CEuYVEJQ4OfMJC4jNLKAlcePfS6YJjIKz + kKRmIUktYGRaxSibklulm5uYmVOcmqxbnJyYl5dapGukl5tZopeaUrqJERSonJK8OxjfHVQ6 + xCjAwajEw5vAOS9IiDWxrLgy9xCjJAeTkiivYPD8ICG+pPyUyozE4oz4otKc1OJDjBIczEoi + vJMDgXK8KYmVValF+TApaQ4WJXHemxz2QUIC6YklqdmpqQWpRTBZGQ4OJQneXyFAjYJFqemp + FWmZOSUIaSYOTpDhPEDDZUNBhhcXJOYWZ6ZD5E8xKkqJ8x4GaRYASWSU5sH1whLJK0ZxoFeE + ed+DVPEAkxBc9yugwUxAg5sfzAMZXJKIkJJqYOS5v6N94d75X/dNerTCuHVZ6LbiGde/F6/h + dPkXI9BW7KCW+tg0V04n9vLtjpTJWitjjzXu59mygyvxxuTJC9ta9X6yqzTcO/16YcqWPKY+ + m2f/7oS0XT3960YR592afb/txA6WnvERjZ7YEHjlSOlLs1lf8hU2N9ae5Q/Mv7ra9+KKYr1M + iZlKLMUZiYZazEXFiQDVWxqj/wIAAA== +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 04 Dec 2013 16:19:06 -0000 + +I just tried to use this and realized it hadn't been pushed yet. + +This series LGTM except one minor nit below and the fact that it +introduces a lot of tab-indented code in sections of test-lib.sh that +appear to be space-indented. Given that test-lib.sh is already a mess +of indentation styles, I don't know if we care, but it would be nice if +its entropy were at least non-increasing. + +On Mon, 25 Nov 2013, Tomi Ollila wrote: +> When NOTMUCH_TEST_QUIET environment variable is set to non-null value +> messages when new test script starts and when test PASSes are disabled. +> This eases picking the cases when tests FAIL (as those are still printed). +> --- +> test/README | 8 ++++++++ +> test/basic | 4 ++-- +> test/test-lib.sh | 11 ++++++++++- +> 3 files changed, 20 insertions(+), 3 deletions(-) +> +> diff --git a/test/README b/test/README +> index d12cff2..79a9b1b 100644 +> --- a/test/README +> +++ b/test/README +> @@ -74,10 +74,18 @@ the tests in one of the following ways. +> +> TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient make test +> TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs +> make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient +> +> +Quiet Execution +> +--------------- +> + +> +Normally, when new script starts and when test PASSes you get a message +> +printed on screen. This printing can be disabled by setting the +> +NOTMUCH_TEST_QUIET variable to a non-null value. Message on test +> +failures and skips are still printed. +> + +> Skipping Tests +> -------------- +> If, for any reason, you need to skip one or more tests, you can do so +> by setting the NOTMUCH_SKIP_TESTS variable to the name of one or more +> sections of tests. +> diff --git a/test/basic b/test/basic +> index 64eb7d7..f7eed32 100755 +> --- a/test/basic +> +++ b/test/basic +> @@ -72,16 +72,16 @@ suppress_diff_date() { +> sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \ +> -e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/' +> } +> +> test_begin_subtest "Ensure that test output is suppressed unless the test fails" +> -output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date) +> +output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose 2>&1 | suppress_diff_date) +> expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date) +> test_expect_equal "$output" "$expected" +> +> test_begin_subtest "Ensure that -v does not suppress test output" +> -output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date) +> +output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose -v 2>&1 | suppress_diff_date) +> expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date) +> # Do not include the results of test-verbose in totals +> rm $TEST_DIRECTORY/test-results/test-verbose +> rm -r $TEST_DIRECTORY/tmp.test-verbose +> test_expect_equal "$output" "$expected" +> diff --git a/test/test-lib.sh b/test/test-lib.sh +> index 34e0db6..9d4a807 100644 +> --- a/test/test-lib.sh +> +++ b/test/test-lib.sh +> @@ -196,11 +196,14 @@ print_test_description () +> test -z "$test_description_printed" || return 0 +> echo +> echo $this_test: "Testing ${test_description}" +> test_description_printed=1 +> } +> -print_test_description +> +if [ -z "$NOTMUCH_TEST_QUIET" ] +> +then +> + print_test_description +> +fi +> +> exec 5>&1 +> +> test_failure=0 +> test_count=0 +> @@ -715,20 +718,26 @@ test_ok_ () { +> if test "$test_subtest_known_broken_" = "t"; then +> test_known_broken_ok_ +> return +> fi +> test_success=$(($test_success + 1)) +> + if test -n "$NOTMUCH_TEST_QUIET"; then +> + return 0 +> + fi +> say_color pass "%-6s" "PASS" +> echo " $test_subtest_name" +> } +> +> test_failure_ () { +> if test "$test_subtest_known_broken_" = "t"; then +> test_known_broken_failure_ "$@" +> return +> fi +> test_failure=$(($test_failure + 1)) +> + if test -n "$NOTMUCH_TEST_QUIET"; then + +Strictly speaking, this test isn't necessary, right? + +> + print_test_description +> + fi +> test_failure_message_ "FAIL" "$test_subtest_name" "$@" +> test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } +> return 1 +> } +> +> -- +> 1.8.4.2 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2