aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/script/bootstrap.sh1
-rw-r--r--tests/script/bootstrap/arduino.sh8
-rw-r--r--tests/script/bootstrap/common.sh18
-rw-r--r--tests/script/bootstrap/pip-requirements.txt2
-rw-r--r--tests/script/bootstrap/samd.sh46
-rwxr-xr-xtests/script/runtests.sh71
6 files changed, 110 insertions, 36 deletions
diff --git a/tests/script/bootstrap.sh b/tests/script/bootstrap.sh
index 083bf5d..0dbd7b2 100755
--- a/tests/script/bootstrap.sh
+++ b/tests/script/bootstrap.sh
@@ -7,3 +7,4 @@ pushd $SCRIPTS_DIR/..
source $SCRIPTS_DIR/bootstrap/chipkit.sh
source $SCRIPTS_DIR/bootstrap/arduino.sh
+source $SCRIPTS_DIR/bootstrap/samd.sh
diff --git a/tests/script/bootstrap/arduino.sh b/tests/script/bootstrap/arduino.sh
index 7c2c9ac..371c0ef 100644
--- a/tests/script/bootstrap/arduino.sh
+++ b/tests/script/bootstrap/arduino.sh
@@ -8,7 +8,8 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
echo "Installing Arduino..."
- ARDUINO_BASENAME="arduino-1.0.6"
+ ARDUINO_BASENAME="arduino-1.8.11"
+
if [ $OS == "cygwin" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip
EXTRACT_COMMAND="unzip -q"
@@ -16,8 +17,8 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip
EXTRACT_COMMAND="unzip -q"
else
- ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tgz
- EXTRACT_COMMAND="tar -xzf"
+ ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tar.xz
+ EXTRACT_COMMAND="tar -xf"
fi
ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE
@@ -33,6 +34,7 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
then
echo "Installing Arduino to local folder..."
$EXTRACT_COMMAND $ARDUINO_FILE
+ mv $ARDUINO_BASENAME arduino
echo "Arduino installed"
fi
diff --git a/tests/script/bootstrap/common.sh b/tests/script/bootstrap/common.sh
index c3cd90e..2b879b8 100644
--- a/tests/script/bootstrap/common.sh
+++ b/tests/script/bootstrap/common.sh
@@ -160,22 +160,14 @@ if [ -z $COMMON_SOURCED ]; then
fi
fi
- if ! command -v python >/dev/null 2>&1; then
+ if ! command -v python3 >/dev/null 2>&1; then
echo "Installing Python..."
- _install "python"
+ _install "python3"
fi
- if ! command -v pip >/dev/null 2>&1; then
+ if ! command -v pip3 >/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
+ _install "python3-pip"
fi
PIP_SUDO_CMD=
@@ -184,7 +176,7 @@ if [ -z $COMMON_SOURCED ]; then
PIP_SUDO_CMD=$SUDO_CMD
fi
- $PIP_SUDO_CMD pip install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
+ $PIP_SUDO_CMD pip3 install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
COMMON_SOURCED=1
fi
diff --git a/tests/script/bootstrap/pip-requirements.txt b/tests/script/bootstrap/pip-requirements.txt
index 8313187..205196f 100644
--- a/tests/script/bootstrap/pip-requirements.txt
+++ b/tests/script/bootstrap/pip-requirements.txt
@@ -1 +1 @@
-pyserial==2.7
+pyserial==3.4
diff --git a/tests/script/bootstrap/samd.sh b/tests/script/bootstrap/samd.sh
new file mode 100644
index 0000000..fdd50f5
--- /dev/null
+++ b/tests/script/bootstrap/samd.sh
@@ -0,0 +1,46 @@
+set -e
+BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $BOOTSTRAP_DIR/common.sh
+
+echo "Installing dependencies for building for the SAMD boards"
+
+# these extract to dirs without versions...
+SAMD_PACKAGE="samd-1.8.6"
+CMSIS_PACKAGE="CMSIS-4.5.0"
+CMSIS_ATMEL_PACKAGE="CMSIS-Atmel-1.2.0"
+
+if [ $OS == "mac" ]; then
+ TOOLCHAIN_PACKAGE="gcc-arm-none-eabi-7-2017-q4-major-mac"
+else
+ TOOLCHAIN_PACKAGE="gcc-arm-none-eabi-7-2017-q4-major-linux"
+fi
+
+ARDUINO_URL=https://downloads.arduino.cc
+TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4
+
+EXTRACT_COMMAND="tar -xjf"
+
+_pushd $DEPENDENCIES_FOLDER
+if ! test -e $SAMD_PACKAGE
+then
+ echo "Downloading SAMD packages..."
+ download $ARDUINO_URL/cores/$SAMD_PACKAGE.tar.bz2 $SAMD_PACKAGE.tar.bz2
+ download $ARDUINO_URL/$CMSIS_PACKAGE.tar.bz2 $CMSIS_PACKAGE.tar.bz2
+ download $ARDUINO_URL/$CMSIS_ATMEL_PACKAGE.tar.bz2 $CMSIS_ATMEL_PACKAGE.tar.bz2
+ download $TOOLCHAIN_URL/$TOOLCHAIN_PACKAGE.tar.bz2 $TOOLCHAIN_PACKAGE.tar.bz2
+fi
+
+if ! test -d $SAMD_PACKAGE
+then
+ echo "Installing packages to local folder..."
+ $EXTRACT_COMMAND $SAMD_PACKAGE.tar.bz2
+ $EXTRACT_COMMAND $CMSIS_PACKAGE.tar.bz2
+ $EXTRACT_COMMAND $CMSIS_ATMEL_PACKAGE.tar.bz2
+ $EXTRACT_COMMAND $TOOLCHAIN_PACKAGE.tar.bz2
+ echo "SAMD support installed"
+fi
+
+_popd
+
+echo
+echo "${bldgreen}SAMD dependencies installed.$txtrst"
diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh
index fd05c30..84fa4c5 100755
--- a/tests/script/runtests.sh
+++ b/tests/script/runtests.sh
@@ -1,13 +1,45 @@
#!/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.
-NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC MZeroBlink ZeroBlink DueBlink)
+NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC DueBlink)
for dir in $TESTS_DIR/*/
do
@@ -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