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
|
2023-08-31 20:07:36 +00:00
|
|
|
root=$(pwd)
|
2023-08-30 16:16:19 +00:00
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
TMPDIR="$(mktemp --tmpdir -d isle-tests.XXXXXX)"
|
|
|
|
trap 'rm -rf $TMPDIR' EXIT
|
2023-08-30 16:16:19 +00:00
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
export TMPDIR
|
2023-08-30 16:16:19 +00:00
|
|
|
echo "tmp dir is $TMPDIR"
|
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
test_files=$(
|
|
|
|
find . -type f -name '*.sh' \
|
|
|
|
| sed "s|^\./||" \
|
|
|
|
| grep -v entrypoint.sh \
|
|
|
|
| sort -n\
|
|
|
|
)
|
2023-08-30 16:16:19 +00:00
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
echo -e "number of tests: $(echo "$test_files" | wc -l)\n"
|
|
|
|
for file in $test_files; do
|
2023-08-31 19:46:56 +00:00
|
|
|
echo "$file"
|
2023-08-30 18:08:40 +00:00
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
[ -z "$VERBOSE" ] && output="$TMPDIR/$file.log" || output=/dev/stdout
|
2023-08-30 18:08:40 +00:00
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
tmp="$TMPDIR/$file.tmp"
|
|
|
|
mkdir -p "$tmp"
|
|
|
|
|
|
|
|
if ! (cd "$tmp" && TMPDIR="$tmp" $SHELL -e -x "$root/$file" >"$output" 2>&1); then
|
2023-08-31 19:46:56 +00:00
|
|
|
echo "$file FAILED"
|
|
|
|
if [ -z "$VERBOSE" ]; then
|
|
|
|
echo "output of test is as follows"
|
|
|
|
echo "------------------------------"
|
2023-08-31 20:07:36 +00:00
|
|
|
cat "$TMPDIR/$file.log"
|
2023-08-31 19:46:56 +00:00
|
|
|
echo "------------------------------"
|
|
|
|
fi
|
2023-08-30 16:16:19 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-08-31 20:07:36 +00:00
|
|
|
echo -e '\nall tests succeeded!'
|
2023-08-30 16:16:19 +00:00
|
|
|
|