aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fake_formatter.sh
blob: 75f92ff3957d2dd5d81f9faab137cc11be4c3935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

set -e

CODE=0
if [ "$1" = "--fail" ]; then
  shift
  echo "failure" >&2
  CODE=1
fi
if [ "$1" = "--timeout" ]; then
  shift
  echo "timeout" >&2
  sleep 4
fi

output_file="$1"

if [ -n "$output_file" ] && [ -e "$output_file" ]; then
  cat "$output_file"
else
  cat
fi

exit $CODE