type_check.sh
#!/bin/bash
#
# type check benchmarks, i.e.
# all *.fz files in this repository.
#
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )"
cd "$SCRIPTPATH" || exit
# we are in /somepath/benchmarks/ and want to add
# /somepath/fuzion/work/build/bin
# NYI fix the path mess, difference in production vs. development
FZ_DIR="$SCRIPTPATH/../fuzion/work/build/bin/"
export PATH="$FZ_DIR:$PATH"
if ! [ -x "$(command -v fz)" ]; then
echo 'Error: fz not found where expected. Aborting.' >&2
exit 1
fi
SECONDS=0
EXIT_CODE=0
BENCHMARKS=$(find . -name "*.fz")
for benchmark in $BENCHMARKS; do
if fz -no-backend -sourceDirs="$(dirname "$benchmark")" "$benchmark" > /dev/null 2> /dev/null ; then
echo -e "Type checking $benchmark: \033[32;1mPASSED\033[0m"
else
export EXIT_CODE=1
echo -e "Type checking $benchmark: \033[31;1mFAILED\033[0m"
fi
done
echo "It took $SECONDS seconds to type check all benchmarks."
exit $EXIT_CODE
last changed: 2023-11-14