@@ -28,6 +28,9 @@ readonly ARDUINO_CI_SCRIPT_REPORT_PUSH_RETRIES=10
28
28
readonly ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS=0
29
29
readonly ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS=1
30
30
31
+ # Arduino IDE 1.8.2 and newer generates a ton of garbage output (appears to be something related to jmdns) that must be filtered for the log to be readable and to avoid exceeding the maximum log length
32
+ readonly ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX=' (^\[SocketListener\(travis-job-*|^ *[0-9][0-9]*: [0-9a-g][0-9a-g]*|^dns\[query,[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*:[0-9][0-9]*, length=[0-9][0-9]*, id=|^dns\[response,[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*:[0-9][0-9]*, length=[0-9][0-9]*, id=|^questions:$|\[DNSQuestion@|^\.\]$|^\.\]\]$|^.\.\]$|^.\.\]\]$)'
33
+
31
34
# Default value
32
35
ARDUINO_CI_SCRIPT_TOTAL_SKETCH_BUILD_FAILURE_COUNT=0
33
36
@@ -504,13 +507,28 @@ function install_package()
504
507
505
508
# If defined add the boards manager URL to preferences
506
509
if [[ " $packageURL " != " " ]]; then
510
+
511
+ # grep returns 1 when a line matches the regular expression so it's necessary to unset errexit
512
+ set +o errexit
507
513
# shellcheck disable=SC2086
508
- eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino\" --pref boardsmanager.additional.urls=" $packageURL " --save-prefs " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT "
514
+ eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino\" --pref boardsmanager.additional.urls=" $packageURL " --save-prefs " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT " | tr -Cd ' [:print:]\n\t' | grep -E -v " $ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX " ; local -r arduinoPreferenceSettingExitStatus=" ${PIPESTATUS[0]} "
515
+ set -o errexit
516
+ # this is required because otherwise the exit status of arduino is ignored
517
+ if [[ " $arduinoPreferenceSettingExitStatus " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
518
+ return_handler " $arduinoPreferenceSettingExitStatus "
519
+ fi
509
520
fi
510
521
511
522
# Install the package
523
+ # grep returns 1 when a line matches the regular expression so it's necessary to unset errexit
524
+ set +o errexit
512
525
# shellcheck disable=SC2086
513
- eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino\" --install-boards " $packageID " " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT "
526
+ eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino\" --install-boards " $packageID " " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT " | tr -Cd ' [:print:]\n\t' | grep -E -v " $ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX " ; local -r arduinoInstallPackageExitStatus=" ${PIPESTATUS[0]} "
527
+ set -o errexit
528
+ # this is required because otherwise the exit status of arduino is ignored
529
+ if [[ " $arduinoInstallPackageExitStatus " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
530
+ return_handler " $arduinoPreferenceSettingExitStatus "
531
+ fi
514
532
515
533
fi
516
534
fi
@@ -802,7 +820,7 @@ function build_this_sketch()
802
820
while [[ $arduinoExitStatus -gt $ARDUINO_CI_SCRIPT_HIGHEST_ACCEPTABLE_ARDUINO_EXIT_STATUS && $verifyCount -le $ARDUINO_CI_SCRIPT_SKETCH_VERIFY_RETRIES ]]; do
803
821
# Verify the sketch
804
822
# shellcheck disable=SC2086
805
- " ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino" $ARDUINO_CI_SCRIPT_DETERMINED_VERBOSE_BUILD --verify " $absoluteSketchName " --board " $boardID " 2>&1 | tee " $ARDUINO_CI_SCRIPT_VERIFICATION_OUTPUT_FILENAME " ; local arduinoExitStatus=" ${PIPESTATUS[0]} "
823
+ " ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} /${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} /arduino" $ARDUINO_CI_SCRIPT_DETERMINED_VERBOSE_BUILD --verify " $absoluteSketchName " --board " $boardID " 2>&1 | tr -Cd ' [:print:]\n\t ' | grep -E -v " $ARDUINO_CI_SCRIPT_ARDUINO_OUTPUT_FILTER_REGEX " | tee " $ARDUINO_CI_SCRIPT_VERIFICATION_OUTPUT_FILENAME " ; local arduinoExitStatus=" ${PIPESTATUS[0]} "
806
824
local verifyCount=$(( verifyCount + 1 ))
807
825
done
808
826
0 commit comments