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 A93F7429E28 for ; Tue, 13 Dec 2011 12:16:25 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, 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 JIoohAjUwry8 for ; Tue, 13 Dec 2011 12:16:25 -0800 (PST) Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D9690429E27 for ; Tue, 13 Dec 2011 12:16:24 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so10224497wgb.2 for ; Tue, 13 Dec 2011 12:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=hePDVQWUqi68yIKqA1tdrwSrDRwrdP1jAe97itCZyNI=; b=k5fGPRn5XW9sj9xdYjqVLXYhhCMAfOSXdDYlFPQZVduMRqRX/QtQKDXKg4dNrBuP1W lrbbP8IRLWgkQpCEkG9t+NTpuO7J0oPmeuqOQOPbHvXOLWOxdA1tU/Zmhy8I796/+2sx 7KIap2AHVv0BTjX4wbPcVmxAukijNHsf8cwXQ= Received: by 10.180.92.68 with SMTP id ck4mr14413986wib.27.1323807382039; Tue, 13 Dec 2011 12:16:22 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id eg7sm242495wib.8.2011.12.13.12.16.19 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 12:16:20 -0800 (PST) From: Dmitry Kurochkin To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] test: optionally print subtest number In-Reply-To: <1323806207-31888-1-git-send-email-david@tethera.net> References: <1323806207-31888-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.10.2+96~g74e5ae5 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Wed, 14 Dec 2011 00:15:43 +0400 Message-ID: <87ty54ut1s.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 20:16:25 -0000 On Tue, 13 Dec 2011 15:56:47 -0400, David Bremner wrote: > 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. > Looks good to me. Except for tabs taking too much space. Perhaps the following would be better? printf "%-4s" "[$(($test_count - 1))]" Regards, Dmitry > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch