]> git.0d.be Git - empathy.git/blob - tools/test-wrapper.sh
3.12.6
[empathy.git] / tools / test-wrapper.sh
1 #!/bin/sh
2 # Make tests shut up. On success, if stdout is a tty, we only output messages
3 # about skipped tests; on failure, or if stdout is a file or pipe, we output
4 # the lot.
5 #
6 # Usage: test-wrapper.sh PROGRAM [ARGS...]
7
8 set -e
9
10 if test -t 1 && test "z$CHECK_VERBOSE" = z; then
11   :   # continue with the output-suppressed code path, below
12 else
13   "$@" || e=$?
14   exit $e
15 fi
16
17 e=0
18 "$@" > capture-$$.log 2>&1 || e=$?
19 if test z$e = z0; then
20   grep -i skipped capture-$$.log || true
21   rm -f capture-$$.log
22 else
23   cat capture-$$.log
24   exit $e
25 fi
26
27 # Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/>
28 # Copying and distribution of this file, with or without modification,
29 # are permitted in any medium without royalty provided the copyright
30 # notice and this notice are preserved. There is no warranty.