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-20 06:18:04 +00:00
OPENSCAD=/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
fi
INFILES=("$@")
if (( ${#INFILES[@]} == 0 )); then
INFILES=(tests/test_*.scad)
2020-07-01 00:18:33 +00:00
fi
2020-06-20 06:25:59 +00: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-07-01 00:18:33 +00:00
echo "$repname: PASS"
else
echo "$repname: FAIL!"
echo "$output"
2021-06-10 22:25:34 +00:00
OUTCODE=1
2020-07-01 00:18:33 +00:00
fi
rm -f out.echo
fi
done
exit "$OUTCODE"