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 CD991429E27 for ; Tue, 13 Dec 2011 11:57:22 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 1UnhDM69u5ah for ; Tue, 13 Dec 2011 11:57:21 -0800 (PST) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id EB6D4429E26 for ; Tue, 13 Dec 2011 11:57:20 -0800 (PST) Received: from convex-new.cs.unb.ca ([131.202.13.154]) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id pBDJunAr029926; Tue, 13 Dec 2011 15:56:51 -0400 Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.72) (envelope-from ) id 1RaYT3-0008JG-A6; Tue, 13 Dec 2011 15:56:49 -0400 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] test: optionally print subtest number Date: Tue, 13 Dec 2011 15:56:47 -0400 Message-Id: <1323806207-31888-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.5.4 Cc: David Bremner 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: Tue, 13 Dec 2011 19:57:22 -0000 From: David Bremner The idea is that $test_count could be used in tests to label intermediate files. The output enabled by this patch (and --debug) helps figure out which OUTPUT.nn file belongs to which test in case several subtests write to OUTPUT.$test_count --- Is there something that depends on the test format? I find it pretty handy to have the subtest numbers, but I don't want to break some other tools. I followed the existing style of conditionally defining functions, but maybe someone with more bash-fu can improve that. test/test-lib.sh | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index 6be93fe..aaaaf5c 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -116,6 +116,16 @@ do esac done +if test -n "$debug"; then + print_subtest () { + printf "\t[%d]\t" $(($test_count - 1)) + } +else + print_subtest () { + true + } +fi + if test -n "$color"; then say_color () { ( @@ -132,6 +142,7 @@ if test -n "$color"; then printf " " printf "$@" tput sgr0 + print_subtest ) } else @@ -140,6 +151,7 @@ else shift printf " " printf "$@" + print_subtest } fi -- 1.7.5.4