Merge pull request #268 from peplin/259-move-examples
Move tests back to 'examples', skip non-testable examples when testing. Fix #259 Fix #260
This commit is contained in:
commit
ee1855c6b1
32 changed files with 58 additions and 36 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
||||||
*.o
|
*.o
|
||||||
build-cli
|
build-cli
|
||||||
/.project
|
/.project
|
||||||
/dependencies
|
|
||||||
build-*
|
build-*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
language: c
|
language: c
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
script: script/runtests.sh
|
script: tests/script/runtests.sh
|
||||||
before_install: script/bootstrap.sh
|
before_install: tests/script/bootstrap.sh
|
||||||
|
|
|
@ -215,9 +215,12 @@ Then, the following line must be added to the project Makefile :
|
||||||
## Test Suite
|
## Test Suite
|
||||||
|
|
||||||
This project includes a suite of example Makefiles and small Arduino and chipKIT
|
This project includes a suite of example Makefiles and small Arduino and chipKIT
|
||||||
programs to assist the developers. Run `script/bootstrap.sh` to attempt to
|
programs to assist the maintainers of the Makefile. Run
|
||||||
automatically install the dependencies (Arduino IDE, MPIDE, etc.). Run
|
`tests/script/bootstrap.sh` to attempt to automatically install the dependencies
|
||||||
`script/runtests.sh` to attempt to compile all of the examples.
|
(Arduino IDE, MPIDE, etc.). Run `tests/script/runtests.sh` to attempt to compile
|
||||||
|
all of the examples. The bootstrap script is primarily intended for use by a
|
||||||
|
continuous integration server, specifically Travis CI. It is not intended for
|
||||||
|
normal users.
|
||||||
|
|
||||||
### Bare-Arduino–Project
|
### Bare-Arduino–Project
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
ARDMK_DIR=../../
|
ARDMK_DIR=../../
|
||||||
DEPENDENCIES_FOLDER = ../../dependencies
|
DEPENDENCIES_FOLDER = /var/tmp/Arduino-Makefile-testing-dependencies
|
||||||
DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide-0023-linux64-20130817-test
|
DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide-0023-linux64-20130817-test
|
||||||
|
|
||||||
ifeq ($(MPIDE_DIR),)
|
ifeq ($(MPIDE_DIR),)
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
failures=()
|
|
||||||
|
|
||||||
for dir in tests/*/
|
|
||||||
do
|
|
||||||
dir=${dir%*/}
|
|
||||||
example=${dir##*/}
|
|
||||||
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
|
|
|
@ -132,7 +132,7 @@ if [ -z $COMMON_SOURCED ]; then
|
||||||
|
|
||||||
echo "Storing all downloaded dependencies in the \"dependencies\" folder"
|
echo "Storing all downloaded dependencies in the \"dependencies\" folder"
|
||||||
|
|
||||||
DEPENDENCIES_FOLDER="dependencies"
|
DEPENDENCIES_FOLDER="/var/tmp/Arduino-Makefile-testing-dependencies"
|
||||||
mkdir -p $DEPENDENCIES_FOLDER
|
mkdir -p $DEPENDENCIES_FOLDER
|
||||||
|
|
||||||
if ! command -v make >/dev/null 2>&1; then
|
if ! command -v make >/dev/null 2>&1; then
|
48
tests/script/runtests.sh
Executable file
48
tests/script/runtests.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue