| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | CIDIR=$(dirname $(readlink -fn $0)) | 
					
						
							| 
									
										
										
										
											2018-07-16 09:49:54 -06:00
										 |  |  | REALTIME=0 | 
					
						
							| 
									
										
										
										
											2018-09-26 07:12:28 -06:00
										 |  |  | TEST_TIMEOUT=600 | 
					
						
							| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | source $CIDIR/ci.functions | 
					
						
							|  |  |  | ASTETCDIR=$DESTDIR/etc/asterisk | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-17 12:07:32 -07:00
										 |  |  | if [ x"$WORK_DIR" != x ] ; then | 
					
						
							|  |  |  | 	export AST_WORK_DIR="$(readlink -f $WORK_DIR)" | 
					
						
							|  |  |  | 	mkdir -p "$AST_WORK_DIR" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | pushd $TESTSUITE_DIR | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | ./cleanup-test-remnants.sh | 
					
						
							| 
									
										
										
										
											2018-07-16 09:49:54 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 06:13:35 -06:00
										 |  |  | if [ $REALTIME -eq 1 ] ; then | 
					
						
							| 
									
										
										
										
											2018-07-24 12:29:19 -06:00
										 |  |  | 	$CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0} | 
					
						
							| 
									
										
										
										
											2018-07-16 09:49:54 -06:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-11 12:39:06 -06:00
										 |  |  | # check to see if venv scripts exist so we can use them | 
					
						
							| 
									
										
										
										
											2022-08-31 13:16:12 -06:00
										 |  |  | if [ -f ./setupVenv.sh ] ; then | 
					
						
							|  |  |  | 	echo "Running in Virtual Environment" | 
					
						
							| 
									
										
										
										
											2022-08-11 12:39:06 -06:00
										 |  |  | 	# explicitly invoking setupVenv to capture output in case of failure | 
					
						
							|  |  |  | 	./setupVenv.sh | 
					
						
							|  |  |  | 	VENVPREFIX="runInVenv.sh python " | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2022-08-31 13:16:12 -06:00
										 |  |  | 	echo "Running in Legacy Mode" | 
					
						
							| 
									
										
										
										
											2022-08-11 12:39:06 -06:00
										 |  |  | 	export PYTHONPATH=./lib/python/ | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-17 12:07:32 -07:00
										 |  |  | echo "Running tests ${TESTSUITE_COMMAND} ${AST_WORK_DIR:+with work directory ${AST_WORK_DIR}}" | 
					
						
							| 
									
										
										
										
											2022-08-11 12:39:06 -06:00
										 |  |  | ./${VENVPREFIX}runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || : | 
					
						
							| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 06:13:35 -06:00
										 |  |  | if [ $REALTIME -eq 1 ] ; then | 
					
						
							| 
									
										
										
										
											2018-07-24 12:29:19 -06:00
										 |  |  | 	$CIDIR/teardownRealtime.sh --cleanup-db=${CLEANUP_DB:?0} | 
					
						
							| 
									
										
										
										
											2018-07-17 03:03:02 -06:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | if [ -f core* ] ; then | 
					
						
							|  |  |  | 	echo "*** Found a core file after running unit tests ***" | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 	/var/lib/asterisk/scripts/ast_coredumper --no-default-search core* | 
					
						
							| 
									
										
										
										
											2018-07-11 05:14:49 -06:00
										 |  |  | 	exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 11:23:22 -04:00
										 |  |  | popd |