aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Whittington <git@jbrengineering.co.uk>2020-08-06 19:21:23 +0200
committerJohn Whittington <git@jbrengineering.co.uk>2020-08-06 20:01:05 +0200
commitbf319c49b7f7ff17e073422a3ba06a701e12f590 (patch)
tree66d05b1e87a9efcd27af2f485dc3cfae528b553d
parent185a1e9e3527794a49451915009fb48d9e678080 (diff)
platform neutral examples and manual cherry-pick merge of https://github.com/alissa-huskey/Arduino-Makefile/tree/test_fixes
-rw-r--r--.travis.yml6
-rw-r--r--Common.mk18
-rw-r--r--Sam.mk2
-rw-r--r--examples/ATtinyBlink/Makefile2
-rw-r--r--examples/AnalogInOutSerial/Makefile2
-rw-r--r--examples/Blink/Makefile2
-rw-r--r--examples/Blink3rdPartyLib/Makefile2
-rw-r--r--examples/Blink3rdPartyLib/Toggle/Makefile2
-rw-r--r--examples/BlinkChipKIT/Makefile2
-rw-r--r--examples/BlinkInAVRC/Makefile2
-rw-r--r--examples/BlinkNetworkRPi/Makefile2
-rw-r--r--examples/BlinkOpenCM/Makefile2
-rw-r--r--examples/BlinkOpenCR/Makefile2
-rw-r--r--examples/BlinkTeensy/Makefile2
-rw-r--r--examples/BlinkWithoutDelay/Makefile2
-rw-r--r--examples/DueBlink/Makefile2
-rw-r--r--examples/Fade/Makefile2
-rw-r--r--examples/HelloWorld/Makefile2
-rw-r--r--examples/MZeroBlink/Makefile2
-rw-r--r--examples/SerialPrint/Makefile2
-rw-r--r--examples/TinySoftWareSerial/Makefile2
-rw-r--r--examples/WebServer/Makefile2
-rw-r--r--examples/ZeroBlink/Makefile2
-rw-r--r--examples/master_reader/Makefile2
-rw-r--r--examples/toneMelody/Makefile2
-rw-r--r--tests/script/bootstrap/common.sh2
-rwxr-xr-xtests/script/runtests.sh69
27 files changed, 90 insertions, 51 deletions
diff --git a/.travis.yml b/.travis.yml
index dce5451..a8e0a66 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
-sudo: required
+os: linux
+dist: xenial
language: c
compiler:
- gcc
@@ -9,3 +10,6 @@ addons:
packages:
- "python3"
- "python3-pip"
+env:
+ global:
+ - ARDMK_DIR=$TRAVIS_BUILD_DIR
diff --git a/Common.mk b/Common.mk
index d111336..501f582 100644
--- a/Common.mk
+++ b/Common.mk
@@ -48,20 +48,20 @@ $(call arduino_output,$(call ardmk_include) Configuration:)
ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS
- GREP_CMD := grep
+ GREP_CMD = grep
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX
- GREP_CMD := grep
+ GREP_CMD = grep
endif
ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC
ifeq (, $(shell which ggrep))
echo $(info Using macOS BSD grep, please install GNU grep to avoid warnings)
- GREP_CMD := grep
+ GREP_CMD = grep
else
- GREP_CMD := ggrep
+ GREP_CMD = ggrep
endif
endif
endif
@@ -73,14 +73,18 @@ $(call show_config_variable,CURRENT_OS,[AUTODETECTED])
ifneq ($(TEST),)
DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies
- DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_DIR)/mpide-0023-linux64-20130817-test
+ DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1)
+
ifeq ($(MPIDE_DIR),)
MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR)
endif
ifndef ARDUINO_IDE_DIR
- ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*)))))
- # ARDUINO_IDE_DIR := arduino
+ ifeq ($(CURRENT_OS),MAC)
+ ARDUINO_IDE_DIR = Arduino.app/Contents/Resources/Java
+ else
+ ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*)))))
+ endif
endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR)
ifeq ($(ARDUINO_DIR),)
diff --git a/Sam.mk b/Sam.mk
index cc588a1..2e19730 100644
--- a/Sam.mk
+++ b/Sam.mk
@@ -38,7 +38,7 @@ ifneq ($(TEST),)
ALTERNATE_CORE_PATH = $(DEPENDENCIES_DIR)/samd
CMSIS_DIR = $(DEPENDENCIES_DIR)/CMSIS/CMSIS
CMSIS_ATMEL_DIR = $(DEPENDENCIES_DIR)/CMSIS-Atmel/CMSIS
- ARM_TOOLS_DIR = $(basename $(basename $(firstword $(wildcard $(DEPENDENCIES_DIR)/gcc-arm-none-eabi*))))
+ ARM_TOOLS_DIR := $(basename $(basename $(firstword $(wildcard $(DEPENDENCIES_DIR)/gcc-arm-none-eabi*))))
endif
ifndef ARDUINO_PACKAGE_DIR
diff --git a/examples/ATtinyBlink/Makefile b/examples/ATtinyBlink/Makefile
index f73d7a0..76327a8 100644
--- a/examples/ATtinyBlink/Makefile
+++ b/examples/ATtinyBlink/Makefile
@@ -54,6 +54,6 @@ BOARD_TAG = attiny85
# ------------------------------------------------------------------ #
# Path to the Arduino Makefile
-include /usr/share/arduino/Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
# !!! Important. You have to use 'make ispload' when using an ISP.
diff --git a/examples/AnalogInOutSerial/Makefile b/examples/AnalogInOutSerial/Makefile
index 3dea6c0..5db75de 100644
--- a/examples/AnalogInOutSerial/Makefile
+++ b/examples/AnalogInOutSerial/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/Blink/Makefile b/examples/Blink/Makefile
index 7cb3881..51a66bc 100644
--- a/examples/Blink/Makefile
+++ b/examples/Blink/Makefile
@@ -1,7 +1,7 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/Blink3rdPartyLib/Makefile b/examples/Blink3rdPartyLib/Makefile
index f473dbd..4658f50 100644
--- a/examples/Blink3rdPartyLib/Makefile
+++ b/examples/Blink3rdPartyLib/Makefile
@@ -15,7 +15,7 @@ TOGGLE_ARCHIVE = build-$(BOARD_TAG)/libtoggle.a
CXXFLAGS += -IToggle
OTHER_OBJS = Toggle/$(TOGGLE_ARCHIVE)
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
Toggle/$(TOGGLE_ARCHIVE):
$(MAKE) -C Toggle $(TOGGLE_ARCHIVE)
diff --git a/examples/Blink3rdPartyLib/Toggle/Makefile b/examples/Blink3rdPartyLib/Toggle/Makefile
index a6234f6..d733171 100644
--- a/examples/Blink3rdPartyLib/Toggle/Makefile
+++ b/examples/Blink3rdPartyLib/Toggle/Makefile
@@ -8,7 +8,7 @@
# and archived into the build-$(BOARD_TAG)/libtoggle.a target.
include ../board.mk
-include ../../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
build-$(BOARD_TAG)/libtoggle.a: $(LOCAL_OBJS)
$(AR) rcs $@ $(LOCAL_OBJS)
diff --git a/examples/BlinkChipKIT/Makefile b/examples/BlinkChipKIT/Makefile
index 87a9f7d..440db29 100644
--- a/examples/BlinkChipKIT/Makefile
+++ b/examples/BlinkChipKIT/Makefile
@@ -1,5 +1,5 @@
BOARD_TAG = mega_pic32
ARDUINO_LIBS =
-include ../../chipKIT.mk
+include $(ARDMK_DIR)/chipKIT.mk
diff --git a/examples/BlinkInAVRC/Makefile b/examples/BlinkInAVRC/Makefile
index a4cd2e4..04049bb 100644
--- a/examples/BlinkInAVRC/Makefile
+++ b/examples/BlinkInAVRC/Makefile
@@ -11,6 +11,6 @@ F_CPU = 8000000L
ISP_PROG = stk500v1
AVRDUDE_ISP_BAUDRATE = 19200
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
# !!! Important. You have to use make ispload to upload when using ISP programmer
diff --git a/examples/BlinkNetworkRPi/Makefile b/examples/BlinkNetworkRPi/Makefile
index 15e565e..c119b53 100644
--- a/examples/BlinkNetworkRPi/Makefile
+++ b/examples/BlinkNetworkRPi/Makefile
@@ -16,7 +16,7 @@ AVRDUDE_CONF=/usr/local/etc/avrdude.conf
FORCE_MONITOR_PORT=true
MONITOR_PORT=/dev/spidev0.0
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
# Additional rules to use a remote Raspberry Pi programmer
diff --git a/examples/BlinkOpenCM/Makefile b/examples/BlinkOpenCM/Makefile
index 0f7b285..75f52fb 100644
--- a/examples/BlinkOpenCM/Makefile
+++ b/examples/BlinkOpenCM/Makefile
@@ -4,4 +4,4 @@ ARDUINO_LIBS =
#MONITOR_PORT = /dev/ttyACM0
#OPENCMIDE_DIR = /where/you/installed/robotis_opencm
-include ../../OpenCM.mk
+include $(ARDMK_DIR)/OpenCM.mk
diff --git a/examples/BlinkOpenCR/Makefile b/examples/BlinkOpenCR/Makefile
index d4422f4..18bfa8d 100644
--- a/examples/BlinkOpenCR/Makefile
+++ b/examples/BlinkOpenCR/Makefile
@@ -5,4 +5,4 @@ ARDUINO_LIBS =
#MONITOR_PORT = /dev/ttyACM0
-include ../../OpenCR.mk
+include $(ARDMK_DIR)/OpenCR.mk
diff --git a/examples/BlinkTeensy/Makefile b/examples/BlinkTeensy/Makefile
index 1d59ef2..be58660 100644
--- a/examples/BlinkTeensy/Makefile
+++ b/examples/BlinkTeensy/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = teensy31
ARDUINO_LIBS =
-include ../../Teensy.mk
+include $(ARDMK_DIR)/Teensy.mk
diff --git a/examples/BlinkWithoutDelay/Makefile b/examples/BlinkWithoutDelay/Makefile
index 3dea6c0..5db75de 100644
--- a/examples/BlinkWithoutDelay/Makefile
+++ b/examples/BlinkWithoutDelay/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/DueBlink/Makefile b/examples/DueBlink/Makefile
index 8a7ad6e..a11248c 100644
--- a/examples/DueBlink/Makefile
+++ b/examples/DueBlink/Makefile
@@ -16,4 +16,4 @@ ARCHITECTURE = sam
# Windows
#ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
-include ../../Sam.mk
+include $(ARDMK_DIR)/Sam.mk
diff --git a/examples/Fade/Makefile b/examples/Fade/Makefile
index 3dea6c0..5db75de 100644
--- a/examples/Fade/Makefile
+++ b/examples/Fade/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/HelloWorld/Makefile b/examples/HelloWorld/Makefile
index fb94fdd..2730c53 100644
--- a/examples/HelloWorld/Makefile
+++ b/examples/HelloWorld/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = LiquidCrystal
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/MZeroBlink/Makefile b/examples/MZeroBlink/Makefile
index 29cb90b..4771b9c 100644
--- a/examples/MZeroBlink/Makefile
+++ b/examples/MZeroBlink/Makefile
@@ -21,4 +21,4 @@ BOARD_TAG = mzero_pro_bl_dbg
# Windows
# ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
-include ../../Sam.mk
+include $(ARDMK_DIR)/Sam.mk
diff --git a/examples/SerialPrint/Makefile b/examples/SerialPrint/Makefile
index f9d5cf4..5050232 100644
--- a/examples/SerialPrint/Makefile
+++ b/examples/SerialPrint/Makefile
@@ -2,4 +2,4 @@
BOARD_TAG = uno
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/TinySoftWareSerial/Makefile b/examples/TinySoftWareSerial/Makefile
index ffe3afc..7c60f3a 100644
--- a/examples/TinySoftWareSerial/Makefile
+++ b/examples/TinySoftWareSerial/Makefile
@@ -17,4 +17,4 @@ F_CPU = 16000000L
ARDUINO_LIBS = SoftwareSerial
-include /usr/share/arduino/Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/WebServer/Makefile b/examples/WebServer/Makefile
index 51b9ac2..83fbd4e 100644
--- a/examples/WebServer/Makefile
+++ b/examples/WebServer/Makefile
@@ -3,4 +3,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = Ethernet SPI
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/ZeroBlink/Makefile b/examples/ZeroBlink/Makefile
index 60c8435..d0c30fb 100644
--- a/examples/ZeroBlink/Makefile
+++ b/examples/ZeroBlink/Makefile
@@ -27,4 +27,4 @@ BOARD_TAG = arduino_zero_native
# Windows
#ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
-include ../../Sam.mk
+include $(ARDMK_DIR)/Sam.mk
diff --git a/examples/master_reader/Makefile b/examples/master_reader/Makefile
index 3030deb..c650a04 100644
--- a/examples/master_reader/Makefile
+++ b/examples/master_reader/Makefile
@@ -3,4 +3,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = Wire
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/toneMelody/Makefile b/examples/toneMelody/Makefile
index 3dea6c0..5db75de 100644
--- a/examples/toneMelody/Makefile
+++ b/examples/toneMelody/Makefile
@@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
-include ../../Arduino.mk
+include $(ARDMK_DIR)/Arduino.mk
diff --git a/tests/script/bootstrap/common.sh b/tests/script/bootstrap/common.sh
index 221dd21..2b879b8 100644
--- a/tests/script/bootstrap/common.sh
+++ b/tests/script/bootstrap/common.sh
@@ -168,8 +168,6 @@ if [ -z $COMMON_SOURCED ]; then
if ! command -v pip3 >/dev/null 2>&1; then
echo "Installing Pip..."
_install "python3-pip"
-
- $SUDO_CMD easy_install3 pip3
fi
PIP_SUDO_CMD=
diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh
index ba75fe4..84fa4c5 100755
--- a/tests/script/runtests.sh
+++ b/tests/script/runtests.sh
@@ -1,9 +1,41 @@
#!/usr/bin/env bash
+SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TESTS_DIR=examples
+export ARDMK_DIR="${ARDMK_DIR:-$SCRIPTS_DIR/../..}"
failures=()
+if [[ "$1" == "-q" ]]; then
+ QUIET=1
+fi
+
+runtest() {
+ if [[ $QUIET ]]; then
+ make $* TEST=1 > /dev/null 2>&1
+ else
+ output=`make $* TEST=1`
+ fi
+}
+
+run() {
+ if [[ $QUIET ]]; then
+ "$@" > /dev/null 2>&1
+ else
+ "$@"
+ fi
+}
+
+info() {
+ if [[ $QUIET ]]; then
+ return
+ fi
+
+ echo "$@"
+}
+
+run pushd $SCRIPTS_DIR/../..
+
# 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.
@@ -22,46 +54,47 @@ do
done
if ! $example_is_testable; then
- echo "Skipping non-testable example $example..."
+ info "Skipping non-testable example $example..."
continue
fi
- pushd $dir
- echo "Compiling $example..."
- make_output=`make clean TEST=1`
- make_output=`make TEST=1`
+ run pushd $dir
+ info "Compiling $example..."
+ runtest clean
+ runtest
+
if [[ $? -ne 0 ]]; then
failures+=("$example")
- echo "Example $example failed"
+ info "Example $example failed"
fi
- make_output=`make disasm TEST=1`
+ runtest disasm
if [[ $? -ne 0 ]]; then
failures+=("$example disasm")
- echo "Example $example disasm failed"
+ info "Example $example disasm failed"
fi
- make_output=`make generate_assembly TEST=1`
+ runtest generate_assembly
if [[ $? -ne 0 ]]; then
failures+=("$example generate_assembly")
- echo "Example $example generate_assembly failed"
+ info "Example $example generate_assembly failed"
fi
- make_output=`make symbol_sizes TEST=1`
+ runtest symbol_sizes
if [[ $? -ne 0 ]]; then
failures+=("$example symbol_sizes")
- echo "Example $example symbol_sizes failed"
+ info "Example $example symbol_sizes failed"
fi
- popd
-done
-
-for failure in "${failures[@]}"; do
- echo "Example $failure failed"
+ run popd
done
if [[ ${#failures[@]} -eq 0 ]]; then
echo "All tests passed."
else
- exit 1
+ for failure in "${failures[@]}"; do
+ echo "Example $failure failed"
+ done
+
+ exit 1
fi