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