#!/bin/sh
export QT_QPA_PLATFORM=offscreen
fails=0
count=0
for f in "$@"; do
  test -f "${f}" || continue
  echo "===================== ${f} ==================="
  count=$((count+1))
  ret=0
  sclang "${f}"
  ret=$?
  if [ "${ret}" != 0 ]; then
    echo "FAILED: ${f}" 1>&2
    fails=$((fails+1))
  fi
done

if [ "${fails}" -gt 0 ]; then
  echo  "${fails}/${count} tests failed!" 1>&2
  exit 1
fi
