]> git.notmuchmail.org Git - notmuch/blob - test/T320-emacs-large-search-buffer.sh
lib/database: delete stemmer on destroy
[notmuch] / test / T320-emacs-large-search-buffer.sh
1 #!/usr/bin/env bash
2 test_description="Emacs with large search results buffer"
3 . $(dirname "$0")/test-lib.sh || exit 1
4 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
5
6 x=xxxxxxxxxx # 10
7 x=$x$x$x$x$x$x$x$x$x$x # 100
8 x=$x$x$x$x$x$x$x$x$x # 900
9
10 test_require_emacs
11
12 # We generate a long subject here (over 900 bytes) so that the emacs
13 # search results get large quickly. With 30 such messages we should
14 # cross several 4kB page boundaries and see the bug.
15 n=30
16 for i in $(seq 1 $n); do
17   # Roughly 100B2 KiB per message.  That is, we need two messages in order to
18   # exceed the typical size of the pipe buffer (4 KiB on commodity systems).
19   generate_message '[subject]="$x $i of $n"'
20 done
21
22 notmuch new > /dev/null
23
24 test_begin_subtest "Ensure that emacs doesn't drop results"
25 notmuch search '*' > EXPECTED
26 sed -i -e 's/^thread:[0-9a-f]*  //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPECTED
27 echo 'End of search results.' >> EXPECTED
28
29 test_emacs '(notmuch-search "*")
30             (notmuch-test-wait)
31             (test-output)'
32 sed -i -e s',  *, ,g' -e 's/xxx*/[BLOB]/g' OUTPUT
33 test_expect_equal_file EXPECTED OUTPUT
34
35 test_done