Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3CD4A431FAF for ; Sat, 3 Nov 2012 14:03:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vDQB8NIDRXbS for ; Sat, 3 Nov 2012 14:03:43 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id CA561431FAE for ; Sat, 3 Nov 2012 14:03:42 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id A3349100030; Sat, 3 Nov 2012 23:03:43 +0200 (EET) From: Tomi Ollila To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH v2] contrib: notmuch-pick: add tests In-Reply-To: <1351797910-19305-1-git-send-email-markwalters1009@gmail.com> References: <1351797910-19305-1-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.14+81~gb8371cd (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2012 21:03:45 -0000 On Thu, Nov 01 2012, Mark Walters wrote: > The test should be run using the wrapper run-tests.sh. This links > the tests into the normal notmuch TEST_DIRECTORY and runs them from > there. After the test is complete then the links are removed. > --- 2 things: The PICK_DIR variable needs export in run-tests.sh, otherwise it is not (always??!!) available for test scripts (all tests failed for me until I added that export (fatal). git am informs test/pick.expected-output/notmuch-pick-show-window=20 has trailing whitespace when applied. Could you arrange your test to use other message there (wish). Tomi > > This is version 2 of the patches to add some tests for notmuch pick.=20 > > The main change is that I have added Tomi's suggested wrapper script > (id:m2ip9srpd6.fsf@guru.guru-group.fi) which is much more robust and > generally better than the one I had. > > The other changes are to split out the tests for the default async > parser from those for the sync parser. My guess is that the sync > parser should be removed but it can be useful for debugging so is > probably worth keeping until pick is closer to being ready for proper > mainline. > > Best wishes > > Mark > > > > > contrib/notmuch-pick/README | 5 ++ > contrib/notmuch-pick/run-tests.sh | 46 ++++++++++++ > contrib/notmuch-pick/test/emacs-pick | 76 ++++++++++++++= ++++++ > contrib/notmuch-pick/test/emacs-pick-sync | 64 ++++++++++++++= ++ > .../pick.expected-output/notmuch-pick-show-window | 32 ++++++++ > .../notmuch-pick-single-thread | 6 ++ > .../pick.expected-output/notmuch-pick-tag-inbox | 53 ++++++++++++++ > 7 files changed, 282 insertions(+), 0 deletions(-) > create mode 100755 contrib/notmuch-pick/run-tests.sh > create mode 100755 contrib/notmuch-pick/test/emacs-pick > create mode 100755 contrib/notmuch-pick/test/emacs-pick-sync > create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuc= h-pick-show-window > create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuc= h-pick-single-thread > create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuc= h-pick-tag-inbox > > diff --git a/contrib/notmuch-pick/README b/contrib/notmuch-pick/README > index 8eed974..4200824 100644 > --- a/contrib/notmuch-pick/README > +++ b/contrib/notmuch-pick/README > @@ -15,6 +15,11 @@ Then after the "(require 'notmuch)" line in your .emac= s file add > the line "(require 'notmuch-pick nil t)". This will load notmuch-pick on > your next emacs start. >=20=20 > +TEST > + > +Just execute run-tests.sh and it should all work (it does require that > +notmuch has already been built). > + > USING PICK >=20=20 > The main key entries to notmuch pick are > diff --git a/contrib/notmuch-pick/run-tests.sh b/contrib/notmuch-pick/run= -tests.sh > new file mode 100755 > index 0000000..97cc9e8 > --- /dev/null > +++ b/contrib/notmuch-pick/run-tests.sh > @@ -0,0 +1,46 @@ > +#!/usr/bin/env bash > + > +set -eu > + > +fail() { > + echo ERROR $1 > + exit 1 > +} > + > +TESTS=3D"emacs-pick emacs-pick-sync" > +TESTFILES=3D"$TESTS pick.expected-output" > + > +PICK_DIR=3D"`cd \`dirname "$0"\` && pwd`" > +PICK_TEST_DIR=3D"$PICK_DIR/test" > + > + > +for f in $TESTFILES > +do > + test -f "$PICK_TEST_DIR/$f" || test -d "$PICK_TEST_DIR/$f" || fail "= $PICK_TEST_DIR/$f does not exist" > +done > + > +cd "$PICK_DIR/../../test" > + > +test -x ../notmuch || fail "`cd .. && pwd`/notmuch has not been built" > + > +for f in $TESTFILES > +do > + if test -f "$f" > + then > + fail "$f exists" > + fi > +done > + > +trap "rm -f $TESTFILES" 0 > + > +for f in $TESTFILES > +do > + ln -s "$PICK_TEST_DIR/$f" . > +done > + > +#don't exec -- traps would not run. > +for f in $TESTS > +do > + echo $f > + ./$f > +done > diff --git a/contrib/notmuch-pick/test/emacs-pick b/contrib/notmuch-pick/= test/emacs-pick > new file mode 100755 > index 0000000..9db4b34 > --- /dev/null > +++ b/contrib/notmuch-pick/test/emacs-pick > @@ -0,0 +1,76 @@ > +#!/usr/bin/env bash > + > +test_description=3D"emacs pick interface" > +. test-lib.sh > + > +EXPECTED=3D$TEST_DIRECTORY/pick.expected-output > + > +add_email_corpus > +test_begin_subtest "Do we have emacs" > +test_emacs '(insert "hello\n") > + (test-output)' > +cat <EXPECTED > +hello > +EOF > +test_expect_equal_file OUTPUT EXPECTED > + > +test_begin_subtest "Basic notmuch-pick view in emacs" > +test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'") > + (require (quote notmuch-pick)) > + (notmuch-pick "tag:inbox") > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox > + > +test_begin_subtest "Navigation of notmuch-hello to search results" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-pick-from-search-current-query) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox > + > +test_begin_subtest "Pick of a single thread (from search)" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-pick-from-search-thread) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread > + > +test_begin_subtest "Pick of a single thread (from show)" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-search-show-thread) > + (notmuch-pick-from-show-current-query) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread > + > +test_begin_subtest "Message window of pick" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-pick-from-search-thread) > + (notmuch-test-wait) > + (select-window notmuch-pick-message-window) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-show-window > + > +test_done > diff --git a/contrib/notmuch-pick/test/emacs-pick-sync b/contrib/notmuch-= pick/test/emacs-pick-sync > new file mode 100755 > index 0000000..a7da0ff > --- /dev/null > +++ b/contrib/notmuch-pick/test/emacs-pick-sync > @@ -0,0 +1,64 @@ > +#!/usr/bin/env bash > + > +test_description=3D"emacs pick interface (sync parser)" > +. test-lib.sh > + > +EXPECTED=3D$TEST_DIRECTORY/pick.expected-output > + > +add_email_corpus > +test_begin_subtest "Do we have emacs" > +test_emacs '(insert "hello\n") > + (test-output)' > +cat <EXPECTED > +hello > +EOF > +test_expect_equal_file OUTPUT EXPECTED > + > +test_begin_subtest "Basic notmuch-pick view in emacs" > +test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'") > + (require (quote notmuch-pick)) > + (setq notmuch-pick-asynchronous-parser nil) > + (notmuch-pick "tag:inbox") > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox > + > +test_begin_subtest "Navigation of notmuch-hello to search results" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-pick-from-search-current-query) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox > + > +test_begin_subtest "Pick of a single thread (from search)" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-pick-from-search-thread) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread > + > +test_begin_subtest "Pick of a single thread (from show)" > +test_emacs '(notmuch-hello) > + (goto-char (point-min)) > + (re-search-forward "inbox") > + (widget-button-press (1- (point))) > + (notmuch-test-wait) > + (notmuch-search-show-thread) > + (notmuch-pick-from-show-current-query) > + (notmuch-test-wait) > + (test-output) > + (delete-other-windows)' > +test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread > + > +test_done > diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-= show-window b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-s= how-window > new file mode 100644 > index 0000000..de37267 > --- /dev/null > +++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-show-wi= ndow > @@ -0,0 +1,32 @@ > +Mikhail Gusarov (2009-11-17) (inbox) > +Subject: [notmuch] [PATCH 1/2] Close message file after parsing message = headers > +To: notmuch@notmuchmail.org > +Date: Tue, 17 Nov 2009 21:28:37 +0600 > + > +Keeping unused files open helps to see "Too many open files" often. > + > +Signed-off-by: Mikhail Gusarov > +--- > + lib/message-file.c | 5 +++++ > + 1 files changed, 5 insertions(+), 0 deletions(-) > + > +diff --git a/lib/message-file.c b/lib/message-file.c > +index 8a3f8ee..197ab01 100644 > +--- a/lib/message-file.c > ++++ b/lib/message-file.c > +@@ -325,6 +325,11 @@ notmuch_message_file_get_header (notmuch_message_fi= le_t > +*message, > + return decoded_value; > + } > + > ++ if (message->parsing_finished) { > ++ fclose (message->file); > ++ message->file =3D NULL; > ++ } > ++ > + if (message->line) > + free (message->line); > + message->line =3D NULL; > +[ 2-line signature. Click/Enter to show. ] > +--=20 > +1.6.3.3 > diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-= single-thread b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick= -single-thread > new file mode 100644 > index 0000000..c9e5ef8 > --- /dev/null > +++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-= thread > @@ -0,0 +1,6 @@ > + 2009-11-17 Mikhail Gusarov =E2=94=AC=E2=96=BA[notmuch] [PATCH 1= /2] Close message file after parsing message headers (inbox) > + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=80=E2=96=BA[notmuch]= [PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (i= nbox, unread) > + 2009-11-17 Carl Worth =E2=95=B0=E2=94=AC=E2=96=BA[notmuch]= [PATCH 1/2] Close message file after parsing message headers (inbox, unrea= d) > + 2009-11-17 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > +End of search results. > diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-= tag-inbox b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag= -inbox > new file mode 100644 > index 0000000..484141e > --- /dev/null > +++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inb= ox > @@ -0,0 +1,53 @@ > + 2010-12-29 Fran=C3=A7ois Boulogne =E2=94=80=E2=96=BA[aur-general]= Guidelines: cp, mkdir vs install (inbox, unread) > + 2010-12-16 Olivier Berger =E2=94=80=E2=96=BAEssai accentu=C3= =A9 (inbox, unread) > + 2009-11-18 Chris Wilson =E2=94=80=E2=96=BA[notmuch] [PATCH 1= /2] Makefile: evaluate pkg-config once (inbox, unread) > + 2009-11-18 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] [PATCH] = Error out if no query is supplied to search instead of going into an infini= te loop (attachment, inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch]= [PATCH] Error out if no query is supplied to search instead of going into = an infinite loop (inbox, unread) > + 2009-11-17 Ingmar Vanhassel =E2=94=AC=E2=96=BA[notmuch] [PATCH] = Typsos (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Adrian Perez de Cast =E2=94=AC=E2=96=BA[notmuch] Introduc= ing myself (inbox, signed, unread) > + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Israel Herraiz =E2=94=AC=E2=96=BA[notmuch] New to t= he list (inbox, unread) > + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] What a g= reat idea! (inbox, unread) > + 2009-11-17 Jan Janak =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] [PATCH] = Older versions of install do not support -C. (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Aron Griffis =E2=94=AC=E2=96=BA[notmuch] archive = (inbox, unread) > + 2009-11-18 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] = Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (in= box, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch]= [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread)= tags (inbox, unread) > + 2009-11-17 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] Working = with Maildir storage? (inbox, signed, unread) > + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=AC=E2=96=BA ... = (inbox, signed, unread) > + 2009-11-17 Lars Kellogg-Stedman =E2=94=82=E2=95=B0=E2=94=AC=E2=96=BA= ... (inbox, signed, unread) > + 2009-11-17 Mikhail Gusarov =E2=94=82 =E2=94=9C=E2=94=80=E2=96= =BA ... (inbox, unread) > + 2009-11-17 Keith Packard =E2=94=82 =E2=95=B0=E2=94=AC=E2=96= =BA ... (inbox, unread) > + 2009-11-18 Lars Kellogg-Stedman =E2=94=82 =E2=95=B0=E2=94=80=E2=96= =BA ... (inbox, signed, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-17 Mikhail Gusarov =E2=94=AC=E2=96=BA[notmuch] [PATCH 1= /2] Close message file after parsing message headers (inbox, unread) > + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=80=E2=96=BA[notmuch]= [PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (i= nbox, unread) > + 2009-11-17 Carl Worth =E2=95=B0=E2=94=AC=E2=96=BA[notmuch]= [PATCH 1/2] Close message file after parsing message headers (inbox, unrea= d) > + 2009-11-17 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] = Create a default notmuch-show-hook that highlights URLs and uses word-wrap = (inbox, unread) > + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA[notmuch]= [PATCH] Create a default notmuch-show-hook that highlights URLs and uses w= ord-wrap (inbox, unread) > + 2009-11-18 Alexander Botero-Low =E2=94=80=E2=96=BA[notmuch] request = for pull (inbox, unread) > + 2009-11-18 Jjgod Jiang =E2=94=AC=E2=96=BA[notmuch] Mac OS X= /Darwin compatibility issues (inbox, unread) > + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Jjgod Jiang =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > + 2009-11-18 Rolland Santimano =E2=94=80=E2=96=BA[notmuch] Link to = mailing list archives ? (inbox, unread) > + 2009-11-18 Jan Janak =E2=94=80=E2=96=BA[notmuch] [PATCH] = notmuch new: Support for conversion of spool subdirectories into tags (inbo= x, unread) > + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] = count_files: sort directory in inode order before statting (inbox, unread) > + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH 2= /2] Read mail directory in inode number order (inbox, unread) > + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] = Fix linking with gcc to use g++ to link in C++ libs. (inbox, unread) > + 2009-11-18 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] "notmuch= help" outputs to stderr? (attachment, inbox, signed, unread) > + 2009-11-18 Lars Kellogg-Stedman =E2=95=B0=E2=94=80=E2=96=BA ... = (attachment, inbox, signed, unrea= d) > + 2009-11-17 Mikhail Gusarov =E2=94=80=E2=96=BA[notmuch] [PATCH] = Handle rename of message file (inbox, unread) > + 2009-11-17 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] prelimin= ary FreeBSD support (attachment, inbox, unread) > + 2009-11-17 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox, unread) > +End of search results. > --=20 > 1.7.9.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch