]> git.notmuchmail.org Git - notmuch/blob - test/emacs-forgetfulness
e17b26fa96491c37c62da64df5526229ed0adc6d
[notmuch] / test / emacs-forgetfulness
1 #!/bin/bash
2
3 test_description=Emacs\'\ forgetfulness
4
5 . test-lib.sh
6
7 # RFC822 imposes a 998 character limit per line.
8 x=0123456789 # 10
9 x=$x$x$x$x$x$x$x$x$x$x # 100
10 x=$x$x$x$x$x$x$x$x$x # 900
11
12 # If setting this ``too high'' (TODO: yet to be determined), Emacs will crash
13 # with a segmentation fault.
14 n=20
15 for i in $(seq 1 $n); do
16   # Roughly 2 KiB per message.  That is, we need two messages in order to
17   # exceed the typical size of the pipe buffer (4 KiB on commodity systems).
18   generate_message [subject]=$i-$x [from]=$i-$x@x.x
19 done
20 # With 20 messages à 2 KiB, we have about 10 full pipe buffers, which should be
21 # enough to trigger the erroneous behavior.
22
23 notmuch new > /dev/null
24
25 test_begin_subtest 'Search for all messages'
26 output=$(exec 2>&1; \
27          diff -wu \
28            <(notmuch search \* \
29                | sed \
30                    -e 's%^thread:[0-9a-f]*\ %%' \
31                    -e 's%;%%'; \
32              echo 'End of search results.'; \
33              echo) \
34            <(test_emacs 2>&1 \
35                '(notmuch-search "*") (notmuch-test-wait) (message (buffer-string))'))
36 test_expect_equal "$output" ''
37
38 test_done