comfortable-swipe/tests/run_tests
2020-04-20 19:25:33 +08:00

29 lines
497 B
Bash
Executable File

#!/bin/bash
set -e
DIR="$(dirname "$0")"
COMPILER="$(dirname "$DIR")/compile.sh"
# just call abort on error
TEMPOUT="$(mktemp)"
abort () {
rm "$tempout"
echo "Test aborted"
exit 1
}
# run all shell files in this directory
for SH in "$DIR/test_"*.sh; do
"$SH" || abort
done
# run all cpp files in this directory
for CPP in "$DIR/test_"*.cpp; do
# compile the test
"$COMPILER" "$CPP" -o "$TEMPOUT" || abort
# run the test
chmod +x "$TEMPOUT"
"$TEMPOUT"
done