From c86ce093ce93eb8da1136acd1e81973ef0bb54fc Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Tue, 9 Sep 2014 23:09:35 -0400 Subject: [PATCH 01/11] Add a script to compile examples as an automated test suite. * Added script/boostrap.sh to download the Arduino IDE and MPIDE (for chipKIT). Tested in Linux, should work in Cygwin and OS X too. * Added script/runtests.sh to run "make" in each example project and collect the results. The script returns -1 if any fails. * Moved currently testable examples to a "tests" directory, separate from examples that require alternative cores. --- .gitignore | 2 + README.md | 7 + examples/ATtinyBlink/Makefile | 2 +- examples/README.md | 10 +- examples/TinySoftWareSerial/Makefile | 1 + examples/toneMelody/Makefile | 4 - script/bootstrap.sh | 9 + script/bootstrap/arduino.sh | 44 ++++ script/bootstrap/chipkit.sh | 61 ++++++ script/bootstrap/common.sh | 191 ++++++++++++++++++ script/bootstrap/pip-requirements.txt | 1 + script/runtests.sh | 28 +++ .../AnalogInOutSerial/AnalogInOutSerial.ino | 0 .../AnalogInOutSerial/Makefile | 1 + {examples => tests}/Blink/Blink.ino | 0 {examples => tests}/Blink/Makefile | 1 + .../BlinkChipKIT/BlinkChipKIT.pde | 0 {examples => tests}/BlinkChipKIT/Makefile | 1 + {examples => tests}/BlinkInAVRC/Makefile | 1 + {examples => tests}/BlinkInAVRC/blink.c | 0 .../BlinkWithoutDelay/BlinkWithoutDelay.ino | 0 .../Fade => tests/BlinkWithoutDelay}/Makefile | 1 + {examples => tests}/Fade/Fade.ino | 0 .../BlinkWithoutDelay => tests/Fade}/Makefile | 1 + {examples => tests}/HelloWorld/HelloWorld.ino | 0 {examples => tests}/HelloWorld/Makefile | 1 + tests/TestSuiteCommon.mk | 13 ++ {examples => tests}/WebServer/Makefile | 1 + {examples => tests}/WebServer/WebServer.ino | 0 {examples => tests}/master_reader/Makefile | 1 + .../master_reader/master_reader.ino | 0 tests/toneMelody/Makefile | 5 + {examples => tests}/toneMelody/pitches.h | 0 {examples => tests}/toneMelody/toneMelody.ino | 0 34 files changed, 379 insertions(+), 8 deletions(-) delete mode 100644 examples/toneMelody/Makefile create mode 100755 script/bootstrap.sh create mode 100644 script/bootstrap/arduino.sh create mode 100644 script/bootstrap/chipkit.sh create mode 100644 script/bootstrap/common.sh create mode 100644 script/bootstrap/pip-requirements.txt create mode 100755 script/runtests.sh rename {examples => tests}/AnalogInOutSerial/AnalogInOutSerial.ino (100%) rename {examples => tests}/AnalogInOutSerial/Makefile (66%) rename {examples => tests}/Blink/Blink.ino (100%) rename {examples => tests}/Blink/Makefile (67%) rename {examples => tests}/BlinkChipKIT/BlinkChipKIT.pde (100%) rename {examples => tests}/BlinkChipKIT/Makefile (69%) rename {examples => tests}/BlinkInAVRC/Makefile (92%) rename {examples => tests}/BlinkInAVRC/blink.c (100%) rename {examples => tests}/BlinkWithoutDelay/BlinkWithoutDelay.ino (100%) rename {examples/Fade => tests/BlinkWithoutDelay}/Makefile (66%) rename {examples => tests}/Fade/Fade.ino (100%) rename {examples/BlinkWithoutDelay => tests/Fade}/Makefile (66%) rename {examples => tests}/HelloWorld/HelloWorld.ino (100%) rename {examples => tests}/HelloWorld/Makefile (71%) create mode 100644 tests/TestSuiteCommon.mk rename {examples => tests}/WebServer/Makefile (82%) rename {examples => tests}/WebServer/WebServer.ino (100%) rename {examples => tests}/master_reader/Makefile (82%) rename {examples => tests}/master_reader/master_reader.ino (100%) create mode 100644 tests/toneMelody/Makefile rename {examples => tests}/toneMelody/pitches.h (100%) rename {examples => tests}/toneMelody/toneMelody.ino (100%) diff --git a/.gitignore b/.gitignore index 06cff06..a0d6d59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.o build-cli /.project +/dependencies +build-* diff --git a/README.md b/README.md index 50785b0..5b24604 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,13 @@ Then, the following line must be added to the project Makefile : $(CXX_NAME) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES) ``` +## 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. + ### Bare-Arduino–Project If you are planning on using this makefile in a larger/professional project, you might want to take a look at the [Bare-Arduino–Project](https://github.com/WeAreLeka/Bare-Arduino-Project) framework. diff --git a/examples/ATtinyBlink/Makefile b/examples/ATtinyBlink/Makefile index a89de1c..b4e49be 100644 --- a/examples/ATtinyBlink/Makefile +++ b/examples/ATtinyBlink/Makefile @@ -1,6 +1,6 @@ # Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile -# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone. +# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone. ALTERNATE_CORE = attiny # If not, you might have to include the full path. #ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/ diff --git a/examples/README.md b/examples/README.md index b170cdc..39425b3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,7 +1,11 @@ -This folder contains the list of example Arduino sketches and makefile showing the different usage patterns +This folder contains the list of example Arduino sketches and makefile showing +the different usage patterns + +- BlinkInAVRC - Shows how to use plain AVR C code +- ATtinyBlink - Shows how to use different cores like ATtiny + +These three examples are a step back, in the "tests" directory. - Blink - Shows normal usage - HelloWorld - Shows how to include Arduino libraries -- BlinkInAVRC - Shows how to use plain AVR C code - BlinkChipKIT - Shows how to use ChipKIT -- ATtinyBlink - Shows how to use different cores like ATtiny diff --git a/examples/TinySoftWareSerial/Makefile b/examples/TinySoftWareSerial/Makefile index 08f918d..991e57e 100644 --- a/examples/TinySoftWareSerial/Makefile +++ b/examples/TinySoftWareSerial/Makefile @@ -9,6 +9,7 @@ BOARD_TAG = attiny85-8 ARDUINO_LIBS = SoftwareSerial +include ../TestSuiteCommon.mk include $(ARDMK_DIR)/Arduino.mk # !!! Important. You have to use make ispload to upload when using ISP programmer diff --git a/examples/toneMelody/Makefile b/examples/toneMelody/Makefile deleted file mode 100644 index 3dea6c0..0000000 --- a/examples/toneMelody/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -BOARD_TAG = uno -ARDUINO_LIBS = - -include ../../Arduino.mk diff --git a/script/bootstrap.sh b/script/bootstrap.sh new file mode 100755 index 0000000..083bf5d --- /dev/null +++ b/script/bootstrap.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +pushd $SCRIPTS_DIR/.. + +source $SCRIPTS_DIR/bootstrap/chipkit.sh +source $SCRIPTS_DIR/bootstrap/arduino.sh diff --git a/script/bootstrap/arduino.sh b/script/bootstrap/arduino.sh new file mode 100644 index 0000000..3c7e9d7 --- /dev/null +++ b/script/bootstrap/arduino.sh @@ -0,0 +1,44 @@ +set -e +BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $BOOTSTRAP_DIR/common.sh + +echo "Installing dependencies for building for the Arduino" + +if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then + + echo "Installing Arduino..." + + ARDUINO_BASENAME="arduino-1.0.5" + if [ $OS == "cygwin" ]; then + ARDUINO_FILE="$ARDUINO_BASENAME-r2-windows".zip + EXTRACT_COMMAND="unzip -q" + elif [ $OS == "mac" ]; then + ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip + EXTRACT_COMMAND="unzip -q" + else + ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tgz + EXTRACT_COMMAND="tar -xzf" + fi + + ARDUINO_URL=http://arduino.googlecode.com/files/$ARDUINO_FILE + + _pushd $DEPENDENCIES_FOLDER + if ! test -e $ARDUINO_FILE + then + echo "Downloading Arduino IDE..." + download $ARDUINO_URL $ARDUINO_FILE + fi + + if ! test -d $ARDUINO_BASENAME + then + echo "Installing Arduino to local folder..." + $EXTRACT_COMMAND $ARDUINO_FILE + echo "Arduino installed" + fi + + _popd + +fi + +echo +echo "${bldgreen}Arduino dependencies installed.$txtrst" diff --git a/script/bootstrap/chipkit.sh b/script/bootstrap/chipkit.sh new file mode 100644 index 0000000..efe9615 --- /dev/null +++ b/script/bootstrap/chipkit.sh @@ -0,0 +1,61 @@ +set -e +BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $BOOTSTRAP_DIR/common.sh + +echo "Installing dependencies for building for the chipKIT" + + +if [ -z "$MPIDE_DIR" ] || ! test -e $MPIDE_DIR || [ $OS == "cygwin" ]; then + + echo "Installing MPIDE..." + + if [ $OS == "cygwin" ]; then + MPIDE_BASENAME="mpide-0023-windows-20130715" + MPIDE_FILE="$MPIDE_BASENAME".zip + EXTRACT_COMMAND="unzip -q" + if ! command -v unzip >/dev/null 2>&1; then + _cygwin_error "unzip" + fi + elif [ $OS == "mac" ]; then + MPIDE_BASENAME=mpide-0023-macosx-20130715 + MPIDE_FILE="$MPIDE_BASENAME".dmg + else + MPIDE_BASENAME=mpide-0023-linux64-20130817-test + MPIDE_FILE="$MPIDE_BASENAME".tgz + EXTRACT_COMMAND="tar -xzf" + fi + + MPIDE_URL=http://chipkit.s3.amazonaws.com/builds/$MPIDE_FILE + + _pushd $DEPENDENCIES_FOLDER + if ! test -e $MPIDE_FILE + then + echo "Downloading MPIDE..." + download $MPIDE_URL $MPIDE_FILE + fi + + if ! test -d $MPIDE_BASENAME + then + echo "Installing MPIDE to local folder..." + if [ $OS == "mac" ]; then + hdiutil attach $MPIDE_FILE + cp -R /Volumes/Mpide/Mpide.app/Contents/Resources/Java $MPIDE_BASENAME + hdiutil detach /Volumes/Mpide + else + $EXTRACT_COMMAND $MPIDE_FILE + fi + echo "MPIDE installed" + fi + + if [ $OS == "cygwin" ]; then + chmod a+x mpide/hardware/pic32/compiler/pic32-tools/bin/* + chmod a+x -R mpide/hardware/pic32/compiler/pic32-tools/pic32mx/ + chmod a+x mpide/*.dll + chmod a+x mpide/hardware/tools/avr/bin/* + fi + _popd + +fi + +echo +echo "${bldgreen}chipKIT dependencies installed.$txtrst" diff --git a/script/bootstrap/common.sh b/script/bootstrap/common.sh new file mode 100644 index 0000000..695d6b7 --- /dev/null +++ b/script/bootstrap/common.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash + +set -e +BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +if [ -z $COMMON_SOURCED ]; then + + # TODO this is kind of a hacky way of determining if root is required - + # ideally we wouuld set up a little virtualenv in the dependencies folder + SUDO_CMD= + if command -v sudo >/dev/null 2>&1; then + SUDO_CMD="sudo -E" + + if [ -z $CI ] && [ -z $VAGRANT ]; then + echo "The bootstrap script needs to install a few packages to your system as an admin, and we will use the 'sudo' command - enter your password to continue" + $SUDO_CMD ls > /dev/null + fi + fi + + KERNEL=`uname` + ARCH=`uname -m` + if [ ${KERNEL:0:7} == "MINGW32" ]; then + OS="windows" + elif [ ${KERNEL:0:6} == "CYGWIN" ]; then + OS="cygwin" + elif [ $KERNEL == "Darwin" ]; then + OS="mac" + else + OS="linux" + if ! command -v lsb_release >/dev/null 2>&1; then + # Arch Linux + if command -v pacman>/dev/null 2>&1; then + $SUDO_CMD pacman -S lsb-release + fi + fi + + DISTRO=`lsb_release -si` + fi + + + die() { + echo >&2 "${bldred}$@${txtrst}" + exit 1 + } + + _cygwin_error() { + echo + echo "${bldred}Missing \"$1\"${txtrst} - run the Cygwin installer again and select the base package set:" + echo " $CYGWIN_PACKAGES" + echo "After installing the packages, re-run this bootstrap script." + die + } + + if ! command -v tput >/dev/null 2>&1; then + if [ $OS == "cygwin" ]; then + echo "OPTIONAL: Install the \"ncurses\" package in Cygwin to get colored shell output" + fi + else + set +e + # These exit with 1 when provisioning in a Vagrant box...? + txtrst=$(tput sgr0) # reset + bldred=${txtbld}$(tput setaf 1) + bldgreen=${txtbld}$(tput setaf 2) + set -e + fi + + + _pushd() { + pushd $1 > /dev/null + } + + _popd() { + popd > /dev/null + } + + _wait() { + if [ -z $CI ] && [ -z $VAGRANT ]; then + echo "Press Enter when done" + read + fi + } + + _install() { + if [ $OS == "cygwin" ]; then + _cygwin_error $1 + elif [ $OS == "mac" ]; then + # brew exists with 1 if it's already installed + set +e + brew install $1 + set -e + else + if [ -z $DISTRO ]; then + echo + echo "Missing $1 - install it using your distro's package manager or build from source" + _wait + else + if [ $DISTRO == "arch" ]; then + $SUDO_CMD pacman -S $1 + elif [ $DISTRO == "Ubuntu" ]; then + $SUDO_CMD apt-get update -qq + $SUDO_CMD apt-get install $1 -y + else + echo + echo "Missing $1 - install it using your distro's package manager or build from source" + _wait + fi + fi + fi + } + + download() { + url=$1 + filename=$2 + curl $url -L -o $filename + } + + if [ `id -u` == 0 ]; then + die "Error: running as root - don't use 'sudo' with this script" + fi + + if ! command -v unzip >/dev/null 2>&1; then + _install "unzip" + fi + + if ! command -v curl >/dev/null 2>&1; then + if [ $OS == "cygwin" ]; then + _cygwin_error "curl" + else + _install curl + fi + fi + + echo "Storing all downloaded dependencies in the \"dependencies\" folder" + + DEPENDENCIES_FOLDER="dependencies" + mkdir -p $DEPENDENCIES_FOLDER + + if ! command -v make >/dev/null 2>&1; then + if [ $OS == "cygwin" ]; then + _cygwin_error "make" + elif [ $OS == "mac" ]; then + die "Missing 'make' - install the Xcode CLI tools" + else + if [ $DISTRO == "arch" ]; then + _install "base-devel" + elif [ $DISTRO == "Ubuntu" ]; then + _install "build-essential" + fi + fi + fi + + if [ $DISTRO == "Ubuntu" ] && [ $ARCH == "x86_64" ]; then + _install "libc6-i386" + _install "lib32gcc1" + fi + + if ! command -v g++ >/dev/null 2>&1; then + if [ $DISTRO == "Ubuntu" ]; then + _install "g++" + fi + fi + + if ! command -v python >/dev/null 2>&1; then + echo "Installing Python..." + _install "python" + fi + + if ! command -v pip >/dev/null 2>&1; then + echo "Installing Pip..." + if ! command -v easy_install >/dev/null 2>&1; then + _install "python-setuptools" + fi + + if ! command -v easy_install >/dev/null 2>&1; then + die "easy_install not available, can't install pip" + fi + + $SUDO_CMD easy_install pip + fi + + PIP_SUDO_CMD= + if [ -z $VIRTUAL_ENV ]; then + # Only use sudo if the user doesn't have an active virtualenv + PIP_SUDO_CMD=$SUDO_CMD + fi + + $PIP_SUDO_CMD pip install --upgrade setuptools + $PIP_SUDO_CMD pip install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt + + COMMON_SOURCED=1 +fi diff --git a/script/bootstrap/pip-requirements.txt b/script/bootstrap/pip-requirements.txt new file mode 100644 index 0000000..8313187 --- /dev/null +++ b/script/bootstrap/pip-requirements.txt @@ -0,0 +1 @@ +pyserial==2.7 diff --git a/script/runtests.sh b/script/runtests.sh new file mode 100755 index 0000000..ad42f74 --- /dev/null +++ b/script/runtests.sh @@ -0,0 +1,28 @@ +#!/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 diff --git a/examples/AnalogInOutSerial/AnalogInOutSerial.ino b/tests/AnalogInOutSerial/AnalogInOutSerial.ino similarity index 100% rename from examples/AnalogInOutSerial/AnalogInOutSerial.ino rename to tests/AnalogInOutSerial/AnalogInOutSerial.ino diff --git a/examples/AnalogInOutSerial/Makefile b/tests/AnalogInOutSerial/Makefile similarity index 66% rename from examples/AnalogInOutSerial/Makefile rename to tests/AnalogInOutSerial/Makefile index 3dea6c0..872d069 100644 --- a/examples/AnalogInOutSerial/Makefile +++ b/tests/AnalogInOutSerial/Makefile @@ -1,4 +1,5 @@ BOARD_TAG = uno ARDUINO_LIBS = +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/Blink/Blink.ino b/tests/Blink/Blink.ino similarity index 100% rename from examples/Blink/Blink.ino rename to tests/Blink/Blink.ino diff --git a/examples/Blink/Makefile b/tests/Blink/Makefile similarity index 67% rename from examples/Blink/Makefile rename to tests/Blink/Makefile index 7678e9b..d41effa 100644 --- a/examples/Blink/Makefile +++ b/tests/Blink/Makefile @@ -1,5 +1,6 @@ BOARD_TAG = uno ARDUINO_LIBS = +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/BlinkChipKIT/BlinkChipKIT.pde b/tests/BlinkChipKIT/BlinkChipKIT.pde similarity index 100% rename from examples/BlinkChipKIT/BlinkChipKIT.pde rename to tests/BlinkChipKIT/BlinkChipKIT.pde diff --git a/examples/BlinkChipKIT/Makefile b/tests/BlinkChipKIT/Makefile similarity index 69% rename from examples/BlinkChipKIT/Makefile rename to tests/BlinkChipKIT/Makefile index 87a9f7d..bec2794 100644 --- a/examples/BlinkChipKIT/Makefile +++ b/tests/BlinkChipKIT/Makefile @@ -1,5 +1,6 @@ BOARD_TAG = mega_pic32 ARDUINO_LIBS = +include ../TestSuiteCommon.mk include ../../chipKIT.mk diff --git a/examples/BlinkInAVRC/Makefile b/tests/BlinkInAVRC/Makefile similarity index 92% rename from examples/BlinkInAVRC/Makefile rename to tests/BlinkInAVRC/Makefile index 04049bb..9080b24 100644 --- a/examples/BlinkInAVRC/Makefile +++ b/tests/BlinkInAVRC/Makefile @@ -11,6 +11,7 @@ F_CPU = 8000000L ISP_PROG = stk500v1 AVRDUDE_ISP_BAUDRATE = 19200 +include ../TestSuiteCommon.mk include $(ARDMK_DIR)/Arduino.mk # !!! Important. You have to use make ispload to upload when using ISP programmer diff --git a/examples/BlinkInAVRC/blink.c b/tests/BlinkInAVRC/blink.c similarity index 100% rename from examples/BlinkInAVRC/blink.c rename to tests/BlinkInAVRC/blink.c diff --git a/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino b/tests/BlinkWithoutDelay/BlinkWithoutDelay.ino similarity index 100% rename from examples/BlinkWithoutDelay/BlinkWithoutDelay.ino rename to tests/BlinkWithoutDelay/BlinkWithoutDelay.ino diff --git a/examples/Fade/Makefile b/tests/BlinkWithoutDelay/Makefile similarity index 66% rename from examples/Fade/Makefile rename to tests/BlinkWithoutDelay/Makefile index 3dea6c0..872d069 100644 --- a/examples/Fade/Makefile +++ b/tests/BlinkWithoutDelay/Makefile @@ -1,4 +1,5 @@ BOARD_TAG = uno ARDUINO_LIBS = +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/Fade/Fade.ino b/tests/Fade/Fade.ino similarity index 100% rename from examples/Fade/Fade.ino rename to tests/Fade/Fade.ino diff --git a/examples/BlinkWithoutDelay/Makefile b/tests/Fade/Makefile similarity index 66% rename from examples/BlinkWithoutDelay/Makefile rename to tests/Fade/Makefile index 3dea6c0..872d069 100644 --- a/examples/BlinkWithoutDelay/Makefile +++ b/tests/Fade/Makefile @@ -1,4 +1,5 @@ BOARD_TAG = uno ARDUINO_LIBS = +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/HelloWorld/HelloWorld.ino b/tests/HelloWorld/HelloWorld.ino similarity index 100% rename from examples/HelloWorld/HelloWorld.ino rename to tests/HelloWorld/HelloWorld.ino diff --git a/examples/HelloWorld/Makefile b/tests/HelloWorld/Makefile similarity index 71% rename from examples/HelloWorld/Makefile rename to tests/HelloWorld/Makefile index fb94fdd..0af2ed4 100644 --- a/examples/HelloWorld/Makefile +++ b/tests/HelloWorld/Makefile @@ -1,4 +1,5 @@ BOARD_TAG = uno ARDUINO_LIBS = LiquidCrystal +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/tests/TestSuiteCommon.mk b/tests/TestSuiteCommon.mk new file mode 100644 index 0000000..5fa4f50 --- /dev/null +++ b/tests/TestSuiteCommon.mk @@ -0,0 +1,13 @@ +ARDMK_DIR=../../ +DEPENDENCIES_FOLDER = ../../dependencies +DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide-0023-linux64-20130817-test + +ifeq ($(MPIDE_DIR),) + MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) +endif + +DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_FOLDER)/arduino-1.0.5 + +ifeq ($(ARDUINO_DIR),) + ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) +endif diff --git a/examples/WebServer/Makefile b/tests/WebServer/Makefile similarity index 82% rename from examples/WebServer/Makefile rename to tests/WebServer/Makefile index 51b9ac2..5fbefae 100644 --- a/examples/WebServer/Makefile +++ b/tests/WebServer/Makefile @@ -3,4 +3,5 @@ BOARD_TAG = uno ARDUINO_LIBS = Ethernet SPI +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/WebServer/WebServer.ino b/tests/WebServer/WebServer.ino similarity index 100% rename from examples/WebServer/WebServer.ino rename to tests/WebServer/WebServer.ino diff --git a/examples/master_reader/Makefile b/tests/master_reader/Makefile similarity index 82% rename from examples/master_reader/Makefile rename to tests/master_reader/Makefile index 3030deb..8a42a8e 100644 --- a/examples/master_reader/Makefile +++ b/tests/master_reader/Makefile @@ -3,4 +3,5 @@ BOARD_TAG = uno ARDUINO_LIBS = Wire +include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/master_reader/master_reader.ino b/tests/master_reader/master_reader.ino similarity index 100% rename from examples/master_reader/master_reader.ino rename to tests/master_reader/master_reader.ino diff --git a/tests/toneMelody/Makefile b/tests/toneMelody/Makefile new file mode 100644 index 0000000..872d069 --- /dev/null +++ b/tests/toneMelody/Makefile @@ -0,0 +1,5 @@ +BOARD_TAG = uno +ARDUINO_LIBS = + +include ../TestSuiteCommon.mk +include ../../Arduino.mk diff --git a/examples/toneMelody/pitches.h b/tests/toneMelody/pitches.h similarity index 100% rename from examples/toneMelody/pitches.h rename to tests/toneMelody/pitches.h diff --git a/examples/toneMelody/toneMelody.ino b/tests/toneMelody/toneMelody.ino similarity index 100% rename from examples/toneMelody/toneMelody.ino rename to tests/toneMelody/toneMelody.ino From 48356f96ce05948a046d0732dedda66b3e0b69c8 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Tue, 9 Sep 2014 23:13:56 -0400 Subject: [PATCH 02/11] Add config for Travis CI to run the tests automatically. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..68efeb5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: c +compiler: + - gcc +script: script/runtests.sh +before_install: script/bootstrap.sh From 80fd656fcef7c6c76dd016c08c20d629d92db360 Mon Sep 17 00:00:00 2001 From: Sudar Date: Wed, 10 Sep 2014 11:05:35 +0530 Subject: [PATCH 03/11] Add note about test suite in changelog --- HISTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.md b/HISTORY.md index bef7176..92a7ce4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -18,6 +18,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278) - Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278) - Tweak: Add cpp to extensions supported by "make generate_assembly". (https://github.com/sej7278) +- New: Added test suite and integration with travis CI. (https://github.com/peplin) ### 1.3.4 (2014-07-12) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) From 35ed0dd3af973efdb90ba6dfb8ccbda12ad22dc7 Mon Sep 17 00:00:00 2001 From: Sudar Date: Wed, 10 Sep 2014 11:07:34 +0530 Subject: [PATCH 04/11] Rearrange items in changelog --- HISTORY.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 92a7ce4..3717bea 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,20 +5,22 @@ The following is the rough list of changes that went into different versions. I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list. ### In development -- Tweak: Allow remove of any OBJDIR with `$(REMOVE) $(OBJDIR)`. (https://github.com/ladislas) -- Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) -- Add: Add information about `Bare-Arduino–Project` in README. (https://github.com/ladislas) -- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278) -- Add: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278) -- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas) +- New: Added test suite and integration with travis CI. (https://github.com/peplin) +- New: Add information about `Bare-Arduino–Project` in README. (https://github.com/ladislas) +- New: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278) +- New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas) +- New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278) + - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) -- Add: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas) - Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas) -- Add: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278) +- Tweak: Allow remove of any OBJDIR with `$(REMOVE) $(OBJDIR)`. (https://github.com/ladislas) +- Tweak: Add cpp to extensions supported by "make generate_assembly". (https://github.com/sej7278) + +- Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) +- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278) +- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas) - Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278) - Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278) -- Tweak: Add cpp to extensions supported by "make generate_assembly". (https://github.com/sej7278) -- New: Added test suite and integration with travis CI. (https://github.com/peplin) ### 1.3.4 (2014-07-12) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) From 4348fd56606944cadd5c39271c398909e0f63821 Mon Sep 17 00:00:00 2001 From: Sudar Date: Wed, 10 Sep 2014 11:18:29 +0530 Subject: [PATCH 05/11] Add the built status button --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b24604..b929f6c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# A Makefile for Arduino Sketches +# A Makefile for Arduino Sketches [![Build Status](https://travis-ci.org/sudar/Arduino-Makefile.svg)](https://travis-ci.org/sudar/Arduino-Makefile) This is a very simple Makefile which knows how to build Arduino sketches. It defines entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches. From 640519d7be719588c5c730e9af898ed5ca91300d Mon Sep 17 00:00:00 2001 From: Sudar Date: Wed, 10 Sep 2014 15:10:39 +0530 Subject: [PATCH 06/11] Add a note about unit test cases in contributing notes --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76576b3..ff63b49 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,6 +24,7 @@ Submit a ticket for your issue, assuming one does not already exist. - When committing, reference your issue (if present) and include a note about the fix - If possible (and if makes sense) do atomic commits - Try to follow [this guideline](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) while choosing the git commit message + - If it makes sense then add a unit test case for the changes that you are making - Push the changes to your fork and submit a pull request to the 'master' branch of the this repository At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary. From 9a297758e16b34384f929770c9709f977907ac62 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Wed, 10 Sep 2014 00:09:04 -0400 Subject: [PATCH 07/11] Document CFLAGS, CXXFLAGS, ASFLAGS and CPPFLAGS. After understanding the difference between CXXFLAGS and CPPFLAGS, this is a revised commit for https://github.com/sudar/Arduino-Makefile/pull/257 --- arduino-mk-vars.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md index 54608d6..1e8de64 100644 --- a/arduino-mk-vars.md +++ b/arduino-mk-vars.md @@ -852,6 +852,82 @@ CXXFLAGS_STD = = -std=gnu++98 ---- +### CFLAGS + +**Description:** + +Flags passed to compiler for files compiled as C. Add more flags to this +variable using `+=`. + +Defaults to all flags required for a typical build. + +**Example:** + +```Makefile +CFLAGS += -my-c-only-flag +``` + +**Requirement:** *Optional* + +---- + +### CXXFLAGS + +**Description:** + +Flags passed to the compiler for files compiled as C++. Add more flags to this +variable using `+=`. + +Defaults to all flags required for a typical build. + +**Example:** + +```Makefile +CXXFLAGS += -my-c++-onlyflag +``` + +**Requirement:** *Optional* + +---- + +### ASFLAGS + +**Description:** + +Flags passed to compiler for files compiled as assembly (e.g. `.S` files). Add +more flags to this variable using `+=`. + +Defaults to all flags required for a typical build. + +**Example:** + +```Makefile +ASFLAGS += -my-as-only-flag +``` + +**Requirement:** *Optional* + +---- + +### CPPFLAGS + +**Description:** + +Flags passed to the C pre-processor (for C, C++ and assembly source flies). Add +more flags to this variable using `+=`. + +Defaults to all flags required for a typical build. + +**Example:** + +```Makefile +CPPFLAGS += -DMY_DEFINE_FOR_ALL_SOURCE_TYPES +``` + +**Requirement:** *Optional* + +---- + ### OVERRIDE_EXECUTABLES **Description:** From 086c6e96ca4b98e8a144b5f7f37a7b3b6fedc61d Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 20 Sep 2014 16:14:32 -0400 Subject: [PATCH 08/11] 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 09/11] 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 10/11] 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-* From 6be2614c30a0d37a7c579df2805fbf8c192ca57a Mon Sep 17 00:00:00 2001 From: Simon John Date: Sun, 21 Sep 2014 18:23:06 +0100 Subject: [PATCH 11/11] Removed Travis-CI references from all examples. Regular users are not affected by test scripts/makefiles. Added makefile and gcc version info to config output. Tested on Arduino 1.0.6 --- Arduino.mk | 8 ++++++++ Common.mk | 17 +++++++++++++++++ HISTORY.md | 2 ++ examples/AnalogInOutSerial/Makefile | 1 - examples/Blink/Makefile | 1 - examples/BlinkChipKIT/Makefile | 1 - examples/BlinkInAVRC/Makefile | 3 +-- examples/BlinkWithoutDelay/Makefile | 1 - examples/Fade/Makefile | 1 - examples/HelloWorld/Makefile | 1 - examples/TestSuiteCommon.mk | 13 ------------- examples/TinySoftWareSerial/Makefile | 1 - examples/WebServer/Makefile | 1 - examples/master_reader/Makefile | 1 - examples/toneMelody/Makefile | 1 - tests/script/runtests.sh | 4 ++-- 16 files changed, 30 insertions(+), 27 deletions(-) delete mode 100644 examples/TestSuiteCommon.mk diff --git a/Arduino.mk b/Arduino.mk index c1981d0..1981e52 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1010,6 +1010,14 @@ else $(call show_config_variable,BOOTLOADER_PARENT,[USER]) endif +######################################################################## +# Tools version info +ARDMK_VERSION = 1.3.4 +$(call show_config_variable,ARDMK_VERSION,[COMPUTED]) + +CC_VERSION = $(shell $(CC) -dumpversion) +$(call show_config_variable,CC_VERSION,[COMPUTED],($(CC_NAME))) + # end of config output $(call show_separator) diff --git a/Common.mk b/Common.mk index 9aa36b8..f425b96 100644 --- a/Common.mk +++ b/Common.mk @@ -44,3 +44,20 @@ else endif endif $(call show_config_variable,CURRENT_OS,[AUTODETECTED]) + +######################################################################## +# +# Travis-CI +ifneq ($(TEST),) + DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies + + DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_DIR)/mpide-0023-linux64-20130817-test + ifeq ($(MPIDE_DIR),) + MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) + endif + + DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/arduino-1.0.5 + ifeq ($(ARDUINO_DIR),) + ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) + endif +endif diff --git a/HISTORY.md b/HISTORY.md index 3717bea..fedb006 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - New: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278) - New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas) - New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278) +- New: Add makefile and gcc version info to config output. (https://github.com/sej7278) - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) - Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas) @@ -21,6 +22,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas) - Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278) - Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278) +- Fix: Remove impact of travis-ci from regular users. (Issue #258). (https://github.com/sej7278) ### 1.3.4 (2014-07-12) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) diff --git a/examples/AnalogInOutSerial/Makefile b/examples/AnalogInOutSerial/Makefile index 872d069..3dea6c0 100644 --- a/examples/AnalogInOutSerial/Makefile +++ b/examples/AnalogInOutSerial/Makefile @@ -1,5 +1,4 @@ BOARD_TAG = uno ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/Blink/Makefile b/examples/Blink/Makefile index d41effa..7678e9b 100644 --- a/examples/Blink/Makefile +++ b/examples/Blink/Makefile @@ -1,6 +1,5 @@ BOARD_TAG = uno ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/BlinkChipKIT/Makefile b/examples/BlinkChipKIT/Makefile index bec2794..87a9f7d 100644 --- a/examples/BlinkChipKIT/Makefile +++ b/examples/BlinkChipKIT/Makefile @@ -1,6 +1,5 @@ BOARD_TAG = mega_pic32 ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../chipKIT.mk diff --git a/examples/BlinkInAVRC/Makefile b/examples/BlinkInAVRC/Makefile index 9080b24..a4cd2e4 100644 --- a/examples/BlinkInAVRC/Makefile +++ b/examples/BlinkInAVRC/Makefile @@ -11,7 +11,6 @@ F_CPU = 8000000L ISP_PROG = stk500v1 AVRDUDE_ISP_BAUDRATE = 19200 -include ../TestSuiteCommon.mk -include $(ARDMK_DIR)/Arduino.mk +include ../../Arduino.mk # !!! Important. You have to use make ispload to upload when using ISP programmer diff --git a/examples/BlinkWithoutDelay/Makefile b/examples/BlinkWithoutDelay/Makefile index 872d069..3dea6c0 100644 --- a/examples/BlinkWithoutDelay/Makefile +++ b/examples/BlinkWithoutDelay/Makefile @@ -1,5 +1,4 @@ BOARD_TAG = uno ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/Fade/Makefile b/examples/Fade/Makefile index 872d069..3dea6c0 100644 --- a/examples/Fade/Makefile +++ b/examples/Fade/Makefile @@ -1,5 +1,4 @@ BOARD_TAG = uno ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/HelloWorld/Makefile b/examples/HelloWorld/Makefile index 0af2ed4..fb94fdd 100644 --- a/examples/HelloWorld/Makefile +++ b/examples/HelloWorld/Makefile @@ -1,5 +1,4 @@ BOARD_TAG = uno ARDUINO_LIBS = LiquidCrystal -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/TestSuiteCommon.mk b/examples/TestSuiteCommon.mk deleted file mode 100644 index a66a007..0000000 --- a/examples/TestSuiteCommon.mk +++ /dev/null @@ -1,13 +0,0 @@ -ARDMK_DIR=../../ -DEPENDENCIES_FOLDER = /var/tmp/Arduino-Makefile-testing-dependencies -DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_FOLDER)/mpide-0023-linux64-20130817-test - -ifeq ($(MPIDE_DIR),) - MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) -endif - -DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_FOLDER)/arduino-1.0.5 - -ifeq ($(ARDUINO_DIR),) - ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) -endif diff --git a/examples/TinySoftWareSerial/Makefile b/examples/TinySoftWareSerial/Makefile index 991e57e..08f918d 100644 --- a/examples/TinySoftWareSerial/Makefile +++ b/examples/TinySoftWareSerial/Makefile @@ -9,7 +9,6 @@ BOARD_TAG = attiny85-8 ARDUINO_LIBS = SoftwareSerial -include ../TestSuiteCommon.mk include $(ARDMK_DIR)/Arduino.mk # !!! Important. You have to use make ispload to upload when using ISP programmer diff --git a/examples/WebServer/Makefile b/examples/WebServer/Makefile index 5fbefae..51b9ac2 100644 --- a/examples/WebServer/Makefile +++ b/examples/WebServer/Makefile @@ -3,5 +3,4 @@ BOARD_TAG = uno ARDUINO_LIBS = Ethernet SPI -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/master_reader/Makefile b/examples/master_reader/Makefile index 8a42a8e..3030deb 100644 --- a/examples/master_reader/Makefile +++ b/examples/master_reader/Makefile @@ -3,5 +3,4 @@ BOARD_TAG = uno ARDUINO_LIBS = Wire -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/examples/toneMelody/Makefile b/examples/toneMelody/Makefile index 872d069..3dea6c0 100644 --- a/examples/toneMelody/Makefile +++ b/examples/toneMelody/Makefile @@ -1,5 +1,4 @@ BOARD_TAG = uno ARDUINO_LIBS = -include ../TestSuiteCommon.mk include ../../Arduino.mk diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh index 5f513da..5313d0f 100755 --- a/tests/script/runtests.sh +++ b/tests/script/runtests.sh @@ -28,8 +28,8 @@ do pushd $dir echo "Compiling $example..." - make_output=`make clean` - make_output=`make` + make_output=`make clean TEST=1` + make_output=`make TEST=1` if [[ $? -ne 0 ]]; then failures+=("$example") echo "Example $example failed"