mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 11:19:44 +00:00
0666f6482c
* Fixed ShellCheck.net warnings, including * exit -1: https://github.com/koalaman/shellcheck/wiki/SC2242 * cd || exit: https://github.com/koalaman/shellcheck/wiki/SC2164 * "$foo": https://github.com/koalaman/shellcheck/wiki/SC2086 * $(( $foo )): https://github.com/koalaman/shellcheck/wiki/SC2004 * grep | wc -l: https://github.com/koalaman/shellcheck/wiki/SC2126 * Use arrays instead of unquoted strings for loops and command arguments * Use (( ... )) arithmetic context instead of string comparisons * Use bash's built-in regex support instead of grep+sed+awk * Write errors to stderr
31 lines
799 B
Bash
Executable file
31 lines
799 B
Bash
Executable file
#!/bin/bash
|
|
|
|
OPENSCAD=openscad
|
|
if [ "$(uname -s)" == "Darwin" ]; then
|
|
OPENSCAD=/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
|
|
fi
|
|
|
|
INFILES=("$@")
|
|
if (( ${#INFILES[@]} == 0 )); then
|
|
INFILES=(tests/test_*.scad)
|
|
fi
|
|
|
|
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
|
|
echo "$repname: PASS"
|
|
else
|
|
echo "$repname: FAIL!"
|
|
echo "$output"
|
|
OUTCODE="$retcode"
|
|
fi
|
|
rm -f out.echo
|
|
fi
|
|
done
|
|
exit "$OUTCODE"
|
|
|