]> git.notmuchmail.org Git - notmuch/blob - test/notmuch-test
test: Add compact test
[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   compact
23   config
24   setup
25   new
26   count
27   insert
28   search
29   search-output
30   search-by-folder
31   search-position-overlap-bug
32   search-insufficient-from-quoting
33   search-limiting
34   excludes
35   tagging
36   json
37   sexp
38   text
39   multipart
40   thread-naming
41   raw
42   reply
43   reply-to-sender
44   dump-restore
45   uuencode
46   thread-order
47   author-order
48   from-guessing
49   long-id
50   encoding
51   emacs
52   emacs-large-search-buffer
53   emacs-subject-to-filename
54   maildir-sync
55   crypto
56   symbol-hiding
57   search-folder-coherence
58   atomicity
59   python
60   hooks
61   argument-parsing
62   emacs-test-functions
63   emacs-address-cleaning
64   emacs-hello
65   emacs-show
66   missing-headers
67   hex-escaping
68   parse-time-string
69   search-date
70   thread-replies
71 "
72 TESTS=${NOTMUCH_TESTS:=$TESTS}
73
74 # Clean up any results from a previous run
75 rm -r test-results >/dev/null 2>/dev/null
76
77 # test for timeout utility
78 if command -v timeout >/dev/null; then
79     TEST_TIMEOUT_CMD="timeout 2m "
80     echo "INFO: using 2 minute timeout for tests"
81 else
82     TEST_TIMEOUT_CMD=""
83 fi
84
85 trap 'e=$?; kill $!; exit $e' HUP INT TERM
86 # Run the tests
87 for test in $TESTS; do
88     $TEST_TIMEOUT_CMD ./$test "$@" &
89     wait $!
90     # If the test failed without producing results, then it aborted,
91     # so we should abort, too.
92     RES=$?
93     if [[ $RES != 0 && ! -e "test-results/${test%.sh}" ]]; then
94         exit $RES
95     fi
96 done
97 trap - HUP INT TERM
98
99 # Report results
100 ./aggregate-results.sh test-results/*
101 ev=$?
102
103 # Clean up
104 rm -rf test-results corpus.mail
105
106 exit $ev