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 24AF8431FBD for ; Fri, 30 May 2014 00:49:26 -0700 (PDT) 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 SYVjHv2s7Q5b for ; Fri, 30 May 2014 00:49:22 -0700 (PDT) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2BF91431FAE for ; Fri, 30 May 2014 00:49:22 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id l18so1527062wgh.2 for ; Fri, 30 May 2014 00:49:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=XMUovLQbEXj++N6n6UTvvxNso4KR+mRd3vb35PfjXVY=; b=UzNTjHjObIFY4ikRCymFfuxSG08mZYv+Hom1rp7PS6KOkoaGsPYmBnPFhqnndGI4fR MPp9oVmWtCBWNHoPd55UIWaOjWpGpHFeH7I8euVdK0CzTZVY79+70SJMsqJvS+N7ktjt G7mTraKKH2iWJwJ3sNvVsGJ7e9sAE8AWKxdhWxM+d4I4JfWGp2ePCyzB0/0j1HUyfBKf 6ez3skZjRoJOTFpounojDE+3mKnj0/j7ctAURY0iuHVCn4VTIteEVPEhNqm80PHHvTi+ lLbQ/oFyVey/QDa/+PZiRCE8d95UIv80TZZDhp+8v+cnYcShQoUCOGjvY+b6HClRzgK+ cisQ== X-Gm-Message-State: ALoCoQkiCYHq8Q/onAsfWQrfUbSX0+0Hnf4BRGH7iJDWYpR370Uy/BtWvJSfLQbhpyamNiMc3oS3 X-Received: by 10.180.77.70 with SMTP id q6mr4142832wiw.28.1401436158587; Fri, 30 May 2014 00:49:18 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id k2sm8056404wjq.20.2014.05.30.00.49.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 May 2014 00:49:17 -0700 (PDT) From: Jani Nikula To: Charles Celerier , notmuch@notmuchmail.org Subject: Re: [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable. In-Reply-To: <1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu> References: <1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu> User-Agent: Notmuch/0.18+24~gfe8cd90 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Fri, 30 May 2014 10:49:16 +0300 Message-ID: <8761kn1zb7.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain 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: Fri, 30 May 2014 07:49:26 -0000 On Sat, 10 May 2014, Charles Celerier wrote: > The tests T010-help-test and T020-compact use the files have-man and > have-compact, respectively, as indicators of how notmuch is configured. > These were symbolic links to true and false for use in bash tests. > Unfortunately, the paths to true and false may not be the same on all > platforms (e.g. on Mac OS X they are in /usr/bin), so hard-coding > symbolic links to /bin/true and /bin/false is not portable. This patch > writes a 1 to have-man and have-compact to indicate true, and a 0 to > indicate false, instead. The tests now read the contents of the file to > determine the truth value instead of following the symbolic link. Please see [1] and [2] for what I think a better alternative. BR, Jani. [1] id:1401435785-2894-1-git-send-email-jani@nikula.org [2] id:1401435785-2894-2-git-send-email-jani@nikula.org > > Signed-off-by: Charles Celerier > --- > test/Makefile.local | 8 ++++---- > test/T010-help-test.sh | 2 +- > test/T020-compact.sh | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/test/Makefile.local b/test/Makefile.local > index d622eaf..8fd333c 100644 > --- a/test/Makefile.local > +++ b/test/Makefile.local > @@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o > > $(dir)/have-compact: Makefile.config > ifeq ($(HAVE_XAPIAN_COMPACT),1) > - ln -sf /bin/true $@ > + echo 1 > $@ > else > - ln -sf /bin/false $@ > + echo 0 > $@ > endif > > $(dir)/have-man: Makefile.config > ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00) > - ln -sf /bin/false $@ > + echo 0 > $@ > else > - ln -sf /bin/true $@ > + echo 1 > $@ > endif > > .PHONY: test check > diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh > index 77410bc..02162ca 100755 > --- a/test/T010-help-test.sh > +++ b/test/T010-help-test.sh > @@ -7,7 +7,7 @@ test_expect_success 'notmuch --help' 'notmuch --help' > test_expect_success 'notmuch help' 'notmuch help' > test_expect_success 'notmuch --version' 'notmuch --version' > > -if ${TEST_DIRECTORY}/have-man; then > +if grep -q 1 ${TEST_DIRECTORY}/have-man ; then > test_expect_success 'notmuch --help tag' 'notmuch --help tag' > test_expect_success 'notmuch help tag' 'notmuch help tag' > else > diff --git a/test/T020-compact.sh b/test/T020-compact.sh > index 77bb963..0139584 100755 > --- a/test/T020-compact.sh > +++ b/test/T020-compact.sh > @@ -10,7 +10,7 @@ notmuch tag +tag1 \* > notmuch tag +tag2 subject:Two > notmuch tag -tag1 +tag3 subject:Three > > -if ! ${TEST_DIRECTORY}/have-compact; then > +if grep -q 0 ${TEST_DIRECTORY}/have-compact; then > test_begin_subtest "Compact unsupported: error message" > output=$(notmuch compact --quiet 2>&1) > test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support. > -- > 1.8.5.2 (Apple Git-48) > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch