tarback/test.sh

29 lines
574 B
Bash
Executable file

#!/bin/sh
set -eu
early_return="${TARBACK_TEST_EARLY_RETURN:-false}"
failed=0
for f in ./tests/test-*.sh; do
printf '%s' "Running test $f ... "
if "$f" 1>"$f.stdout.log" 2>"$f.stderr.log"; then
rm "$f.stdout.log"
rm "$f.stderr.log"
echo "succeeded"
else
failed=$((failed+1))
echo "failed"
if "$early_return"; then
break
fi
fi
find ./tests/ -type f -size 0 -delete
done
if [ $failed -ne 0 ]; then
echo "$failed tests failed"
exit 1
else
echo "all succeeded"
exit 0
fi