BOSL2/scripts/run_tests.sh

36 lines
824 B
Bash
Raw Normal View History

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