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