[PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-26 Thread da...@tethera.net
From: David Bremner 

Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not
generate notmuch.aux for him with Debian gcc 4.6.0-8. A small
modification of the original sed regular expression allows us to work
directly from lib/notmuch.h, rather than preprocessing with gcc.

As with most such simple regex based "parsing", this is quite
sensitive to the input format, and needs that each symbol to be
exported from libnotmuch should

- start with "notmuch_"
- be the first non-whitespace token on the line
- be followed by an open parenthesis.
---
 lib/Makefile.local |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index a33ba34..0459fd0 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -76,9 +76,8 @@ $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) 
$(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@

 notmuch.sym: lib/notmuch.h
-   gcc -aux-info notmuch.aux $<
printf "{\nglobal:\n" > notmuch.sym
-   sed  -n 's/.*\(notmuch_[a-z_]*\) (.*/\t\1;/p' notmuch.aux >> notmuch.sym
+   sed  -n 's/^\s*\(notmuch_[a-z_]*\)\s*(.*/\t\1;/p' $< >> notmuch.sym
printf "local: *;\n};\n" >> notmuch.sym

 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
@@ -103,4 +102,4 @@ install-$(dir): $(dir)/$(LIBNAME)
$(LIBRARY_INSTALL_POST_COMMAND)

 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.aux notmuch.sym
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.sym
-- 
1.7.5.4



xapian exceptions not caught in python bindings?

2011-06-26 Thread Patrick Totzke
Hi all!
It's me again, with some strange python behaviour :/

When I iterate over threads or messages only partially,
then make changes to the index and continue the iteration,
then I don't necessarily get NotmuchError's but the underlying
libnotmuch seems to call terminate. I get the following two lines on
stderr:
  terminate called after throwing an instance of 'Xapian::DatabaseModifiedError'
  Aborted
then python aborts without an exception.
This happens on current master with current python bindings. To reproduce
use this to iterate over messages:

--%<---
#it_read.py
from notmuch import Query,Database
msgs = Database().create_query('*').search_messages()

i=0
for m in msgs:
i=i+1
if i%50==0:
raw_input()
readit = str(m)
-->%---

start it, then use this to change the index:

--%<---
#it_write.py 
from notmuch import Query,Database
db = Database(mode = Database.MODE.READ_WRITE)
msgs = Query(db,'*').search_messages()

i=0
for m in msgs:
i=i+1
if i%20==0:
m.add_tag('REMOVEME')
-->%---

you have to alternate a bit between hitting enter in the
read code and rerunning the write code.
Read will fail at some point.

The strange thing is that its not consistent:
I stumbled upon this while reading a list of threads from notmuch.threads on
demand. If reading from the iterator catches a NotmuchError, i create a new one
and update my list threads read so far. This does work, but: on every
NotmuchError, I get this on stderr:
 A Xapian exception occurred performing query: The revision being read has been 
discarded - you should call Xapian::Database::reopen() and retry the operation
 Query string was: thread:1876

After a couple of resets this does not happen again but the next time i read
from an outdated index, the whole UI terminates with the "Aborted" message
stated above.

To sum up, I think there are two bad things happening here:
1) should libnotmuch really print to stderr?
2) the python bindings are either not relaying all exceptions or libnotmuch is 
not relaying 
all xapian exceptions in order for the bindings to intercept them

cheers,
/p
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110626/677dd702/attachment.pgp>


[PATCH] test: remove useless test_emacs call from an emacs FCC test

2011-06-26 Thread Pieter Praet
On Thu, 23 Jun 2011 22:15:25 -0300, David Bremner  wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
> [...] I'm going
> to skip the typo fixes for 0.6, unless convinced otherwise.

Well, the whole point of my de-typo-ifying sprint was to make 0.6 a
~typo-free release, actually :D

But... I'll be the first to admit that it bears no importance whatsoever
regarding actual day-to-day usage of Notmuch, so either way, I don't mind.

> d
> 
> P.S. It would be great if people built the release branch and reported
> any (new) problems.
Non-text part: application/pgp-signature
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


[1] id:"1307202852-4398-1-git-send-email-pieter at praet.org"


Race condition for '*' command

2011-06-26 Thread Robin Green
On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins  wrote:
> On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green  
> wrote:
> > A race condition in the '*' command was noted when it was first
> > proposed. It looks to me like it still exists - has anything been done
> > about it?
> 
> Hi, Robin.  Can you explain what you mean by the "'*' command"?

Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
mode '*' applies tags to all messages matching the current search query,
which means that (here's the race condition) new results that have
appeared since the last refresh will also be tagged.

-- 
Robin


Race condition for '*' command

2011-06-26 Thread Robin Green
Hi,

A race condition in the '*' command was noted when it was first
proposed. It looks to me like it still exists - has anything been done
about it?

Right now what I am doing is killing fetchmail, then using the '*'
command, then starting fetchmail again in daemon mode, which is a little
inconvenient. You see, in my setup fetchmail calls procmail to deliver
mails, and procmail calls "notmuch new" after delivering every mail.

Thanks,
Robin Green


Re: Race condition for '*' command

2011-06-26 Thread Robin Green
On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green gree...@greenrd.org wrote:
  A race condition in the '*' command was noted when it was first
  proposed. It looks to me like it still exists - has anything been done
  about it?
 
 Hi, Robin.  Can you explain what you mean by the '*' command?

Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
mode '*' applies tags to all messages matching the current search query,
which means that (here's the race condition) new results that have
appeared since the last refresh will also be tagged.

-- 
Robin
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: remove useless test_emacs call from an emacs FCC test

2011-06-26 Thread Pieter Praet
On Thu, 23 Jun 2011 22:15:25 -0300, David Bremner da...@tethera.net wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
 [...] I'm going
 to skip the typo fixes for 0.6, unless convinced otherwise.

Well, the whole point of my de-typo-ifying sprint was to make 0.6 a
~typo-free release, actually :D

But... I'll be the first to admit that it bears no importance whatsoever
regarding actual day-to-day usage of Notmuch, so either way, I don't mind.

 d
 
 P.S. It would be great if people built the release branch and reported
 any (new) problems.
Non-text part: application/pgp-signature
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


[1] id:1307202852-4398-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


xapian exceptions not caught in python bindings?

2011-06-26 Thread Patrick Totzke
Hi all!
It's me again, with some strange python behaviour :/

When I iterate over threads or messages only partially,
then make changes to the index and continue the iteration,
then I don't necessarily get NotmuchError's but the underlying
libnotmuch seems to call terminate. I get the following two lines on
stderr:
  terminate called after throwing an instance of 'Xapian::DatabaseModifiedError'
  Aborted
then python aborts without an exception.
This happens on current master with current python bindings. To reproduce
use this to iterate over messages:

--%---
#it_read.py
from notmuch import Query,Database
msgs = Database().create_query('*').search_messages()

i=0
for m in msgs:
i=i+1
if i%50==0:
raw_input()
readit = str(m)
--%---

start it, then use this to change the index:

--%---
#it_write.py 
from notmuch import Query,Database
db = Database(mode = Database.MODE.READ_WRITE)
msgs = Query(db,'*').search_messages()

i=0
for m in msgs:
i=i+1
if i%20==0:
m.add_tag('REMOVEME')
--%---

you have to alternate a bit between hitting enter in the
read code and rerunning the write code.
Read will fail at some point.

The strange thing is that its not consistent:
I stumbled upon this while reading a list of threads from notmuch.threads on
demand. If reading from the iterator catches a NotmuchError, i create a new one
and update my list threads read so far. This does work, but: on every
NotmuchError, I get this on stderr:
 A Xapian exception occurred performing query: The revision being read has been 
discarded - you should call Xapian::Database::reopen() and retry the operation
 Query string was: thread:1876

After a couple of resets this does not happen again but the next time i read
from an outdated index, the whole UI terminates with the Aborted message
stated above.

To sum up, I think there are two bad things happening here:
1) should libnotmuch really print to stderr?
2) the python bindings are either not relaying all exceptions or libnotmuch is 
not relaying 
all xapian exceptions in order for the bindings to intercept them

cheers,
/p


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/5] test: do not set `message-signature' in test_emacs

2011-06-26 Thread Dmitry Kurochkin
It is no longer needed since tests are run in a temporary home
directory instead of the user's one.
---
 test/test-lib.sh |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index cc20f41..3ec388c 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -855,8 +855,6 @@ fi
 #
 # notmuch-test-waitFunction for tests to use to wait for process completion
 #
-# message-signatureAvoiding appending user's signature on messages
-#
 # set-frame-width  80 columns (avoids crazy 10-column default of --batch)
 
 emacs \$BATCH --no-init-file --no-site-file \
@@ -865,7 +863,6 @@ emacs \$BATCH --no-init-file --no-site-file \
--eval (defun notmuch-test-wait ()
(while (get-buffer-process (current-buffer))
(sleep-for 0.1))) \
-   --eval (setq message-signature nil) \
--eval (progn (set-frame-width (window-frame (get-buffer-window)) 80) 
\$@)
 EOF
chmod a+x ./run_emacs
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/5] test: cleanup test_emacs

2011-06-26 Thread Dmitry Kurochkin
Move auxiliary function definition and configuration from command
line to test-lib.el.
---
 test/test-lib.el |8 
 test/test-lib.sh |9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 9439996..344a02e 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -20,6 +20,14 @@
 ;;
 ;; Authors: Dmitry Kurochkin dmitry.kuroch...@gmail.com
 
+;; avoid crazy 10-column default of --batch
+(set-frame-width (window-frame (get-buffer-window)) 80)
+
+(defun notmuch-test-wait ()
+  Wait for process completion.
+  (while (get-buffer-process (current-buffer))
+(sleep-for 0.1)))
+
 (defun visible-buffer-string ()
   Same as `buffer-string', but excludes invisible text.
   (visible-buffer-substring (point-min) (point-max)))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 3ec388c..5f61960 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -852,18 +852,11 @@ fi
 # --directory  Ensure that the local elisp sources are found
 #
 # --load   Force loading of notmuch.el and test-lib.el
-#
-# notmuch-test-waitFunction for tests to use to wait for process completion
-#
-# set-frame-width  80 columns (avoids crazy 10-column default of --batch)
 
 emacs \$BATCH --no-init-file --no-site-file \
--directory ../../emacs --load notmuch.el \
--directory .. --load test-lib.el \
-   --eval (defun notmuch-test-wait ()
-   (while (get-buffer-process (current-buffer))
-   (sleep-for 0.1))) \
-   --eval (progn (set-frame-width (window-frame (get-buffer-window)) 80) 
\$@)
+   --eval (progn \$@)
 EOF
chmod a+x ./run_emacs
./run_emacs $@
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/5] test: wrap and indent test_emacs calls

2011-06-26 Thread Dmitry Kurochkin
Most test_emacs calls have long arguments that consist of many
expressions.  Putting them on a single line makes it hard to read
and produces poor diff when they are changed.  The patch puts
every expression in test_emacs calls on a separate line.
---
 test/emacs   |  124 --
 test/test-lib.sh |   14 ++-
 2 files changed, 114 insertions(+), 24 deletions(-)

diff --git a/test/emacs b/test/emacs
index 6f82b08..1e46c0d 100755
--- a/test/emacs
+++ b/test/emacs
@@ -7,32 +7,51 @@ EXPECTED=../emacs.expected-output
 add_email_corpus
 
 test_begin_subtest Basic notmuch-hello view in emacs
-test_emacs '(notmuch-hello) (princ (buffer-string))' OUTPUT
+test_emacs '(notmuch-hello)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
 
 test_begin_subtest Saved search with 0 results
-test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''((inbox . tag:inbox) (unread . tag:unread) 
(empty . tag:doesnotexist))) (notmuch-hello) (princ (buffer-string))' 
OUTPUT
+test_emacs '(setq notmuch-show-empty-saved-searches t)
+   (setq notmuch-saved-searches
+ '\''((inbox . tag:inbox)
+  (unread . tag:unread)
+  (empty . tag:doesnotexist)))
+   (notmuch-hello)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
 
 test_begin_subtest No saved searches displayed (all with 0 results)
-test_emacs '(setq notmuch-saved-searches '\''((empty . tag:doesnotexist))) 
(notmuch-hello) (princ (buffer-string))' OUTPUT
+test_emacs '(setq notmuch-saved-searches
+ '\''((empty . tag:doesnotexist)))
+   (notmuch-hello)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
 
 test_begin_subtest Basic notmuch-search view in emacs
-test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) (princ 
(buffer-string))' OUTPUT
+test_emacs '(notmuch-search tag:inbox)
+   (notmuch-test-wait)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-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 (point)) (notmuch-test-wait) (princ 
(buffer-string))' OUTPUT
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward inbox)
+   (widget-button-press (point))
+   (notmuch-test-wait)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
 
 test_begin_subtest Basic notmuch-show view in emacs
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.gu3...@dottiness.seas.harvard.edu)
-test_emacs (notmuch-show \$maildir_storage_thread\) (princ 
(buffer-string)) OUTPUT
+test_emacs (notmuch-show \$maildir_storage_thread\)
+   (princ (buffer-string)) OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest notmuch-show for message with invalid From
-add_message [subject]=\message-with-invalid-from\ [from]=Invalid 
\\\ From\\\ test_su...@notmuchmail.org\
+add_message [subject]=\message-with-invalid-from\ \
+   [from]=Invalid \\\ From\\\ test_su...@notmuchmail.org\
 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
 output=$(test_emacs (notmuch-show \$thread\) (princ (buffer-string)))
 test_expect_equal $output \
@@ -44,33 +63,54 @@ Date: Tue, 05 Jan 2001 15:43:57 -
 This is just a test message (#1)'
 
 test_begin_subtest Navigation of notmuch-search to thread view
-test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) (goto-char 
(point-min)) (re-search-forward Working with Maildir) 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' 
OUTPUT
+test_emacs '(notmuch-search tag:inbox)
+   (notmuch-test-wait)
+   (goto-char (point-min))
+   (re-search-forward Working with Maildir)
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (princ (buffer-string))' OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest Add tag from search view
 os_x_darwin_thread=$(notmuch search --output=threads 
id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com)
-test_emacs (notmuch-search \$os_x_darwin_thread\) (notmuch-test-wait) 
(notmuch-search-add-tag \tag-from-search-view\)
+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 

[PATCH 5/5] test: remove some sed(1) calls in Emacs tests

2011-06-26 Thread Dmitry Kurochkin
Few Emacs tests used sed(1) to remove unexpected output in the
beginning to avoid getting confused by messages such as Parsing
/home/cworth/.mailrc... done.  This is no longer needed since
tests are run in a temporary home directory instead of the user's
one.  So remove these sed(1) calls.
---
 test/emacs |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/test/emacs b/test/emacs
index fc4c01f..f3239ea 100755
--- a/test/emacs
+++ b/test/emacs
@@ -250,13 +250,10 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest Reply within emacs
-# We sed away everything before the ^From in the output to avoid getting
-# confused by messages such as Parsing /home/cworth/.mailrc... done
 test_emacs '(notmuch-search subject:\testing message sent via SMTP\)
(notmuch-test-wait)
(notmuch-search-reply-to-thread)
(test-output)'
-sed -i -ne '/^From/,$ p' OUTPUT
 sed -i -e 's/^In-Reply-To: .*$/In-Reply-To: XXX/' OUTPUT
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
@@ -284,11 +281,9 @@ test_emacs '(notmuch-show-save-part 
id:cf0c4d610911171136h1713aa59w9cf9aa31f052
 test_expect_equal_file $EXPECTED/attachment attachment2.gz
 
 test_begin_subtest View raw message within emacs
-first_line=$(head -n1 $EXPECTED/raw-message-cf0c4d-52ad0a)
 test_emacs '(notmuch-show 
id:cf0c4d610911171136h1713aa59w9cf9aa31f052a...@mail.gmail.com)
(notmuch-show-view-raw-message)
(test-output)'
-sed -i -ne /$first_line/,\$ p OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
 
 test_begin_subtest Hiding/showing signature in notmuch-show view
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-26 Thread david
From: David Bremner brem...@debian.org

Carl reports gcc -aux-info notmuch.aux lib/notmuch.h does not
generate notmuch.aux for him with Debian gcc 4.6.0-8. A small
modification of the original sed regular expression allows us to work
directly from lib/notmuch.h, rather than preprocessing with gcc.

As with most such simple regex based parsing, this is quite
sensitive to the input format, and needs that each symbol to be
exported from libnotmuch should

- start with notmuch_
- be the first non-whitespace token on the line
- be followed by an open parenthesis.
---
 lib/Makefile.local |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index a33ba34..0459fd0 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -76,9 +76,8 @@ $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) 
$(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
 
 notmuch.sym: lib/notmuch.h
-   gcc -aux-info notmuch.aux $
printf {\nglobal:\n  notmuch.sym
-   sed  -n 's/.*\(notmuch_[a-z_]*\) (.*/\t\1;/p' notmuch.aux  notmuch.sym
+   sed  -n 's/^\s*\(notmuch_[a-z_]*\)\s*(.*/\t\1;/p' $  notmuch.sym
printf local: *;\n};\n  notmuch.sym
 
 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
@@ -103,4 +102,4 @@ install-$(dir): $(dir)/$(LIBNAME)
$(LIBRARY_INSTALL_POST_COMMAND)
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.aux notmuch.sym
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.sym
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-26 Thread david
From: David Bremner brem...@debian.org

Carl reports gcc -aux-info notmuch.aux lib/notmuch.h does not
generate notmuch.aux for him with Debian gcc 4.6.0-8.

Based on a suggestion by Austin Clements, this version uses objdump to
get the symbols from the object files.

Any symbol that

- is in some object file in $(libnotmuch_modules), and
- starts with notmuch_

will be exported.
---

 Here is another way of doing this, probably better unless you are
 very attached to the idea of declaring the API in the header file.
 

 lib/Makefile.local |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index a33ba34..38913c6 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -75,10 +75,9 @@ $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
echo $(libnotmuch_modules)
$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) 
$(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
 
-notmuch.sym: lib/notmuch.h
-   gcc -aux-info notmuch.aux $
+notmuch.sym: $(libnotmuch_modules)
printf {\nglobal:\n  notmuch.sym
-   sed  -n 's/.*\(notmuch_[a-z_]*\) (.*/\t\1;/p' notmuch.aux  notmuch.sym
+   objdump -t $(libnotmuch_modules)| awk '$$4 == .text  $$6 ~ 
^notmuch {print \t$$6;}' notmuch.sym
printf local: *;\n};\n  notmuch.sym
 
 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
@@ -103,4 +102,4 @@ install-$(dir): $(dir)/$(LIBNAME)
$(LIBRARY_INSTALL_POST_COMMAND)
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.aux notmuch.sym
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) 
$(dir)$(LIBNAME) libnotmuch.a notmuch.sym
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] test: use emacs_deliver_message in Emacs SMTP send test

2011-06-26 Thread Dmitry Kurochkin
Minor changes to expected results of other Emacs tests were
needed because the message Date header changed.
---
 test/emacs |   34 +-
 1 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/test/emacs b/test/emacs
index f3239ea..4f16b41 100755
--- a/test/emacs
+++ b/test/emacs
@@ -118,28 +118,12 @@ output=$(notmuch search 'id:123..456@example' | 
notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; 
Message with .. in Message-Id (inbox search-add show-add)
 
 test_begin_subtest Sending a message via (fake) SMTP
-
-# Before we can send a message, we have to prepare the FCC maildir
-mkdir -p mail/sent/cur
-mkdir -p mail/sent/new
-mkdir -p mail/sent/tmp
-
-../smtp-dummy sent_message 
-smtp_dummy_pid=$!
-test_emacs (setq message-send-mail-function 'message-smtpmail-send-it)
-   (setq smtpmail-smtp-server \localhost\)
-   (setq smtpmail-smtp-service \25025\)
-   (notmuch-hello)
-   (notmuch-mua-mail)
-   (message-goto-to)
-   (insert \u...@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\)
-   (message-goto-subject)
-   (insert \Testing message sent via SMTP\)
-   (message-goto-body)
-   (insert \This is a test that messages are sent via SMTP\)
-   (message-send-and-exit) /dev/null 21
-wait ${smtp_dummy_pid}
-
+emacs_deliver_message \
+'Testing message sent via SMTP' \
+'This is a test that messages are sent via SMTP' \
+'(message-goto-to)
+ (kill-whole-line)
+ (insert To: u...@example.com\n)'
 sed \
 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' 
\
 -e s',^Message-ID: .*$,Message-ID: XXX,'  sent_message OUTPUT
@@ -147,7 +131,7 @@ cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: u...@example.com
 Subject: Testing message sent via SMTP
-Date: Fri, 29 Mar 1974 10:00:00 -
+Date: 01 Jan 2000 12:00:00 -
 User-Agent: Notmuch/XXX Emacs/XXX
 Message-ID: XXX
 MIME-Version: 1.0
@@ -160,7 +144,7 @@ test_expect_equal_file OUTPUT EXPECTED
 test_begin_subtest Verify that sent messages are saved/searchable (via FCC)
 notmuch new  /dev/null
 output=$(notmuch search 'subject:testing message sent via SMTP' | 
notmuch_search_sanitize)
-test_expect_equal $output thread:XXX   1974-03-29 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)
+test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)
 
 test_begin_subtest notmuch-fcc-dirs set to nil
 test_emacs (setq notmuch-fcc-dirs nil)
@@ -262,7 +246,7 @@ Subject: Re: Testing message sent via SMTP
 In-Reply-To: XXX
 Fcc: $(pwd)/mail/sent
 --text follows this line--
-On Fri, 29 Mar 1974 10:00:00 -, Notmuch Test Suite 
test_su...@notmuchmail.org wrote:
+On 01 Jan 2000 12:00:00 -, Notmuch Test Suite test_su...@notmuchmail.org 
wrote:
  This is a test that messages are sent via SMTP
 EOF
 test_expect_equal_file OUTPUT EXPECTED
-- 
1.7.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-26 Thread Dmitry Kurochkin
Before the change, every Emacs tests ran in a separate Emacs
instance.  Starting Emacs many times wastes considerable time and
it gets worse as the test suite grows.  The patch solves this by
using a single Emacs server and emacsclient(1) to run multiple
tests.  Emacs server is started on the first test_emacs call and
stopped when test_done is called or the test is killed by a
signal.  Several auxiliary scripts useful for debugging and test
development are generated instead of the run_emacs script:

  * emacs_server_start - start Emacs server
  * emacs_server_stop  - stop Emacs server
  * emacs_start- start Emacs
  * emacs_run  - execute ELisp expressions in running Emacs server

Since multiple tests are run in a single Emacs instance, they
must not change Emacs environment because it may affect other
tests.  For now, the only Emacs environment modifications done by
the tests are variable settings.  Before the change, variables
were set with `setq' which affected other tests.  The patch
changes all variables to use `let', so the scope of the change is
limited to a single test.
---
 test/emacs   |   74 +-
 test/test-lib.el |6 ++
 test/test-lib.sh |  149 ++---
 3 files changed, 161 insertions(+), 68 deletions(-)

diff --git a/test/emacs b/test/emacs
index 4f16b41..f1939dc 100755
--- a/test/emacs
+++ b/test/emacs
@@ -12,20 +12,20 @@ test_emacs '(notmuch-hello)
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
 
 test_begin_subtest Saved search with 0 results
-test_emacs '(setq notmuch-show-empty-saved-searches t)
-   (setq notmuch-saved-searches
- '\''((inbox . tag:inbox)
-  (unread . tag:unread)
-  (empty . tag:doesnotexist)))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-show-empty-saved-searches t)
+ (notmuch-saved-searches
+  '\''((inbox . tag:inbox)
+   (unread . tag:unread)
+   (empty . tag:doesnotexist
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
 
 test_begin_subtest No saved searches displayed (all with 0 results)
-test_emacs '(setq notmuch-saved-searches
- '\''((empty . tag:doesnotexist)))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-saved-searches
+  '\''((empty . tag:doesnotexist
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
 
 test_begin_subtest Basic notmuch-search view in emacs
@@ -147,9 +147,9 @@ output=$(notmuch search 'subject:testing message sent via 
SMTP' | notmuch_sear
 test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)
 
 test_begin_subtest notmuch-fcc-dirs set to nil
-test_emacs (setq notmuch-fcc-dirs nil)
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs nil))
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -164,9 +164,9 @@ mkdir -p mail/sent-string/new
 mkdir -p mail/sent-string/tmp
 
 test_begin_subtest notmuch-fcc-dirs set to a string
-test_emacs (setq notmuch-fcc-dirs \sent-string\)
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs \sent-string\))
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -185,11 +185,11 @@ mkdir -p mail/failure/new
 mkdir -p mail/failure/tmp
 
 test_begin_subtest notmuch-fcc-dirs set to a list (with match)
-test_emacs (setq notmuch-fcc-dirs
- '((\notmuchmail.org\ . \sent-list-match\)
-   (\.*\ . \failure\)))
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs
+  '((\notmuchmail.org\ . \sent-list-match\)
+(\.*\ . \failure\
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -205,11 +205,11 @@ mkdir -p mail/sent-list-catch-all/new
 mkdir -p mail/sent-list-catch-all/tmp
  
 test_begin_subtest notmuch-fcc-dirs set to a list (catch-all)
-test_emacs (setq notmuch-fcc-dirs
- '((\example.com\ . \failure\)
-   (\.*\ . \sent-list-catch-all\)))
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs
+  '((\example.com\ . \failure\)
+(\.*\ . \sent-list-catch-all\
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -220,11 +220,11 @@