isle/tests/entrypoint.sh

46 lines
957 B
Bash
Raw Normal View History

2023-08-30 16:16:19 +00:00
set -e
2023-08-30 18:08:40 +00:00
while [[ $# -gt 0 ]]; do
case $1 in
-v|--verbose)
VERBOSE=1
shift;
;;
*)
echo "USAGE: [-v|--verbose]"
exit 1
;;
esac
done
2023-08-30 16:16:19 +00:00
# cd into script's directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
tmp="$(mktemp --tmpdir -d isle-tests.XXXXXX)"
trap 'rm -rf $tmp' EXIT
export TMPDIR="$tmp"
echo "tmp dir is $TMPDIR"
echo -e '\nrunning all tests...\n'
for file in $(find . -type f -name '*.sh' | grep -v entrypoint.sh | sort -n); do
echo "$file"
2023-08-30 18:08:40 +00:00
[ -z "$VERBOSE" ] && output="$tmp/$file.log" || output=/dev/stdout
if ! $SHELL -e -x "$file" >"$output" 2>&1; then
echo "$file FAILED"
if [ -z "$VERBOSE" ]; then
echo "output of test is as follows"
echo "------------------------------"
cat "$tmp/$file.log"
echo "------------------------------"
fi
2023-08-30 16:16:19 +00:00
exit 1
fi
done
echo -e '\ntests succeeded!'