Re: Bug?: notmuch-search-show-thread shows several threads; only one containing match...
[notmuch-archives.git] / cd / de6323417d7aa06b67005378d53411134a294a
1 Return-Path: <sojkam1@fel.cvut.cz>\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 B76B6418C25\r
6         for <notmuch@notmuchmail.org>; Wed,  9 Jun 2010 23:48:50 -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: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9] autolearn=ham\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 44G3za31DQta for <notmuch@notmuchmail.org>;\r
16         Wed,  9 Jun 2010 23:48:35 -0700 (PDT)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 59F2F4196F0\r
19         for <notmuch@notmuchmail.org>; Wed,  9 Jun 2010 23:48:35 -0700 (PDT)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id A48C119F33D8;\r
22         Thu, 10 Jun 2010 08:48:34 +0200 (CEST)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id kKrIc4EXjRKi; Thu, 10 Jun 2010 08:48:33 +0200 (CEST)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id 7D81A19F35E2;\r
30         Thu, 10 Jun 2010 08:48:32 +0200 (CEST)\r
31 Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])\r
32         (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id 743DE15C062;\r
34         Thu, 10 Jun 2010 08:48:32 +0200 (CEST)\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.72)\r
36         (envelope-from <sojkam1@fel.cvut.cz>)\r
37         id 1OMbZ2-0000Jb-65; Thu, 10 Jun 2010 08:48:32 +0200\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v3 3/5] test: Update helper functions\r
41 Date: Thu, 10 Jun 2010 08:48:02 +0200\r
42 Message-Id: <1276152484-1164-4-git-send-email-sojkam1@fel.cvut.cz>\r
43 X-Mailer: git-send-email 1.7.1.3.g75e44\r
44 In-Reply-To: <1276152484-1164-1-git-send-email-sojkam1@fel.cvut.cz>\r
45 References: <1276152484-1164-1-git-send-email-sojkam1@fel.cvut.cz>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 10 Jun 2010 06:48:52 -0000\r
59 \r
60 Modify the helper functions to work with git-based test suite i.e.\r
61 1) Quote arguments where it is necessary.\r
62 2) Do not use $NOTMUCH. It is equal to "notmuch" since $PATH is set to\r
63    the build tree.\r
64 3) Modify pass_if_equal to fit into the git-based test suite.\r
65 \r
66 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
67 ---\r
68  test/test-lib.sh |   33 +++++++++++++--------------------\r
69  1 files changed, 13 insertions(+), 20 deletions(-)\r
70 \r
71 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
72 index 7684c2e..d045820 100644\r
73 --- a/test/test-lib.sh\r
74 +++ b/test/test-lib.sh\r
75 @@ -221,10 +221,10 @@ remove_cr () {\r
76  increment_mtime_amount=0\r
77  increment_mtime ()\r
78  {\r
79 -    dir=$1\r
80 +    dir="$1"\r
81  \r
82      increment_mtime_amount=$((increment_mtime_amount + 1))\r
83 -    touch -d "+${increment_mtime_amount} seconds" $dir\r
84 +    touch -d "+${increment_mtime_amount} seconds" "$dir"\r
85  }\r
86  \r
87  # Generate a new message in the mail directory, with a unique message\r
88 @@ -291,7 +291,7 @@ generate_message ()\r
89         gen_msg_filename="${MAIL_DIR}/$gen_msg_name"\r
90      else\r
91         gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"\r
92 -       mkdir -p $(dirname $gen_msg_filename)\r
93 +       mkdir -p "$(dirname "$gen_msg_filename")"\r
94      fi\r
95  \r
96      if [ -z "${template[body]}" ]; then\r
97 @@ -346,7 +346,7 @@ ${additional_headers}"\r
98      fi\r
99  \r
100  \r
101 -cat <<EOF >$gen_msg_filename\r
102 +cat <<EOF >"$gen_msg_filename"\r
103  From: ${template[from]}\r
104  To: ${template[to]}\r
105  Message-Id: <${gen_msg_id}>\r
106 @@ -357,7 +357,7 @@ ${template[body]}\r
107  EOF\r
108  \r
109      # Ensure that the mtime of the containing directory is updated\r
110 -    increment_mtime $(dirname ${gen_msg_filename})\r
111 +    increment_mtime "$(dirname "${gen_msg_filename}")"\r
112  }\r
113  \r
114  # Generate a new message and add it to the index.\r
115 @@ -366,41 +366,34 @@ EOF\r
116  # are also supported here, so see that function for details.\r
117  add_message ()\r
118  {\r
119 -    generate_message "$@"\r
120 -\r
121 -    $NOTMUCH new > /dev/null\r
122 +    generate_message "$@" &&\r
123 +    notmuch new > /dev/null\r
124  }\r
125  \r
126 -tests=0\r
127 -test_failures=0\r
128 -\r
129  pass_if_equal ()\r
130  {\r
131      output=$1\r
132      expected=$2\r
133  \r
134 -    tests=$((tests + 1))\r
135 -\r
136      if [ "$output" = "$expected" ]; then\r
137 -       echo "  PASS"\r
138 +       true\r
139      else\r
140 -       echo "  FAIL"\r
141 -       testname=test-$(printf "%03d" $tests)\r
142 +       testname=$this_test.$test_count\r
143         echo "$expected" > $testname.expected\r
144         echo "$output" > $testname.output\r
145 -       diff -u $testname.expected $testname.output || true\r
146 -       test_failures=$((test_failures + 1))\r
147 +       diff -u $testname.expected $testname.output\r
148 +       false\r
149      fi\r
150  }\r
151  \r
152  TEST_DIR=$(pwd)/test.$$\r
153  MAIL_DIR=${TEST_DIR}/mail\r
154  export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config\r
155 -NOTMUCH=$(find_notmuch_binary $(pwd))\r
156 +NOTMUCH=notmuch\r
157  \r
158  NOTMUCH_NEW ()\r
159  {\r
160 -    $NOTMUCH new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
161 +    notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'\r
162  }\r
163  \r
164  notmuch_search_sanitize ()\r
165 -- \r
166 1.7.1.3.g75e44\r
167 \r