BOSL2/scripts/run_tests.sh

32 lines
790 B
Bash
Raw Normal View History

#!/bin/bash
OPENSCAD=openscad
if [ "$(uname -s)" == "Darwin" ]; then
2020-06-19 23:18:04 -07:00
OPENSCAD=/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
fi
INFILES=("$@")
if (( ${#INFILES[@]} == 0 )); then
INFILES=(tests/test_*.scad)
2020-06-30 17:18:33 -07:00
fi
2020-06-19 23:25:59 -07:00
OUTCODE=0
for testfile in "${INFILES[@]}"; do
if [[ -f "$testfile" ]] ; then
repname="$(basename "$testfile" | sed 's/^test_//')"
"${OPENSCAD}" -o out.echo --hardwarnings --check-parameters true --check-parameter-ranges true "$testfile" 2>&1
retcode=$?
output=$(cat out.echo)
if (( retcode == 0 )) && [[ "$output" = "" ]]; then
2020-06-30 17:18:33 -07:00
echo "$repname: PASS"
else
echo "$repname: FAIL!"
echo "$output"
2021-06-10 15:25:34 -07:00
OUTCODE=1
2020-06-30 17:18:33 -07:00
fi
rm -f out.echo
fi
done
exit "$OUTCODE"