Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

syntax_check_all.sh


#!/bin/bash

#
# syntax check benchmarks:
# uses `fz -dfa` to do a syntax check of
# 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

BENCHMARKS=$(find . -name "*.fz")
for benchmark in $BENCHMARKS; do
  fz -dfa "$benchmark" || exit 1
  echo -e "Syntax checking $benchmark: \033[32;1mPASSED\033[0m"
done

echo "It took $SECONDS seconds to syntax check all benchmarks."