From: Charles Celerier Date: Sat, 10 May 2014 15:53:44 +0000 (+2000) Subject: [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=56dd9e30c43a6507f86d985c3c9e9e97d42391b3;p=notmuch-archives.git [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable. --- diff --git a/b1/721309e250188175562186df669c5fe68ad233 b/b1/721309e250188175562186df669c5fe68ad233 new file mode 100644 index 000000000..335a72ad4 --- /dev/null +++ b/b1/721309e250188175562186df669c5fe68ad233 @@ -0,0 +1,121 @@ +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 2329E431FC0 + for ; Sat, 10 May 2014 08:53:58 -0700 (PDT) +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 JnvqomgQwVnH for ; + Sat, 10 May 2014 08:53:50 -0700 (PDT) +Received: from smtp1.cs.Stanford.EDU (smtp1.cs.Stanford.EDU [171.64.64.25]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 877BF431FBF + for ; Sat, 10 May 2014 08:53:50 -0700 (PDT) +Received: from c-24-11-133-78.hsd1.sc.comcast.net ([24.11.133.78] + helo=jane.lan) + by smtp1.cs.Stanford.EDU with esmtpsa (TLSv1:DHE-RSA-SEED-SHA:128) + (Exim 4.80.1) (envelope-from ) + id 1Wj9at-0006x1-Hi; Sat, 10 May 2014 08:53:48 -0700 +From: Charles Celerier +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more + portable. +Date: Sat, 10 May 2014 11:53:44 -0400 +Message-Id: <1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu> +X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) +In-Reply-To: +References: +X-Scan-Signature: 34530ccd932157cd24ba9d2c27818ca4 +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: Sat, 10 May 2014 15:53:58 -0000 + +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. + +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) +