]> git.notmuchmail.org Git - notmuch/blob - test/notmuch-test
lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()
[notmuch] / test / notmuch-test
1 #!/usr/bin/env bash
2
3 # Run tests
4 #
5 # Copyright (c) 2005 Junio C Hamano
6 #
7 # Adapted from a Makefile to a shell script by Carl Worth (2010)
8
9 if [ ${BASH_VERSINFO[0]} -lt 4 ]; then
10     echo "Error: The notmuch test suite requires a bash version >= 4.0"
11     echo "due to use of associative arrays within the test suite."
12     echo "Please try again with a newer bash (or help us fix the"
13     echo "test suite to be more portable). Thanks."
14     exit 1
15 fi
16
17 cd $(dirname "$0")
18
19 TESTS="
20   basic
21   help-test
22   config
23   setup
24   new
25   count
26   insert
27   search
28   search-output
29   search-by-folder
30   search-position-overlap-bug
31   search-insufficient-from-quoting
32   search-limiting
33   excludes
34   tagging
35   json
36   sexp
37   text
38   multipart
39   thread-naming
40   raw
41   reply
42   reply-to-sender
43   dump-restore
44   uuencode
45   thread-order
46   author-order
47   from-guessing
48   long-id
49   encoding
50   emacs
51   emacs-large-search-buffer
52   emacs-subject-to-filename
53   maildir-sync
54   crypto
55   symbol-hiding
56   search-folder-coherence
57   atomicity
58   python
59   hooks
60   argument-parsing
61   emacs-test-functions
62   emacs-address-cleaning
63   emacs-hello
64   emacs-show
65   missing-headers
66   hex-escaping
67   parse-time-string
68   search-date
69   thread-replies
70 "
71 TESTS=${NOTMUCH_TESTS:=$TESTS}
72
73 # Clean up any results from a previous run
74 rm -r test-results >/dev/null 2>/dev/null
75
76 # test for timeout utility
77 if command -v timeout >/dev/null; then
78     TEST_TIMEOUT_CMD="timeout 2m "
79     echo "INFO: using 2 minute timeout for tests"
80 else
81     TEST_TIMEOUT_CMD=""
82 fi
83
84 trap 'e=$?; kill $!; exit $e' HUP INT TERM
85 # Run the tests
86 for test in $TESTS; do
87     $TEST_TIMEOUT_CMD ./$test "$@" &
88     wait $!
89     # If the test failed without producing results, then it aborted,
90     # so we should abort, too.
91     RES=$?
92     if [[ $RES != 0 && ! -e "test-results/${test%.sh}" ]]; then
93         exit $RES
94     fi
95 done
96 trap - HUP INT TERM
97
98 # Report results
99 ./aggregate-results.sh test-results/*
100 ev=$?
101
102 # Clean up
103 rm -rf test-results corpus.mail
104
105 exit $ev