2019-05-16 04:07:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-05-21 07:46:17 +00:00
|
|
|
OPENSCAD=openscad
|
|
|
|
if [ "$(uname -s)" == "Darwin" ]; then
|
2020-06-20 06:18:04 +00:00
|
|
|
OPENSCAD=/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
|
|
|
|
fi
|
2019-05-16 04:07:27 +00:00
|
|
|
|
2021-05-21 07:46:17 +00:00
|
|
|
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
|
2021-05-21 07:46:17 +00:00
|
|
|
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
|
2020-12-16 21:46:23 +00:00
|
|
|
retcode=$?
|
2021-05-21 07:46:17 +00:00
|
|
|
output=$(cat out.echo)
|
|
|
|
if (( retcode == 0 )) && [[ "$output" = "" ]]; then
|
2020-07-01 00:18:33 +00:00
|
|
|
echo "$repname: PASS"
|
|
|
|
else
|
|
|
|
echo "$repname: FAIL!"
|
2021-05-21 07:46:17 +00:00
|
|
|
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
|
2019-11-06 01:31:58 +00:00
|
|
|
fi
|
2019-05-16 04:07:27 +00:00
|
|
|
done
|
2021-05-21 07:46:17 +00:00
|
|
|
exit "$OUTCODE"
|
2019-05-16 04:07:27 +00:00
|
|
|
|