| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | # Test script for continuous integration. | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-05 15:19:37 -04:00
										 |  |  | # Stop script early on any error; check variables | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  | set -eu | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | # Paths to tools installed by ci-install.sh | 
					
						
							| 
									
										
										
										
											2018-06-28 15:03:41 -04:00
										 |  |  | MAIN_DIR=${PWD} | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | BUILD_DIR=${PWD}/ci_build | 
					
						
							| 
									
										
										
										
											2018-06-28 16:17:34 -04:00
										 |  |  | export PATH=${BUILD_DIR}/pru-gcc/bin:${PATH} | 
					
						
							| 
									
										
										
										
											2023-02-21 02:15:01 +01:00
										 |  |  | export PATH=${BUILD_DIR}/or1k-linux-musl-cross/bin:${PATH} | 
					
						
							| 
									
										
										
										
											2018-06-28 15:03:41 -04:00
										 |  |  | PYTHON=${BUILD_DIR}/python-env/bin/python | 
					
						
							| 
									
										
										
										
											2021-10-01 19:33:15 -04:00
										 |  |  | PYTHON2=${BUILD_DIR}/python2-env/bin/python | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  | ###################################################################### | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | # Section grouping output message helpers | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | start_test() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-09-25 22:13:56 -04:00
										 |  |  |     echo "::group::=============== $1 $2" | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  |     set -x | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | finish_test() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     set +x | 
					
						
							|  |  |  |     echo "=============== Finished $2" | 
					
						
							| 
									
										
										
										
											2020-09-25 22:13:56 -04:00
										 |  |  |     echo "::endgroup::" | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-28 13:00:54 -04:00
										 |  |  | ###################################################################### | 
					
						
							|  |  |  | # Check for whitespace errors | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-08 09:29:13 -04:00
										 |  |  | start_test check_whitespace "Check whitespace" | 
					
						
							| 
									
										
										
										
											2019-06-23 17:44:48 -04:00
										 |  |  | ./scripts/check_whitespace.sh | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  | finish_test check_whitespace "Check whitespace" | 
					
						
							| 
									
										
										
										
											2018-06-28 13:00:54 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | ###################################################################### | 
					
						
							|  |  |  | # Run compile tests for several different MCU types | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-28 15:03:41 -04:00
										 |  |  | DICTDIR=${BUILD_DIR}/dict | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | mkdir -p ${DICTDIR} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | for TARGET in test/configs/*.config ; do | 
					
						
							| 
									
										
										
										
											2018-08-01 14:05:31 -04:00
										 |  |  |     start_test mcu_compile "$TARGET" | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  |     make clean | 
					
						
							|  |  |  |     make distclean | 
					
						
							|  |  |  |     unset CC | 
					
						
							|  |  |  |     cp ${TARGET} .config | 
					
						
							|  |  |  |     make olddefconfig | 
					
						
							|  |  |  |     make V=1 | 
					
						
							| 
									
										
										
										
											2020-12-10 10:51:54 -05:00
										 |  |  |     size out/*.elf | 
					
						
							| 
									
										
										
										
											2018-07-05 11:49:10 -04:00
										 |  |  |     finish_test mcu_compile "$TARGET" | 
					
						
							| 
									
										
										
										
											2018-07-08 09:29:13 -04:00
										 |  |  |     cp out/klipper.dict ${DICTDIR}/$(basename ${TARGET} .config).dict | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | # Verify klippy host software | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-01 20:57:26 -04:00
										 |  |  | start_test klippy "Test klippy import (Python3)" | 
					
						
							|  |  |  | $PYTHON klippy/klippy.py --import-test | 
					
						
							|  |  |  | finish_test klippy "Test klippy import (Python3)" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | start_test klippy "Test klippy import (Python2)" | 
					
						
							|  |  |  | $PYTHON2 klippy/klippy.py --import-test | 
					
						
							|  |  |  | finish_test klippy "Test klippy import (Python2)" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-01 19:33:15 -04:00
										 |  |  | start_test klippy "Test invoke klippy (Python3)" | 
					
						
							| 
									
										
										
										
											2017-09-11 20:53:32 -04:00
										 |  |  | $PYTHON scripts/test_klippy.py -d ${DICTDIR} test/klippy/*.test | 
					
						
							| 
									
										
										
										
											2021-10-01 19:33:15 -04:00
										 |  |  | finish_test klippy "Test invoke klippy (Python3)" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | start_test klippy "Test invoke klippy (Python2)" | 
					
						
							|  |  |  | $PYTHON2 scripts/test_klippy.py -d ${DICTDIR} test/klippy/*.test | 
					
						
							|  |  |  | finish_test klippy "Test invoke klippy (Python2)" |