]> git.notmuchmail.org Git - notmuch/blob - test/notmuch-test
cc732c3c731ea3988ba20e97393f0490f3d45d28
[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 "
64 TESTS=${NOTMUCH_TESTS:=$TESTS}
65
66 # Clean up any results from a previous run
67 rm -r test-results >/dev/null 2>/dev/null
68
69 # test for timeout utility
70 if command -v timeout >/dev/null; then
71     TEST_TIMEOUT_CMD="timeout 2m "
72     echo "INFO: using 2 minute timeout for tests"
73 else
74     TEST_TIMEOUT_CMD=""
75 fi
76
77 trap 'e=$?; kill $!; exit $e' HUP INT TERM
78 # Run the tests
79 for test in $TESTS; do
80     $TEST_TIMEOUT_CMD ./$test "$@" &
81     wait $!
82 done
83 trap - HUP INT TERM
84
85 # Report results
86 ./aggregate-results.sh test-results/*
87
88 # Clean up
89 rm -rf test-results corpus.mail