]> git.notmuchmail.org Git - notmuch/blob - test/notmuch-test
e40ef86a8764427434957f76f5cf29dbaf7ac9ae
[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   new
23   count
24   search
25   search-output
26   search-by-folder
27   search-position-overlap-bug
28   search-insufficient-from-quoting
29   search-limiting
30   tagging
31   json
32   multipart
33   thread-naming
34   raw
35   reply
36   dump-restore
37   uuencode
38   thread-order
39   author-order
40   from-guessing
41   long-id
42   encoding
43   emacs
44   emacs-large-search-buffer
45   emacs-subject-to-filename
46   maildir-sync
47   crypto
48   symbol-hiding
49   search-folder-coherence
50   atomicity
51   python
52   hooks
53   argument-parsing
54 "
55 TESTS=${NOTMUCH_TESTS:=$TESTS}
56
57 # Clean up any results from a previous run
58 rm -r test-results >/dev/null 2>/dev/null
59
60 # test for timeout utility
61 if command -v timeout >/dev/null; then
62     TEST_TIMEOUT_CMD="timeout 2m "
63     echo "INFO: using 2 minute timeout for tests"
64 else
65     TEST_TIMEOUT_CMD=""
66 fi
67
68 trap 'e=$?; kill $!; exit $e' HUP INT TERM
69 # Run the tests
70 for test in $TESTS; do
71     $TEST_TIMEOUT_CMD ./$test "$@" &
72     wait $!
73 done
74 trap - HUP INT TERM
75
76 # Report results
77 ./aggregate-results.sh test-results/*
78
79 # Clean up
80 rm -rf test-results corpus.mail