Re: [PATCH] test: test folder renames
[notmuch-archives.git] / e0 / 4fad191fe1495929d4bbdf7b2bd6aa668b4745
1 Return-Path: <tomi.ollila@iki.fi>\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 30DC2431FD6\r
6         for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 15:29:10 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 VpllNKcLooni for <notmuch@notmuchmail.org>;\r
16         Sun, 23 Feb 2014 15:29:04 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 9C05A431FCF\r
19         for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 15:29:03 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id A67A4100064;\r
22         Mon, 24 Feb 2014 01:28:57 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org,\r
25         Mark Walters <markwalters1009@gmail.com>\r
26 Subject: Re: [PATCH] test: test folder renames\r
27 In-Reply-To: <1393191650-28333-1-git-send-email-jani@nikula.org>\r
28 References: <87siray6th.fsf@qmul.ac.uk>\r
29         <1393191650-28333-1-git-send-email-jani@nikula.org>\r
30 User-Agent: Notmuch/0.17+108~gb327c11 (http://notmuchmail.org) Emacs/24.3.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Mon, 24 Feb 2014 01:28:57 +0200\r
36 Message-ID: <m2ob1xpfwm.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sun, 23 Feb 2014 23:29:10 -0000\r
52 \r
53 On Sun, Feb 23 2014, Jani Nikula <jani@nikula.org> wrote:\r
54 \r
55 > On Sun, 23 Feb 2014, Mark Walters <markwalters1009@gmail.com> wrote:\r
56 >> I was experimenting with letting notmuch new take an argument to tell it\r
57 >> to scan only a particular directory (and sub-directories) for new\r
58 >> messages. I came across the following strange behaviour which is also\r
59 >> present in master (with a fresh database)\r
60 >>\r
61 >> I have a bunch of maildirs in /home/mail: so folders .mail.foo/\r
62 >> .mail.bar/ each of which has cur/new/tmp and all the messages are in\r
63 >> cur.\r
64 >>\r
65 >> If I do mv .mail.foo .mail.bar/ and run notmuch new I get the expected\r
66 >> lots of renames (900 or so in the case I was trying). But if I then do\r
67 >> mv .mail.bar/.mail.foo . and run notmuch new almost all the messages get\r
68 >> removed (but 30 renames do get detected). If I then do touch .mail.foo/*\r
69 >> the messages get found again\r
70 >>\r
71 >> I am guessing the 30 renames might be because those 30 have duplicates\r
72 >> somewhere else.\r
73 >>\r
74 >> But the other behaviour has me puzzled.\r
75 >\r
76 > This test reproduces the problem for me, but it's not\r
77 > deterministic. With the loop, I get roughly one fail per test run:\r
78 >\r
79 >  FAIL   Rename folder back\r
80 >  --- T051-new-renames.27.expected     2014-02-23 21:37:10.121774241 +0000\r
81 >  +++ T051-new-renames.27.output               2014-02-23 21:37:10.121774241 +0000\r
82 >  @@ -1 +1 @@\r
83 >  -No new mail. Detected 10 file renames.\r
84 >  +No new mail. Removed 10 messages.\r
85 >  FAIL   Files remain the same\r
86 >  --- T051-new-renames.28.expected     2014-02-23 21:37:10.133774652 +0000\r
87 >  +++ T051-new-renames.28.output               2014-02-23 21:37:10.133774652 +0000\r
88 >  @@ -1,13 +1,3 @@\r
89 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-121\r
90 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-122\r
91 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-123\r
92 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-124\r
93 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-125\r
94 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-126\r
95 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-127\r
96 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-128\r
97 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-129\r
98 >  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-130\r
99 >   /path/to/test/tmp.T051-new-renames/mail/bar/msg-131\r
100 >   /path/to/test/tmp.T051-new-renames/mail/bar/msg-132\r
101 >   /path/to/test/tmp.T051-new-renames/mail/bar/msg-133\r
102 >\r
103 > I'm as puzzled as you are.\r
104 \r
105 find /path/to/test/tmp.T051-new-renames/ might show what is the order\r
106 or 'foo' and 'bar' directories there. the order might be arbitrary\r
107 -- it surely is not alphabetical and it might not be the order\r
108 created...\r
109 \r
110 The order should not matter -- and maybe it didn't and some change\r
111 made that matter... \r
112 \r
113 I'd test now but I should be ZZZ :D\r
114 \r
115 >\r
116 > BR,\r
117 > Jani.\r
118 \r
119 Tomi\r
120 \r
121 > ---\r
122 >  test/T051-new-renames.sh | 40 ++++++++++++++++++++++++++++++++++++++++\r
123 >  1 file changed, 40 insertions(+)\r
124 >  create mode 100755 test/T051-new-renames.sh\r
125 >\r
126 > diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh\r
127 > new file mode 100755\r
128 > index 000000000000..febe006f5888\r
129 > --- /dev/null\r
130 > +++ b/test/T051-new-renames.sh\r
131 > @@ -0,0 +1,40 @@\r
132 > +#!/usr/bin/env bash\r
133 > +test_description='"notmuch new" with directory renames'\r
134 > +. ./test-lib.sh\r
135 > +\r
136 > +for loop in `seq 10`; do\r
137 > +\r
138 > +rm -rf ${MAIL_DIR}\r
139 > +\r
140 > +for i in `seq 10`; do\r
141 > +    generate_message '[dir]=foo' '[subject]="Message foo $i"'\r
142 > +done\r
143 > +\r
144 > +for i in `seq 10`; do\r
145 > +    generate_message '[dir]=bar' '[subject]="Message bar $i"'\r
146 > +done\r
147 > +\r
148 > +test_begin_subtest "Index the messages, round $loop"\r
149 > +output=$(NOTMUCH_NEW)\r
150 > +test_expect_equal "$output" "Added 20 new messages to the database."\r
151 > +\r
152 > +all_files=$(notmuch search --output=files \*)\r
153 > +count_foo=$(notmuch count folder:foo)\r
154 > +\r
155 > +test_begin_subtest "Rename folder"\r
156 > +mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz\r
157 > +output=$(NOTMUCH_NEW)\r
158 > +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
159 > +\r
160 > +test_begin_subtest "Rename folder back"\r
161 > +mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo\r
162 > +output=$(NOTMUCH_NEW)\r
163 > +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
164 > +\r
165 > +test_begin_subtest "Files remain the same"\r
166 > +output=$(notmuch search --output=files \*)\r
167 > +test_expect_equal "$output" "$all_files"\r
168 > +\r
169 > +done\r
170 > +\r
171 > +test_done\r
172 > -- \r
173 > 1.8.5.3\r
174 >\r
175 > _______________________________________________\r
176 > notmuch mailing list\r
177 > notmuch@notmuchmail.org\r
178 > http://notmuchmail.org/mailman/listinfo/notmuch\r