Blame telepathy-account-widgets/tools/test-wrapper.sh

Packit 79f644
#!/bin/sh
Packit 79f644
# Make tests shut up. On success, if stdout is a tty, we only output messages
Packit 79f644
# about skipped tests; on failure, or if stdout is a file or pipe, we output
Packit 79f644
# the lot.
Packit 79f644
#
Packit 79f644
# Usage: test-wrapper.sh PROGRAM [ARGS...]
Packit 79f644
Packit 79f644
set -e
Packit 79f644
Packit 79f644
if test -t 1 && test "z$CHECK_VERBOSE" = z; then
Packit 79f644
  :   # continue with the output-suppressed code path, below
Packit 79f644
else
Packit 79f644
  "$@" || e=$?
Packit 79f644
  exit $e
Packit 79f644
fi
Packit 79f644
Packit 79f644
e=0
Packit 79f644
"$@" > capture-$$.log 2>&1 || e=$?
Packit 79f644
if test z$e = z0; then
Packit 79f644
  grep -i skipped capture-$$.log || true
Packit 79f644
  rm -f capture-$$.log
Packit 79f644
else
Packit 79f644
  cat capture-$$.log
Packit 79f644
  exit $e
Packit 79f644
fi
Packit 79f644
Packit 79f644
# Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/>
Packit 79f644
# Copying and distribution of this file, with or without modification,
Packit 79f644
# are permitted in any medium without royalty provided the copyright
Packit 79f644
# notice and this notice are preserved. There is no warranty.