From 3a9ef8dc83b3ad6326d0fada4e8001dbf5297a39 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 20:56:48 -0700 Subject: [PATCH 1/9] Fix download IDE url in test & add error handling --- tests/script/bootstrap/arduino.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/script/bootstrap/arduino.sh b/tests/script/bootstrap/arduino.sh index 7c2c9ac..f118646 100644 --- a/tests/script/bootstrap/arduino.sh +++ b/tests/script/bootstrap/arduino.sh @@ -9,6 +9,7 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then echo "Installing Arduino..." ARDUINO_BASENAME="arduino-1.0.6" + if [ $OS == "cygwin" ]; then ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip EXTRACT_COMMAND="unzip -q" @@ -20,13 +21,25 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then EXTRACT_COMMAND="tar -xzf" fi - ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE + ARDUINO_URL=https://downloads.arduino.cc/$ARDUINO_FILE _pushd $DEPENDENCIES_FOLDER if ! test -e $ARDUINO_FILE then echo "Downloading Arduino IDE..." download $ARDUINO_URL $ARDUINO_FILE + + if [[ ! "$(file --mime-type $ARDUINO_FILE)" =~ application\/zip ]]; then + mv $ARDUINO_FILE "bad-$ARDUINO_FILE" + + echo + echo "[ERROR] Unable to download valid IDE for testing" + echo " Download the IDE manually then try again." + echo + echo " Download from: https://www.arduino.cc/en/Main/Software" + echo " Save to : $DEPENDENCIES_FOLDER" + exit 1 + fi fi if ! test -d $ARDUINO_BASENAME From bf1efbab20f150f5b18ee488b011122e61eb77ab Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 21:01:02 -0700 Subject: [PATCH 2/9] Allow runtests.sh to be run from anywhere --- tests/script/runtests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh index fd05c30..6a93952 100755 --- a/tests/script/runtests.sh +++ b/tests/script/runtests.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +pushd $SCRIPTS_DIR/../.. TESTS_DIR=examples failures=() From d841c3f85d4fb798778d20d5675e02f83b2b73cc Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 21:18:00 -0700 Subject: [PATCH 3/9] Fix test path for mac --- Common.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Common.mk b/Common.mk index 0c1f92c..b17fe09 100644 --- a/Common.mk +++ b/Common.mk @@ -69,7 +69,13 @@ ifneq ($(TEST),) MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) endif - DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/arduino-1.0.6 + ifeq ($(CURRENT_OS),MAC) + IDE_DIRNAME=Arduino.app/Contents/Resources/Java + else + IDE_DIRNAME=arduino-1.0.6 + endif + + DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(IDE_DIRNAME) ifeq ($(ARDUINO_DIR),) ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) endif From 7f9f830022885b4b01aeac4f919efc2013761a6a Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 22:16:04 -0700 Subject: [PATCH 4/9] Ignore .tags --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2fa5764..fe7cef4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build-cli /.project build-* +.tags From 3f2b53d6b8d91a33f8eb5f58f6507c6fde080b82 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 22:16:46 -0700 Subject: [PATCH 5/9] Add -q option to runtests.sh for quiet mode --- tests/script/runtests.sh | 68 +++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh index 6a93952..aec209e 100755 --- a/tests/script/runtests.sh +++ b/tests/script/runtests.sh @@ -1,11 +1,40 @@ #!/usr/bin/env bash SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -pushd $SCRIPTS_DIR/../.. TESTS_DIR=examples 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. @@ -24,46 +53,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 From 72134ddd48acd2fbb3c59f03bb13cb307e8c9929 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Tue, 12 Nov 2019 22:38:44 -0700 Subject: [PATCH 6/9] Don't hardcode the mpide_dir in TEST=1 Set DEPENDENCIES_MPIDE_DIR to the the newest directory in DEPENDENCIES_DIR matching mpide-0023-* --- Common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common.mk b/Common.mk index b17fe09..b534ae3 100644 --- a/Common.mk +++ b/Common.mk @@ -64,7 +64,7 @@ $(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 From 54935bd75ae56fc665d6ad07dcfb0531b2ebb8c3 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Wed, 13 Nov 2019 00:45:41 -0700 Subject: [PATCH 7/9] Fix failing CI Build is failing because pyserial 3.0.1 is already installed and can't be uninstalled. Instead, add --ignore-installed flag to pip command so that pyserial 2.7 will be installed without the need to uninstall 3.0.1. --- tests/script/bootstrap/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/bootstrap/common.sh b/tests/script/bootstrap/common.sh index c3cd90e..abfef88 100644 --- a/tests/script/bootstrap/common.sh +++ b/tests/script/bootstrap/common.sh @@ -184,7 +184,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 pip install --ignore-installed --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt COMMON_SOURCED=1 fi From 805ac2d207da21019e19b6ce197c100ca75834d5 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Wed, 13 Nov 2019 01:01:39 -0700 Subject: [PATCH 8/9] Fix missing path in bootstrap.sh breaking CI Add DEPENDENCIES_FOLDER path to ARDUINO_FILE missing in subshell. Also add additional debug output viewable in CI log. --- tests/script/bootstrap/arduino.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/script/bootstrap/arduino.sh b/tests/script/bootstrap/arduino.sh index f118646..d64fc4b 100644 --- a/tests/script/bootstrap/arduino.sh +++ b/tests/script/bootstrap/arduino.sh @@ -29,13 +29,15 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then echo "Downloading Arduino IDE..." download $ARDUINO_URL $ARDUINO_FILE - if [[ ! "$(file --mime-type $ARDUINO_FILE)" =~ application\/zip ]]; then + download_type="$(file --mime-type $DEPENDENCIES_FOLDER/$ARDUINO_FILE)" + if [[ ! "$download_type" =~ application\/zip ]]; then mv $ARDUINO_FILE "bad-$ARDUINO_FILE" echo echo "[ERROR] Unable to download valid IDE for testing" - echo " Download the IDE manually then try again." + echo " Downloaded file should be a zip but is: ${download_type##* }." echo + echo " Download the IDE manually then try again." echo " Download from: https://www.arduino.cc/en/Main/Software" echo " Save to : $DEPENDENCIES_FOLDER" exit 1 From 6261f9d8ea170ada8c46ca45b4d41fbbefe87631 Mon Sep 17 00:00:00 2001 From: Alissa Huskey <alissa.huskey@gmail.com> Date: Wed, 13 Nov 2019 01:10:04 -0700 Subject: [PATCH 9/9] Fix bootstrap IDE type check to allow for gzip --- tests/script/bootstrap/arduino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/bootstrap/arduino.sh b/tests/script/bootstrap/arduino.sh index d64fc4b..fe163a0 100644 --- a/tests/script/bootstrap/arduino.sh +++ b/tests/script/bootstrap/arduino.sh @@ -30,7 +30,7 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then download $ARDUINO_URL $ARDUINO_FILE download_type="$(file --mime-type $DEPENDENCIES_FOLDER/$ARDUINO_FILE)" - if [[ ! "$download_type" =~ application\/zip ]]; then + if [[ ! "$download_type" =~ zip ]]; then mv $ARDUINO_FILE "bad-$ARDUINO_FILE" echo