@@ -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,32 @@ 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
+ set +o errexit
519
+ disable_verbosity
520
+ exit " $arduinoPreferenceSettingExitStatus "
521
+ fi
509
522
fi
510
523
511
524
# Install the package
525
+ # grep returns 1 when a line matches the regular expression so it's necessary to unset errexit
526
+ set +o errexit
512
527
# 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 "
528
+ 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]} "
529
+ set -o errexit
530
+ # this is required because otherwise the exit status of arduino is ignored
531
+ if [[ " $arduinoInstallPackageExitStatus " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
532
+ set +o errexit
533
+ disable_verbosity
534
+ exit " $arduinoInstallPackageExitStatus "
535
+ fi
514
536
515
537
fi
516
538
fi
@@ -802,7 +824,7 @@ function build_this_sketch()
802
824
while [[ $arduinoExitStatus -gt $ARDUINO_CI_SCRIPT_HIGHEST_ACCEPTABLE_ARDUINO_EXIT_STATUS && $verifyCount -le $ARDUINO_CI_SCRIPT_SKETCH_VERIFY_RETRIES ]]; do
803
825
# Verify the sketch
804
826
# 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]} "
827
+ " ${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
828
local verifyCount=$(( verifyCount + 1 ))
807
829
done
808
830
0 commit comments