2014-09-10 05:09:35 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2014-09-20 22:14:32 +02:00
|
|
|
TESTS_DIR=examples
|
|
|
|
|
2014-09-10 05:09:35 +02:00
|
|
|
failures=()
|
|
|
|
|
2014-09-20 22:14:32 +02:00
|
|
|
# These examples cannot be tested easily at the moment as they require
|
|
|
|
# alternate cores. The MakefileExample doesn't actually contain any source code
|
|
|
|
# to compile.
|
2014-12-29 00:05:50 +01:00
|
|
|
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkTeensy BlinkNetworkRPi)
|
2014-09-20 22:14:32 +02:00
|
|
|
|
|
|
|
for dir in $TESTS_DIR/*/
|
2014-09-10 05:09:35 +02:00
|
|
|
do
|
|
|
|
dir=${dir%*/}
|
|
|
|
example=${dir##*/}
|
2014-09-20 22:14:32 +02:00
|
|
|
example_is_testable=true
|
|
|
|
for non_testable_example in "${NON_TESTABLE_EXAMPLES[@]}"; do
|
|
|
|
if [[ $example == $non_testable_example ]]; then
|
|
|
|
example_is_testable=false
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if ! $example_is_testable; then
|
|
|
|
echo "Skipping non-testable example $example..."
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2014-09-10 05:09:35 +02:00
|
|
|
pushd $dir
|
|
|
|
echo "Compiling $example..."
|
2014-09-21 19:23:06 +02:00
|
|
|
make_output=`make clean TEST=1`
|
|
|
|
make_output=`make TEST=1`
|
2014-09-10 05:09:35 +02:00
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
failures+=("$example")
|
|
|
|
echo "Example $example failed"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
done
|
|
|
|
|
|
|
|
for failure in "${failures[@]}"; do
|
|
|
|
echo "Example $failure failed"
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ${#failures[@]} -eq 0 ]]; then
|
|
|
|
echo "All tests passed."
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|