From 086c6e96ca4b98e8a144b5f7f37a7b3b6fedc61d Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 20 Sep 2014 16:14:32 -0400 Subject: [PATCH 1/3] Move tests back to 'examples', skip non-testable examples when testing. This fixes https://github.com/sudar/Arduino-Makefile/issues/259. --- .../AnalogInOutSerial/AnalogInOutSerial.ino | 0 .../AnalogInOutSerial/Makefile | 0 {tests => examples}/Blink/Blink.ino | 0 {tests => examples}/Blink/Makefile | 0 .../BlinkChipKIT/BlinkChipKIT.pde | 0 {tests => examples}/BlinkChipKIT/Makefile | 0 {tests => examples}/BlinkInAVRC/Makefile | 0 {tests => examples}/BlinkInAVRC/blink.c | 0 .../BlinkWithoutDelay/BlinkWithoutDelay.ino | 0 .../BlinkWithoutDelay/Makefile | 0 {tests => examples}/Fade/Fade.ino | 0 {tests => examples}/Fade/Makefile | 0 {tests => examples}/HelloWorld/HelloWorld.ino | 0 {tests => examples}/HelloWorld/Makefile | 0 {tests => examples}/TestSuiteCommon.mk | 0 {tests => examples}/WebServer/Makefile | 0 {tests => examples}/WebServer/WebServer.ino | 0 {tests => examples}/master_reader/Makefile | 0 .../master_reader/master_reader.ino | 0 {tests => examples}/toneMelody/Makefile | 0 {tests => examples}/toneMelody/pitches.h | 0 {tests => examples}/toneMelody/toneMelody.ino | 0 script/runtests.sh | 22 ++++++++++++++++++- 23 files changed, 21 insertions(+), 1 deletion(-) rename {tests => examples}/AnalogInOutSerial/AnalogInOutSerial.ino (100%) rename {tests => examples}/AnalogInOutSerial/Makefile (100%) rename {tests => examples}/Blink/Blink.ino (100%) rename {tests => examples}/Blink/Makefile (100%) rename {tests => examples}/BlinkChipKIT/BlinkChipKIT.pde (100%) rename {tests => examples}/BlinkChipKIT/Makefile (100%) rename {tests => examples}/BlinkInAVRC/Makefile (100%) rename {tests => examples}/BlinkInAVRC/blink.c (100%) rename {tests => examples}/BlinkWithoutDelay/BlinkWithoutDelay.ino (100%) rename {tests => examples}/BlinkWithoutDelay/Makefile (100%) rename {tests => examples}/Fade/Fade.ino (100%) rename {tests => examples}/Fade/Makefile (100%) rename {tests => examples}/HelloWorld/HelloWorld.ino (100%) rename {tests => examples}/HelloWorld/Makefile (100%) rename {tests => examples}/TestSuiteCommon.mk (100%) rename {tests => examples}/WebServer/Makefile (100%) rename {tests => examples}/WebServer/WebServer.ino (100%) rename {tests => examples}/master_reader/Makefile (100%) rename {tests => examples}/master_reader/master_reader.ino (100%) rename {tests => examples}/toneMelody/Makefile (100%) rename {tests => examples}/toneMelody/pitches.h (100%) rename {tests => examples}/toneMelody/toneMelody.ino (100%) diff --git a/tests/AnalogInOutSerial/AnalogInOutSerial.ino b/examples/AnalogInOutSerial/AnalogInOutSerial.ino similarity index 100% rename from tests/AnalogInOutSerial/AnalogInOutSerial.ino rename to examples/AnalogInOutSerial/AnalogInOutSerial.ino diff --git a/tests/AnalogInOutSerial/Makefile b/examples/AnalogInOutSerial/Makefile similarity index 100% rename from tests/AnalogInOutSerial/Makefile rename to examples/AnalogInOutSerial/Makefile diff --git a/tests/Blink/Blink.ino b/examples/Blink/Blink.ino similarity index 100% rename from tests/Blink/Blink.ino rename to examples/Blink/Blink.ino diff --git a/tests/Blink/Makefile b/examples/Blink/Makefile similarity index 100% rename from tests/Blink/Makefile rename to examples/Blink/Makefile diff --git a/tests/BlinkChipKIT/BlinkChipKIT.pde b/examples/BlinkChipKIT/BlinkChipKIT.pde similarity index 100% rename from tests/BlinkChipKIT/BlinkChipKIT.pde rename to examples/BlinkChipKIT/BlinkChipKIT.pde diff --git a/tests/BlinkChipKIT/Makefile b/examples/BlinkChipKIT/Makefile similarity index 100% rename from tests/BlinkChipKIT/Makefile rename to examples/BlinkChipKIT/Makefile diff --git a/tests/BlinkInAVRC/Makefile b/examples/BlinkInAVRC/Makefile similarity index 100% rename from tests/BlinkInAVRC/Makefile rename to examples/BlinkInAVRC/Makefile diff --git a/tests/BlinkInAVRC/blink.c b/examples/BlinkInAVRC/blink.c similarity index 100% rename from tests/BlinkInAVRC/blink.c rename to examples/BlinkInAVRC/blink.c diff --git a/tests/BlinkWithoutDelay/BlinkWithoutDelay.ino b/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino similarity index 100% rename from tests/BlinkWithoutDelay/BlinkWithoutDelay.ino rename to examples/BlinkWithoutDelay/BlinkWithoutDelay.ino diff --git a/tests/BlinkWithoutDelay/Makefile b/examples/BlinkWithoutDelay/Makefile similarity index 100% rename from tests/BlinkWithoutDelay/Makefile rename to examples/BlinkWithoutDelay/Makefile diff --git a/tests/Fade/Fade.ino b/examples/Fade/Fade.ino similarity index 100% rename from tests/Fade/Fade.ino rename to examples/Fade/Fade.ino diff --git a/tests/Fade/Makefile b/examples/Fade/Makefile similarity index 100% rename from tests/Fade/Makefile rename to examples/Fade/Makefile diff --git a/tests/HelloWorld/HelloWorld.ino b/examples/HelloWorld/HelloWorld.ino similarity index 100% rename from tests/HelloWorld/HelloWorld.ino rename to examples/HelloWorld/HelloWorld.ino diff --git a/tests/HelloWorld/Makefile b/examples/HelloWorld/Makefile similarity index 100% rename from tests/HelloWorld/Makefile rename to examples/HelloWorld/Makefile diff --git a/tests/TestSuiteCommon.mk b/examples/TestSuiteCommon.mk similarity index 100% rename from tests/TestSuiteCommon.mk rename to examples/TestSuiteCommon.mk diff --git a/tests/WebServer/Makefile b/examples/WebServer/Makefile similarity index 100% rename from tests/WebServer/Makefile rename to examples/WebServer/Makefile diff --git a/tests/WebServer/WebServer.ino b/examples/WebServer/WebServer.ino similarity index 100% rename from tests/WebServer/WebServer.ino rename to examples/WebServer/WebServer.ino diff --git a/tests/master_reader/Makefile b/examples/master_reader/Makefile similarity index 100% rename from tests/master_reader/Makefile rename to examples/master_reader/Makefile diff --git a/tests/master_reader/master_reader.ino b/examples/master_reader/master_reader.ino similarity index 100% rename from tests/master_reader/master_reader.ino rename to examples/master_reader/master_reader.ino diff --git a/tests/toneMelody/Makefile b/examples/toneMelody/Makefile similarity index 100% rename from tests/toneMelody/Makefile rename to examples/toneMelody/Makefile diff --git a/tests/toneMelody/pitches.h b/examples/toneMelody/pitches.h similarity index 100% rename from tests/toneMelody/pitches.h rename to examples/toneMelody/pitches.h diff --git a/tests/toneMelody/toneMelody.ino b/examples/toneMelody/toneMelody.ino similarity index 100% rename from tests/toneMelody/toneMelody.ino rename to examples/toneMelody/toneMelody.ino diff --git a/script/runtests.sh b/script/runtests.sh index ad42f74..5f513da 100755 --- a/script/runtests.sh +++ b/script/runtests.sh @@ -1,11 +1,31 @@ #!/usr/bin/env bash +TESTS_DIR=examples + failures=() -for dir in tests/*/ +# 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` From 663626f06d79aa4d3d3b17e0391897c852658a28 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 20 Sep 2014 16:26:08 -0400 Subject: [PATCH 2/3] Move scripts inside tests directory. Fixed https://github.com/sudar/Arduino-Makefile/issues/260 --- .travis.yml | 4 ++-- README.md | 9 ++++++--- examples/TestSuiteCommon.mk | 2 +- {script => tests/script}/bootstrap.sh | 0 {script => tests/script}/bootstrap/arduino.sh | 0 {script => tests/script}/bootstrap/chipkit.sh | 0 {script => tests/script}/bootstrap/common.sh | 2 +- {script => tests/script}/bootstrap/pip-requirements.txt | 0 {script => tests/script}/runtests.sh | 0 9 files changed, 10 insertions(+), 7 deletions(-) rename {script => tests/script}/bootstrap.sh (100%) rename {script => tests/script}/bootstrap/arduino.sh (100%) rename {script => tests/script}/bootstrap/chipkit.sh (100%) rename {script => tests/script}/bootstrap/common.sh (98%) rename {script => tests/script}/bootstrap/pip-requirements.txt (100%) rename {script => tests/script}/runtests.sh (100%) diff --git a/.travis.yml b/.travis.yml index 68efeb5..f97a4ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: c compiler: - gcc -script: script/runtests.sh -before_install: script/bootstrap.sh +script: tests/script/runtests.sh +before_install: tests/script/bootstrap.sh diff --git a/README.md b/README.md index b929f6c..a5f1cff 100644 --- a/README.md +++ b/README.md @@ -215,9 +215,12 @@ Then, the following line must be added to the project Makefile : ## Test Suite 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 -automatically install the dependencies (Arduino IDE, MPIDE, etc.). Run -`script/runtests.sh` to attempt to compile all of the examples. +programs to assist the maintainers of the Makefile. Run +`tests/script/bootstrap.sh` to attempt to automatically install the dependencies +(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 diff --git a/examples/TestSuiteCommon.mk b/examples/TestSuiteCommon.mk index 5fa4f50..a66a007 100644 --- a/examples/TestSuiteCommon.mk +++ b/examples/TestSuiteCommon.mk @@ -1,5 +1,5 @@ ARDMK_DIR=../../ -DEPENDENCIES_FOLDER = ../../dependencies +DEPENDENCIES_FOLDER = /var/tmp/Arduino-Makefile-testing-dependencies DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide-0023-linux64-20130817-test ifeq ($(MPIDE_DIR),) diff --git a/script/bootstrap.sh b/tests/script/bootstrap.sh similarity index 100% rename from script/bootstrap.sh rename to tests/script/bootstrap.sh diff --git a/script/bootstrap/arduino.sh b/tests/script/bootstrap/arduino.sh similarity index 100% rename from script/bootstrap/arduino.sh rename to tests/script/bootstrap/arduino.sh diff --git a/script/bootstrap/chipkit.sh b/tests/script/bootstrap/chipkit.sh similarity index 100% rename from script/bootstrap/chipkit.sh rename to tests/script/bootstrap/chipkit.sh diff --git a/script/bootstrap/common.sh b/tests/script/bootstrap/common.sh similarity index 98% rename from script/bootstrap/common.sh rename to tests/script/bootstrap/common.sh index 695d6b7..a6b6415 100644 --- a/script/bootstrap/common.sh +++ b/tests/script/bootstrap/common.sh @@ -132,7 +132,7 @@ if [ -z $COMMON_SOURCED ]; then echo "Storing all downloaded dependencies in the \"dependencies\" folder" - DEPENDENCIES_FOLDER="dependencies" + DEPENDENCIES_FOLDER="/var/tmp/Arduino-Makefile-testing-dependencies" mkdir -p $DEPENDENCIES_FOLDER if ! command -v make >/dev/null 2>&1; then diff --git a/script/bootstrap/pip-requirements.txt b/tests/script/bootstrap/pip-requirements.txt similarity index 100% rename from script/bootstrap/pip-requirements.txt rename to tests/script/bootstrap/pip-requirements.txt diff --git a/script/runtests.sh b/tests/script/runtests.sh similarity index 100% rename from script/runtests.sh rename to tests/script/runtests.sh From d092c14d7ec845246f6588704e22718615626982 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 20 Sep 2014 16:29:12 -0400 Subject: [PATCH 3/3] Remove old dependencies dir from .gitignore, now stored in /var/tmp. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a0d6d59..2fa5764 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.o build-cli /.project -/dependencies build-*