Browse Source

Update platform tests to use '.test' folder

Scott Lahteine 6 years ago
parent
commit
05dc79e78d

+ 7 - 3
.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:

+ 2 - 2
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

+ 6 - 21
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"

+ 11 - 13
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

+ 1 - 2
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/

+ 6 - 1
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

+ 5 - 3
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

+ 5 - 3
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

+ 4 - 7
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

+ 9 - 5
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

Some files were not shown because too many files changed in this diff