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