Re: [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable.
[notmuch-archives.git] / d2 / a42fdf996611478114642f3f746e5841002157
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 24AF8431FBD\r
6         for <notmuch@notmuchmail.org>; Fri, 30 May 2014 00:49:26 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id SYVjHv2s7Q5b for <notmuch@notmuchmail.org>;\r
16         Fri, 30 May 2014 00:49:22 -0700 (PDT)\r
17 Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com\r
18  [74.125.82.43])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  2BF91431FAE    for <notmuch@notmuchmail.org>; Fri, 30 May 2014 00:49:22 -0700\r
21  (PDT)\r
22 Received: by mail-wg0-f43.google.com with SMTP id l18so1527062wgh.2\r
23         for <notmuch@notmuchmail.org>; Fri, 30 May 2014 00:49:18 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=XMUovLQbEXj++N6n6UTvvxNso4KR+mRd3vb35PfjXVY=;\r
29         b=UzNTjHjObIFY4ikRCymFfuxSG08mZYv+Hom1rp7PS6KOkoaGsPYmBnPFhqnndGI4fR\r
30         MPp9oVmWtCBWNHoPd55UIWaOjWpGpHFeH7I8euVdK0CzTZVY79+70SJMsqJvS+N7ktjt\r
31         G7mTraKKH2iWJwJ3sNvVsGJ7e9sAE8AWKxdhWxM+d4I4JfWGp2ePCyzB0/0j1HUyfBKf\r
32         6ez3skZjRoJOTFpounojDE+3mKnj0/j7ctAURY0iuHVCn4VTIteEVPEhNqm80PHHvTi+\r
33         lLbQ/oFyVey/QDa/+PZiRCE8d95UIv80TZZDhp+8v+cnYcShQoUCOGjvY+b6HClRzgK+\r
34         cisQ==\r
35 X-Gm-Message-State:\r
36  ALoCoQkiCYHq8Q/onAsfWQrfUbSX0+0Hnf4BRGH7iJDWYpR370Uy/BtWvJSfLQbhpyamNiMc3oS3\r
37 X-Received: by 10.180.77.70 with SMTP id q6mr4142832wiw.28.1401436158587;\r
38         Fri, 30 May 2014 00:49:18 -0700 (PDT)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91])\r
41         by mx.google.com with ESMTPSA id k2sm8056404wjq.20.2014.05.30.00.49.17\r
42         for <multiple recipients>\r
43         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
44         Fri, 30 May 2014 00:49:17 -0700 (PDT)\r
45 From: Jani Nikula <jani@nikula.org>\r
46 To: Charles Celerier <cceleri@cs.stanford.edu>, notmuch@notmuchmail.org\r
47 Subject: Re: [PATCH v2 2/5] test: Made T010-help-test and T020-compact tests\r
48         more    portable.\r
49 In-Reply-To: <1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu>\r
50 References: <id:1399395748-44920-5-git-send-email-cceleri@cs.stanford.edu>\r
51         <1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu>\r
52 User-Agent: Notmuch/0.18+24~gfe8cd90 (http://notmuchmail.org) Emacs/24.3.1\r
53         (x86_64-pc-linux-gnu)\r
54 Date: Fri, 30 May 2014 10:49:16 +0300\r
55 Message-ID: <8761kn1zb7.fsf@nikula.org>\r
56 MIME-Version: 1.0\r
57 Content-Type: text/plain\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Fri, 30 May 2014 07:49:26 -0000\r
71 \r
72 On Sat, 10 May 2014, Charles Celerier <cceleri@cs.stanford.edu> wrote:\r
73 > The tests T010-help-test and T020-compact use the files have-man and\r
74 > have-compact, respectively, as indicators of how notmuch is configured.\r
75 > These were symbolic links to true and false for use in bash tests.\r
76 > Unfortunately, the paths to true and false may not be the same on all\r
77 > platforms (e.g. on Mac OS X they are in /usr/bin), so hard-coding\r
78 > symbolic links to /bin/true and /bin/false is not portable. This patch\r
79 > writes a 1 to have-man and have-compact to indicate true, and a 0 to\r
80 > indicate false, instead. The tests now read the contents of the file to\r
81 > determine the truth value instead of following the symbolic link.\r
82 \r
83 Please see [1] and [2] for what I think a better alternative.\r
84 \r
85 BR,\r
86 Jani.\r
87 \r
88 \r
89 [1] id:1401435785-2894-1-git-send-email-jani@nikula.org\r
90 [2] id:1401435785-2894-2-git-send-email-jani@nikula.org\r
91 \r
92 \r
93 \r
94 >\r
95 > Signed-off-by: Charles Celerier <cceleri@cs.stanford.edu>\r
96 > ---\r
97 >  test/Makefile.local    | 8 ++++----\r
98 >  test/T010-help-test.sh | 2 +-\r
99 >  test/T020-compact.sh   | 2 +-\r
100 >  3 files changed, 6 insertions(+), 6 deletions(-)\r
101 >\r
102 > diff --git a/test/Makefile.local b/test/Makefile.local\r
103 > index d622eaf..8fd333c 100644\r
104 > --- a/test/Makefile.local\r
105 > +++ b/test/Makefile.local\r
106 > @@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o\r
107 >  \r
108 >  $(dir)/have-compact: Makefile.config\r
109 >  ifeq ($(HAVE_XAPIAN_COMPACT),1)\r
110 > -     ln -sf /bin/true $@\r
111 > +     echo 1 > $@\r
112 >  else\r
113 > -     ln -sf /bin/false $@\r
114 > +     echo 0 > $@\r
115 >  endif\r
116 >  \r
117 >  $(dir)/have-man: Makefile.config\r
118 >  ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
119 > -     ln -sf /bin/false $@\r
120 > +     echo 0 > $@\r
121 >  else\r
122 > -     ln -sf /bin/true $@\r
123 > +     echo 1 > $@\r
124 >  endif\r
125 >  \r
126 >  .PHONY: test check\r
127 > diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh\r
128 > index 77410bc..02162ca 100755\r
129 > --- a/test/T010-help-test.sh\r
130 > +++ b/test/T010-help-test.sh\r
131 > @@ -7,7 +7,7 @@ test_expect_success 'notmuch --help' 'notmuch --help'\r
132 >  test_expect_success 'notmuch help' 'notmuch help'\r
133 >  test_expect_success 'notmuch --version' 'notmuch --version'\r
134 >  \r
135 > -if ${TEST_DIRECTORY}/have-man; then\r
136 > +if grep -q 1 ${TEST_DIRECTORY}/have-man ; then\r
137 >      test_expect_success 'notmuch --help tag' 'notmuch --help tag'\r
138 >      test_expect_success 'notmuch help tag' 'notmuch help tag'\r
139 >  else\r
140 > diff --git a/test/T020-compact.sh b/test/T020-compact.sh\r
141 > index 77bb963..0139584 100755\r
142 > --- a/test/T020-compact.sh\r
143 > +++ b/test/T020-compact.sh\r
144 > @@ -10,7 +10,7 @@ notmuch tag +tag1 \*\r
145 >  notmuch tag +tag2 subject:Two\r
146 >  notmuch tag -tag1 +tag3 subject:Three\r
147 >  \r
148 > -if ! ${TEST_DIRECTORY}/have-compact; then\r
149 > +if grep -q 0 ${TEST_DIRECTORY}/have-compact; then\r
150 >      test_begin_subtest "Compact unsupported: error message"\r
151 >      output=$(notmuch compact --quiet 2>&1)\r
152 >      test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support.\r
153 > -- \r
154 > 1.8.5.2 (Apple Git-48)\r
155 >\r
156 > _______________________________________________\r
157 > notmuch mailing list\r
158 > notmuch@notmuchmail.org\r
159 > http://notmuchmail.org/mailman/listinfo/notmuch\r