]> git.notmuchmail.org Git - notmuch/commitdiff
test: Avoid using unreliable, hard-coded thread ID values in test suite.
authorCarl Worth <cworth@cworth.org>
Thu, 28 Oct 2010 18:45:50 +0000 (11:45 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 28 Oct 2010 18:45:50 +0000 (11:45 -0700)
Some recently-added tests used hard-coded thread ID values in search
specifications. This is unreliable since the thread IDs depend on the
order in which "notmuch new" encounters new files, (which in turn can
depend on inode ordering within the filesystem).

Fix these by using the new "notmuch search --output=threads" to find the
correct thread IDs given a hard-coded (but reliable) message ID.

test/emacs
test/emacs.expected-output/notmuch-show-thread-9 [deleted file]
test/emacs.expected-output/notmuch-show-thread-maildir-storage [new file with mode: 0644]

index 48433fe6d350b6f2a4f4484c92e785671bfe08fa..e6fa648ff270414d451e1b3ac756d4e79516ee89 100755 (executable)
@@ -22,8 +22,9 @@ output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward
 test_expect_equal_failure "$output" "$expected"
 
 test_begin_subtest "Basic notmuch-show view in emacs"
-output=$(test_emacs '(notmuch-show "thread:0000000000000009") (message (buffer-string))' 2>&1)
-expected=$(cat $EXPECTED/notmuch-show-thread-9)
+maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
+output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (message (buffer-string))" 2>&1)
+expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage)
 test_expect_equal "$output" "$expected"
 
 test_begin_subtest "Navigation of notmuch-search to thread view"
@@ -31,24 +32,25 @@ output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char
 test_expect_equal "$output" "$expected"
 
 test_begin_subtest "Add tag from search view"
-test_emacs '(notmuch-search "thread:0000000000000001") (notmuch-test-wait) (notmuch-search-add-tag "tag-from-search-view")'
-output=$(notmuch search thread:0000000000000001)
-test_expect_equal "$output" "thread:0000000000000001   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-search-view unread)"
+os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
+test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-add-tag \"tag-from-search-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-search-view unread)"
 
 test_begin_subtest "Remove tag from search view"
-test_emacs '(notmuch-search "thread:0000000000000001") (notmuch-test-wait) (notmuch-search-remove-tag "tag-from-search-view")'
-output=$(notmuch search thread:0000000000000001)
-test_expect_equal "$output" "thread:0000000000000001   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
+test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-remove-tag \"tag-from-search-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Add tag from notmuch-show view"
-test_emacs '(notmuch-show "thread:0000000000000001") (notmuch-show-add-tag "tag-from-show-view")'
-output=$(notmuch search thread:0000000000000001)
-test_expect_equal "$output" "thread:0000000000000001   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-add-tag \"tag-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
 
 test_begin_subtest "Remove tag from notmuch-show view"
-test_emacs '(notmuch-show "thread:0000000000000001") (notmuch-show-remove-tag "tag-from-show-view")'
-output=$(notmuch search thread:0000000000000001)
-test_expect_equal "$output" "thread:0000000000000001   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-remove-tag \"tag-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
diff --git a/test/emacs.expected-output/notmuch-show-thread-9 b/test/emacs.expected-output/notmuch-show-thread-9
deleted file mode 100644 (file)
index 8f18afd..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-"Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox)
-Subject: [notmuch] Working with Maildir storage?
-To: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 14:00:54 -0500
-
-I saw the LWN article and decided to take a look at notmuch.  I'm
-currently using mutt and mairix to index and read a collection of
-Maildir mail folders (around 40,000 messages total).
-
-notmuch indexed the messages without complaint, but my attempt at
-searching bombed out. Running, for example:
-
-  notmuch search storage
-
-Resulted in 4604 lines of errors along the lines of:
-
-  Error opening
-  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
-  Too many open files
-
-I'm curious if this is expected behavior (i.e., notmuch does not work
-with Maildir) or if something else is going on.
-
-Cheers,
-
-[ 12-line signature. Click/Enter to toggle visibility. ]
--- 
-Lars Kellogg-Stedman <lars at seas.harvard.edu>
-Senior Technologist, Computing and Information Technology
-Harvard University School of Engineering and Applied Sciences
-
--------------- next part --------------
-A non-text attachment was scrubbed...
-Name: not available
-Type: application/pgp-signature
-Size: 489 bytes
-Desc: not available
-URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/0bc8f9bd/attachment.pgp>
-
- "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
- Subject: [notmuch] Working with Maildir storage?
- To: notmuch@notmuchmail.org
- Date: Wed, 18 Nov 2009 01:02:38 +0600
-
-
- Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
-
-  LK> Resulted in 4604 lines of errors along the lines of:
-
-  LK>   Error opening
-  LK>   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
-  LK>   Too many open files
-
- See the patch just posted here.
-
- [ 9-line signature. Click/Enter to toggle visibility. ]
- -- 
- http://fossarchy.blogspot.com/
- -------------- next part --------------
- A non-text attachment was scrubbed...
- Name: not available
- Type: application/pgp-signature
- Size: 834 bytes
- Desc: not available
- URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/60743c36/attachment.pgp>
-
-  "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox unread)
-  Subject: [notmuch] Working with Maildir storage?
-  To: notmuch@notmuchmail.org
-  Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-  > See the patch just posted here.
-
-  Is the list archived anywhere?  The obvious archives
-  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-  think I subscribed too late to get the patch (I only just saw the
-  discussion about it).
-
-  It doesn't look like the patch is in git yet.
-
-  -- Lars
-
-  [ 12-line signature. Click/Enter to toggle visibility. ]
-  -- 
-  Lars Kellogg-Stedman <lars at seas.harvard.edu>
-  Senior Technologist, Computing and Information Technology
-  Harvard University School of Engineering and Applied Sciences
-
-  -------------- next part --------------
-  A non-text attachment was scrubbed...
-  Name: not available
-  Type: application/pgp-signature
-  Size: 489 bytes
-  Desc: not available
-  URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/5bed6654/attachment.pgp>
-
-   "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Subject: [notmuch] Working with Maildir storage?
-   To: notmuch@notmuchmail.org
-   Date: Wed, 18 Nov 2009 02:50:48 +0600
-
-
-   Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
-
-    LK> Is the list archived anywhere?  The obvious archives
-    LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-    LK> think I subscribed too late to get the patch (I only just saw the
-    LK> discussion about it).
-
-    LK> It doesn't look like the patch is in git yet.
-
-   Just has been pushed
-
-   [ 9-line signature. Click/Enter to toggle visibility. ]
-   -- 
-   http://fossarchy.blogspot.com/
-   -------------- next part --------------
-   A non-text attachment was scrubbed...
-   Name: not available
-   Type: application/pgp-signature
-   Size: 834 bytes
-   Desc: not available
-   URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
-
-   "Keith Packard" <keithp@keithp.com> (2009-11-17) (inbox unread)
-   Subject: [notmuch] Working with Maildir storage?
-   To: notmuch@notmuchmail.org
-   Date: Tue, 17 Nov 2009 13:24:13 -0800
-
-   On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
-   > > See the patch just posted here.
-
-   I've also pushed a slightly more complicated (and complete) fix to my
-   private notmuch repository
-
-   git://keithp.com/git/notmuch
-
-   > Is the list archived anywhere?
-
-   Oops. Looks like Carl's mail server is broken. He's traveling to
-   Barcelona today and so it won't get fixed for a while.
-
-   Thanks to everyone for trying out notmuch!
-
-   -keith
-
-    "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-18) (inbox unread)
-    Subject: [notmuch] Working with Maildir storage?
-    To: notmuch@notmuchmail.org
-    Date: Tue, 17 Nov 2009 19:50:40 -0500
-
-    > I've also pushed a slightly more complicated (and complete) fix to my
-    > private notmuch repository
-
-    The version of lib/messages.cc in your repo doesn't build because it's
-    missing "#include <stdint.h>" (for the uint32_t on line 466).
-
-    [ 12-line signature. Click/Enter to toggle visibility. ]
-    -- 
-    Lars Kellogg-Stedman <lars at seas.harvard.edu>
-    Senior Technologist, Computing and Information Technology
-    Harvard University School of Engineering and Applied Sciences
-
-    -------------- next part --------------
-    A non-text attachment was scrubbed...
-    Name: not available
-    Type: application/pgp-signature
-    Size: 489 bytes
-    Desc: not available
-    URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/b069f470/attachment.pgp>
-
- "Carl Worth" <cworth@cworth.org> (2009-11-18) (inbox unread)
- Subject: [notmuch] Working with Maildir storage?
- To: notmuch@notmuchmail.org
- Date: Wed, 18 Nov 2009 02:08:10 -0800
-
- On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
- > I saw the LWN article and decided to take a look at notmuch.  I'm
- > currently using mutt and mairix to index and read a collection of
- > Maildir mail folders (around 40,000 messages total).
-
- Welcome, Lars!
-
- I hadn't even seen that Keith's blog post had been picked up by lwn.net.
- That's very interesting. So, thanks for coming and trying out notmuch.
-
- >   Error opening
- >   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
- >   Too many open files
-
- Sadly, the lwn article coincided with me having just introduced this
- bug, and then getting on a Trans-Atlantic flight. So I fixed the bug
- fairly quickly, but there was quite a bit of latency before I could push
- the fix out. It should be fixed now.
-
- > I'm curious if this is expected behavior (i.e., notmuch does not work
- > with Maildir) or if something else is going on.
-
- Notmuch works just fine with maildir---it's one of the things that it
- likes the best.
-
- Happy hacking,
-
- -Carl
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
new file mode 100644 (file)
index 0000000..8f18afd
--- /dev/null
@@ -0,0 +1,204 @@
+"Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 12-line signature. Click/Enter to toggle visibility. ]
+-- 
+Lars Kellogg-Stedman <lars at seas.harvard.edu>
+Senior Technologist, Computing and Information Technology
+Harvard University School of Engineering and Applied Sciences
+
+-------------- next part --------------
+A non-text attachment was scrubbed...
+Name: not available
+Type: application/pgp-signature
+Size: 489 bytes
+Desc: not available
+URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/0bc8f9bd/attachment.pgp>
+
+ "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+ Subject: [notmuch] Working with Maildir storage?
+ To: notmuch@notmuchmail.org
+ Date: Wed, 18 Nov 2009 01:02:38 +0600
+
+
+ Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+
+  LK> Resulted in 4604 lines of errors along the lines of:
+
+  LK>   Error opening
+  LK>   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  LK>   Too many open files
+
+ See the patch just posted here.
+
+ [ 9-line signature. Click/Enter to toggle visibility. ]
+ -- 
+ http://fossarchy.blogspot.com/
+ -------------- next part --------------
+ A non-text attachment was scrubbed...
+ Name: not available
+ Type: application/pgp-signature
+ Size: 834 bytes
+ Desc: not available
+ URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/60743c36/attachment.pgp>
+
+  "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox unread)
+  Subject: [notmuch] Working with Maildir storage?
+  To: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 12-line signature. Click/Enter to toggle visibility. ]
+  -- 
+  Lars Kellogg-Stedman <lars at seas.harvard.edu>
+  Senior Technologist, Computing and Information Technology
+  Harvard University School of Engineering and Applied Sciences
+
+  -------------- next part --------------
+  A non-text attachment was scrubbed...
+  Name: not available
+  Type: application/pgp-signature
+  Size: 489 bytes
+  Desc: not available
+  URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/5bed6654/attachment.pgp>
+
+   "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Subject: [notmuch] Working with Maildir storage?
+   To: notmuch@notmuchmail.org
+   Date: Wed, 18 Nov 2009 02:50:48 +0600
+
+
+   Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+
+    LK> Is the list archived anywhere?  The obvious archives
+    LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+    LK> think I subscribed too late to get the patch (I only just saw the
+    LK> discussion about it).
+
+    LK> It doesn't look like the patch is in git yet.
+
+   Just has been pushed
+
+   [ 9-line signature. Click/Enter to toggle visibility. ]
+   -- 
+   http://fossarchy.blogspot.com/
+   -------------- next part --------------
+   A non-text attachment was scrubbed...
+   Name: not available
+   Type: application/pgp-signature
+   Size: 834 bytes
+   Desc: not available
+   URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
+
+   "Keith Packard" <keithp@keithp.com> (2009-11-17) (inbox unread)
+   Subject: [notmuch] Working with Maildir storage?
+   To: notmuch@notmuchmail.org
+   Date: Tue, 17 Nov 2009 13:24:13 -0800
+
+   On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+   > > See the patch just posted here.
+
+   I've also pushed a slightly more complicated (and complete) fix to my
+   private notmuch repository
+
+   git://keithp.com/git/notmuch
+
+   > Is the list archived anywhere?
+
+   Oops. Looks like Carl's mail server is broken. He's traveling to
+   Barcelona today and so it won't get fixed for a while.
+
+   Thanks to everyone for trying out notmuch!
+
+   -keith
+
+    "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-18) (inbox unread)
+    Subject: [notmuch] Working with Maildir storage?
+    To: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 12-line signature. Click/Enter to toggle visibility. ]
+    -- 
+    Lars Kellogg-Stedman <lars at seas.harvard.edu>
+    Senior Technologist, Computing and Information Technology
+    Harvard University School of Engineering and Applied Sciences
+
+    -------------- next part --------------
+    A non-text attachment was scrubbed...
+    Name: not available
+    Type: application/pgp-signature
+    Size: 489 bytes
+    Desc: not available
+    URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/b069f470/attachment.pgp>
+
+ "Carl Worth" <cworth@cworth.org> (2009-11-18) (inbox unread)
+ Subject: [notmuch] Working with Maildir storage?
+ To: notmuch@notmuchmail.org
+ Date: Wed, 18 Nov 2009 02:08:10 -0800
+
+ On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ > I saw the LWN article and decided to take a look at notmuch.  I'm
+ > currently using mutt and mairix to index and read a collection of
+ > Maildir mail folders (around 40,000 messages total).
+
+ Welcome, Lars!
+
+ I hadn't even seen that Keith's blog post had been picked up by lwn.net.
+ That's very interesting. So, thanks for coming and trying out notmuch.
+
+ >   Error opening
+ >   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ >   Too many open files
+
+ Sadly, the lwn article coincided with me having just introduced this
+ bug, and then getting on a Trans-Atlantic flight. So I fixed the bug
+ fairly quickly, but there was quite a bit of latency before I could push
+ the fix out. It should be fixed now.
+
+ > I'm curious if this is expected behavior (i.e., notmuch does not work
+ > with Maildir) or if something else is going on.
+
+ Notmuch works just fine with maildir---it's one of the things that it
+ likes the best.
+
+ Happy hacking,
+
+ -Carl