diff options
| author | Sudar <sudar@sudarmuthu.com> | 2014-09-21 12:05:12 +0530 |
|---|---|---|
| committer | Sudar <sudar@sudarmuthu.com> | 2014-09-21 12:05:12 +0530 |
| commit | ee1855c6b1aabf4d50afcfba69cecd2417d27237 (patch) | |
| tree | 05db0503f3cb1ffbd41f077ecf6135a429d5b66b /tests/script/runtests.sh | |
| parent | 6f46722abb40c60dcaa0e40292342d015906c8bf (diff) | |
| parent | d092c14d7ec845246f6588704e22718615626982 (diff) | |
Merge pull request #268 from peplin/259-move-examples
Move tests back to 'examples', skip non-testable examples when testing.
Fix #259
Fix #260
Diffstat (limited to 'tests/script/runtests.sh')
| -rwxr-xr-x | tests/script/runtests.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh new file mode 100755 index 0000000..5f513da --- /dev/null +++ b/tests/script/runtests.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +TESTS_DIR=examples + +failures=() + +# 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. +NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial) + +for dir in $TESTS_DIR/*/ +do + dir=${dir%*/} + example=${dir##*/} + 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 + + pushd $dir + echo "Compiling $example..." + make_output=`make clean` + make_output=`make` + 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 |
