diff --git a/.circleci/config.yml b/.circleci/config.yml index 13a79154d8..45dbf96bb3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,11 +53,11 @@ jobs: # Generate custom version include generate_version_header_for_marlin ./Marlin/src/inc cat ./Marlin/src/inc/_Version.h + # - # Backup pins_RAMPS.h - # - cp Marlin/src/pins/pins_RAMPS.h Marlin/src/pins/pins_RAMPS.h.backup + # Back up the environment # + env_backup ################################# # Build all sample configurations @@ -279,6 +279,10 @@ jobs: # Remove temp files from dependencies tree prior to caching rm -rf ~/Marlin/.piolibdeps/_tmp_* + # + # Restore the environment + # + env_restore - save_cache: diff --git a/buildroot/bin/env_backup b/buildroot/bin/env_backup index 164582de60..392ec425c1 100755 --- a/buildroot/bin/env_backup +++ b/buildroot/bin/env_backup @@ -2,13 +2,13 @@ [ -z "$1" ] || cd $1 -if [ -d ".test" ]; then +if [ -d .test ]; then printf "\033[0;31mEnvironment backup already exists!\033[0m\n" else mkdir .test + cp -r Marlin/src/pins .test/pins cp Marlin/Configuration*.h .test/ [ -f Marlin/_Bootscreen.h ] && cp Marlin/_Bootscreen.h .test/ [ -f Marlin/_Statusscreen.h ] && cp Marlin/_Statusscreen.h .test/ - cp -r Marlin/src/pins .test/pins printf "\033[0;32mEnvironment Backup created\033[0m\n" fi diff --git a/buildroot/bin/env_restore b/buildroot/bin/env_restore index defc6d8431..ed40211c34 100755 --- a/buildroot/bin/env_restore +++ b/buildroot/bin/env_restore @@ -2,25 +2,10 @@ [ -z "$1" ] || cd $1 -if [ -d ".test" ]; then - cp .test/Configuration*.h Marlin/ - rm .test/Configuration*.h +cp Marlin/src/config/default/* Marlin/ +[ -f Marlin/_Bootscreen.h ] && rm Marlin/_Bootscreen.h +[ -f Marlin/_Statusscreen.h ] && rm Marlin/_Statusscreen.h +[ -d .test/pins ] && { cp .test/pins/* Marlin/src/pins/ ; rm -rf .test/pins ; } +[ -d .test ] && rm -r .test - if [ -f .test/_Bootscreen.h ]; then - cp .test/_Bootscreen.h Marlin/ - rm .test/_Bootscreen.h - fi - - if [ -f .test/_Statusscreen.h ]; then - cp .test/_Statusscreen.h Marlin/ - rm .test/_Statusscreen.h - fi - - cp -r .test/pins Marlin/src - rm -r .test/pins - - rmdir .test - printf "\033[0;32mEnvironment Restored\033[0m\n" -else - printf "\033[0;31mEnvironment Backup not available!\033[0m\n" -fi +printf "\033[0;32mEnvironment Restored\033[0m\n" diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs index fa1f840582..6f08363af8 100755 --- a/buildroot/bin/restore_configs +++ b/buildroot/bin/restore_configs @@ -1,17 +1,15 @@ #!/usr/bin/env bash +# +# restore_configs +# +# Restore default configs, delete pins backup and dogm bitmaps +# -cp Marlin/src/config/default/Configuration.h Marlin/Configuration.h -cp Marlin/src/config/default/Configuration_adv.h Marlin/Configuration_adv.h +# Restore the (possibly modified) Configurations +[ -d ".test" -a -f ".test/Configuration.h" ] && cp .test/Configuration*.h Marlin/ -if [ -f Marlin/src/pins/pins_RAMPS.h.backup ]; then - cp Marlin/src/pins/pins_RAMPS.h.backup Marlin/src/pins/pins_RAMPS.h - rm Marlin/src/pins/pins_RAMPS.h.backup -fi +# Restore the original unmodified pins +[ -d ".test/pins" ] && cp -r .test/pins Marlin/src/pins/ -if [ -f Marlin/_Bootscreen.h ]; then - rm Marlin/_Bootscreen.h -fi - -if [ -f Marlin/_Statusscreen.h ]; then - rm Marlin/_Statusscreen.h -fi +# Delete DOGM bitmaps +rm -f Marlin/_*screen.h diff --git a/buildroot/bin/update_defaults b/buildroot/bin/update_defaults index 6100e1050f..2379eb5ca1 100755 --- a/buildroot/bin/update_defaults +++ b/buildroot/bin/update_defaults @@ -1,4 +1,3 @@ #!/usr/bin/env bash -cp Marlin/Configuration.h Marlin/src/config/default/Configuration.h -cp Marlin/Configuration_adv.h Marlin/src/config/default/Configuration_adv.h +cp Marlin/Configuration*.h .test/ diff --git a/buildroot/share/tests/DUE_tests b/buildroot/share/tests/DUE_tests index 100cdd570b..270fa0ab37 100755 --- a/buildroot/share/tests/DUE_tests +++ b/buildroot/share/tests/DUE_tests @@ -3,9 +3,14 @@ # exit on first failure set -e -restore_configs +env_backup + opt_set MOTHERBOARD BOARD_RAMPS4DUE_EFB +update_defaults + opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS opt_set E0_AUTO_FAN_PIN 8 opt_set EXTRUDER_AUTO_FAN_SPEED 100 exec_test $1 $2 "RAMPS4DUE_EFB S_CURVE_ACCELERATION EEPROM_SETTINGS" + +env_restore diff --git a/buildroot/share/tests/LPC1768_tests b/buildroot/share/tests/LPC1768_tests index b9f1e0cf45..ee0f699cac 100755 --- a/buildroot/share/tests/LPC1768_tests +++ b/buildroot/share/tests/LPC1768_tests @@ -3,8 +3,11 @@ # exit on first failure set -e -restore_configs +env_backup + opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB +update_defaults + exec_test $1 $2 "Build Re-ARM Default Configuration" restore_configs @@ -60,5 +63,4 @@ opt_enable FAN_SOFT_PWM SDSUPPORT opt_enable USE_XMAX_PLUG exec_test $1 $2 "MKS SBASE Many less common options" -#clean up -restore_configs +env_restore diff --git a/buildroot/share/tests/STM32F1_tests b/buildroot/share/tests/STM32F1_tests index 0d1fd90991..0d9790d712 100755 --- a/buildroot/share/tests/STM32F1_tests +++ b/buildroot/share/tests/STM32F1_tests @@ -3,10 +3,12 @@ # exit on first failure set -e -restore_configs +env_backup + opt_set MOTHERBOARD BOARD_STM32F1R +update_defaults + opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT" -#cleanup -restore_configs +env_restore diff --git a/buildroot/share/tests/megaatmega2560_tests b/buildroot/share/tests/megaatmega2560_tests index faf7cd0af0..d1a13e1785 100755 --- a/buildroot/share/tests/megaatmega2560_tests +++ b/buildroot/share/tests/megaatmega2560_tests @@ -3,15 +3,13 @@ # exit on first failure set -e -# -# Backup pins_RAMPS.h -# -cp Marlin/src/pins/pins_RAMPS.h Marlin/src/pins/pins_RAMPS.h.backup +env_backup + # # Build with the default configurations # -restore_configs exec_test $1 $2 "Default Configuration" + # # Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4 # Test a "Fix Mounted" Probe with Safe Homing, some arc options, @@ -311,5 +309,4 @@ exec_test $1 $2 "TMC2208 Config" # # -#clean up -restore_configs +env_restore diff --git a/buildroot/share/tests/start_tests b/buildroot/share/tests/start_tests index 53c24f44d8..6905d80a7c 100755 --- a/buildroot/share/tests/start_tests +++ b/buildroot/share/tests/start_tests @@ -1,11 +1,17 @@ #!/usr/bin/env bash +# +# start_tests +# +# Run one or more tests +# + export PATH="$PATH:$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )" export PATH="$PATH:./buildroot/bin" # exit on first failure set -e -exec_test () { +exec_test() { printf "\033[0;32m[Test $2] \033[0m$3... " if build_marlin_pio $1 "-e $2"; then printf "\033[0;32mPassed\033[0m\n" @@ -18,9 +24,6 @@ exec_test () { } export -f exec_test -env_backup -printf "Running \033[0;32m$2\033[0m Tests\n" - if [[ $3 = "--deep-clean" ]]; then echo "Deleting all PlatformIO caches, downloads and installed packages..." env_clean --deep @@ -36,8 +39,9 @@ if [[ $2 = "ALL" ]]; then $f $1 $testenv done else + printf "Running \033[0;32m$2\033[0m Tests\n" exec_test $1 "$2 --target clean" "Setup Build Environment" $2_tests $1 $2 fi + printf "\033[0;32mAll tests completed successfully\033[0m\n" -env_restore diff --git a/buildroot/share/tests/teensy35_tests b/buildroot/share/tests/teensy35_tests index 0adb977cbc..4ed4ba6a20 100755 --- a/buildroot/share/tests/teensy35_tests +++ b/buildroot/share/tests/teensy35_tests @@ -3,9 +3,11 @@ # exit on first failure set -e -restore_configs +env_backup + opt_set MOTHERBOARD BOARD_TEENSY35_36 -cp Marlin/src/pins/pins_RAMPS.h Marlin/src/pins/pins_RAMPS.h.backup +update_defaults + # # Test Teensy3.5 with default config # @@ -92,5 +94,4 @@ opt_add_adv Z2_MAX_PIN 2 opt_enable USE_XMAX_PLUG exec_test $1 $2 "Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS" -#cleanup -restore_configs +env_restore