Re: v4 of DB_RETRY_LOCK patches
[notmuch-archives.git] / f9 / c01f6010a0d29e09fd9a2fe8762791ee358c14
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 C85D0409DE5\r
6         for <notmuch@notmuchmail.org>; Mon, 10 May 2010 09:49:01 -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 4J8lycp2o0yD for <notmuch@notmuchmail.org>;\r
16         Mon, 10 May 2010 09:48:49 -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 08841418C25\r
19         for <notmuch@notmuchmail.org>; Mon, 10 May 2010 09:48:23 -0700 (PDT)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id 6144319F3407;\r
22         Mon, 10 May 2010 18:48:22 +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 JoiujGtlBRS6; Mon, 10 May 2010 18:48:14 +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 7075219F343E;\r
30         Mon, 10 May 2010 18:48:14 +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 68AC2FA003;\r
34         Mon, 10 May 2010 18:48:14 +0200 (CEST)\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.71)\r
36         (envelope-from <sojkam1@fel.cvut.cz>)\r
37         id 1OBW9O-0005Bb-7g; Mon, 10 May 2010 18:48:14 +0200\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 3/5] test: Update helper functions\r
41 Date: Mon, 10 May 2010 18:48:02 +0200\r
42 Message-Id: <1273510084-19896-4-git-send-email-sojkam1@fel.cvut.cz>\r
43 X-Mailer: git-send-email 1.7.1\r
44 In-Reply-To: <1273510084-19896-1-git-send-email-sojkam1@fel.cvut.cz>\r
45 References: <1273510084-19896-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: Mon, 10 May 2010 16:49:02 -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 doesn't exist and $PATH is set to the build\r
63    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 e780dd3..06559cd 100755\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 @@ -289,7 +289,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 @@ -334,7 +334,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 @@ -345,7 +345,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 @@ -354,41 +354,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\r
167 \r