tarback/test.sh

30 lines
574 B
Bash
Raw Normal View History

2023-06-07 13:21:53 +02:00
#!/bin/sh
set -eu
early_return="${TARBACK_TEST_EARLY_RETURN:-false}"
2023-06-07 13:21:53 +02:00
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"
2023-06-07 13:21:53 +02:00
echo "succeeded"
else
failed=$((failed+1))
echo "failed"
if "$early_return"; then
break
fi
2023-06-07 13:21:53 +02:00
fi
find ./tests/ -type f -size 0 -delete
2023-06-07 13:21:53 +02:00
done
if [ $failed -ne 0 ]; then
echo "$failed tests failed"
exit 1
else
echo "all succeeded"
exit 0
fi