aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fake_formatter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fake_formatter.sh')
-rwxr-xr-xtests/fake_formatter.sh26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/fake_formatter.sh b/tests/fake_formatter.sh
index a060a4c..75f92ff 100755
--- a/tests/fake_formatter.sh
+++ b/tests/fake_formatter.sh
@@ -2,16 +2,24 @@
set -e
-if [ -e "tests/fake_formatter_output" ]; then
- cat tests/fake_formatter_output
-else
- cat
+CODE=0
+if [ "$1" = "--fail" ]; then
+ shift
+ echo "failure" >&2
+ CODE=1
+fi
+if [ "$1" = "--timeout" ]; then
+ shift
+ echo "timeout" >&2
+ sleep 4
fi
-if [ "$1" = "--fail" ]; then
- echo "failure" >&2
- exit 1
-elif [ "$1" = "--timeout" ]; then
- sleep 4
+output_file="$1"
+
+if [ -n "$output_file" ] && [ -e "$output_file" ]; then
+ cat "$output_file"
+else
+ cat
fi
+exit $CODE