]> git.notmuchmail.org Git - notmuch/blob - test/emacs-large-search-buffer
python: move Threads class into its own file
[notmuch] / test / emacs-large-search-buffer
1 #!/usr/bin/env bash
2 test_description="Emacs with large search results buffer"
3 . test-lib.sh
4
5 x=xxxxxxxxxx # 10
6 x=$x$x$x$x$x$x$x$x$x$x # 100
7 x=$x$x$x$x$x$x$x$x$x # 900
8
9 # We generate a long subject here (over 900 bytes) so that the emacs
10 # search results get large quickly. With 30 such messages we should
11 # cross several 4kB page boundaries and see the bug.
12 n=30
13 for i in $(seq 1 $n); do
14   # Roughly 100B2 KiB per message.  That is, we need two messages in order to
15   # exceed the typical size of the pipe buffer (4 KiB on commodity systems).
16   generate_message '[subject]="$x $i of $n"'
17 done
18
19 notmuch new > /dev/null
20
21 test_begin_subtest "Ensure that emacs doesn't drop results"
22 notmuch search '*' > EXPECTED
23 sed -i -e 's/^thread:[0-9a-f]*  //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPECTED
24 echo 'End of search results.' >> EXPECTED
25
26 test_emacs '(notmuch-search "*")
27             (notmuch-test-wait)
28             (test-output)'
29 sed -i -e s',  *, ,g' -e 's/xxx*/[BLOB]/g' OUTPUT
30 test_expect_equal_file OUTPUT EXPECTED
31
32 test_begin_subtest "Ensure that emacs doesn't drop error messages"
33 test_emacs '(notmuch-search "--this-option-does-not-exist")
34             (notmuch-test-wait)
35             (test-output)'
36 cat <<EOF >EXPECTED
37 Error: Unexpected output from notmuch search:
38 Unrecognized option: --this-option-does-not-exist
39 End of search results. (process returned 1)
40 EOF
41 test_expect_equal_file OUTPUT EXPECTED
42
43 test_done