tests: Exit early if startup fails
There is no point trying to go through the tests if hostapd and wpa_supplicant processes cannot be started properly. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
		
							parent
							
								
									6ca3a98bc2
								
							
						
					
					
						commit
						8d0825d655
					
				
					 3 changed files with 30 additions and 5 deletions
				
			
		|  | @ -4,7 +4,10 @@ errors=0 | |||
| umask 0002 | ||||
| 
 | ||||
| if [ "x$1" = "xconcurrent-valgrind" ]; then | ||||
|     ./start-p2p-concurrent.sh valgrind | ||||
|     if ! ./start-p2p-concurrent.sh valgrind; then | ||||
| 	echo "Could not start test environment" > logs/last-debug | ||||
| 	exit 1 | ||||
|     fi | ||||
|     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` | ||||
|     rm logs/last-debug | ||||
|     for i in autogo discovery grpform; do | ||||
|  | @ -22,7 +25,10 @@ if [ "x$1" = "xconcurrent-valgrind" ]; then | |||
| 	exit 1 | ||||
|     fi | ||||
| elif [ "x$1" = "xconcurrent" ]; then | ||||
|     ./start-p2p-concurrent.sh | ||||
|     if ! ./start-p2p-concurrent.sh; then | ||||
| 	echo "Could not start test environment" > logs/last-debug | ||||
| 	exit 1 | ||||
|     fi | ||||
|     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` | ||||
|     rm logs/last-debug | ||||
|     for i in autogo discovery grpform; do | ||||
|  | @ -35,7 +41,10 @@ elif [ "x$1" = "xconcurrent" ]; then | |||
| 	exit 1 | ||||
|     fi | ||||
| elif [ "x$1" = "xvalgrind" ]; then | ||||
|     ./start.sh valgrind | ||||
|     if ! ./start.sh valgrind; then | ||||
| 	echo "Could not start test environment" > logs/last-debug | ||||
| 	exit 1 | ||||
|     fi | ||||
|     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` | ||||
|     ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 | ||||
|     cat logs/$DATE-run > logs/last-debug | ||||
|  | @ -50,7 +59,10 @@ elif [ "x$1" = "xvalgrind" ]; then | |||
| 	exit 1 | ||||
|     fi | ||||
| elif [ "x$1" = "xtrace" ]; then | ||||
|     ./start.sh trace | ||||
|     if ! ./start.sh trace; then | ||||
| 	echo "Could not start test environment" > logs/last-debug | ||||
| 	exit 1 | ||||
|     fi | ||||
|     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` | ||||
|     sudo trace-cmd record -o logs/$DATE-trace.dat -e mac80211 -e cfg80211 su $USER -c "./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed" || errors=1 | ||||
|     if [ -e logs/$DATE-failed ]; then | ||||
|  | @ -64,7 +76,10 @@ elif [ "x$1" = "xtrace" ]; then | |||
| 	exit 1 | ||||
|     fi | ||||
| else | ||||
|     ./start.sh | ||||
|     if ! ./start.sh; then | ||||
| 	echo "Could not start test environment" > logs/last-debug | ||||
| 	exit 1 | ||||
|     fi | ||||
|     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` | ||||
|     ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 | ||||
|     cat logs/$DATE-run > logs/last-debug | ||||
|  | @ -74,3 +89,5 @@ else | |||
| 	exit 1 | ||||
|     fi | ||||
| fi | ||||
| 
 | ||||
| echo "ALL-PASSED" | ||||
|  |  | |||
|  | @ -47,6 +47,7 @@ for i in 0 1 2; do | |||
| 	fi | ||||
| 	if [ $j = "10" ]; then | ||||
| 	    echo "Could not connect to /tmp/wpas-wlan$i" | ||||
| 	    exit 1 | ||||
| 	fi | ||||
| 	sleep 1 | ||||
|     done | ||||
|  | @ -58,6 +59,9 @@ for j in `seq 1 10`; do | |||
|     fi | ||||
|     if [ $j = "10" ]; then | ||||
| 	echo "Could not connect to /var/run/hostapd-global" | ||||
| 	exit 1 | ||||
|     fi | ||||
|     sleep 1 | ||||
| done | ||||
| 
 | ||||
| exit 0 | ||||
|  |  | |||
|  | @ -52,6 +52,7 @@ for i in 0 1 2; do | |||
| 	fi | ||||
| 	if [ $j = "10" ]; then | ||||
| 	    echo "Could not connect to /tmp/wpas-wlan$i" | ||||
| 	    exit 1 | ||||
| 	fi | ||||
| 	sleep 1 | ||||
|     done | ||||
|  | @ -63,6 +64,9 @@ for j in `seq 1 10`; do | |||
|     fi | ||||
|     if [ $j = "10" ]; then | ||||
| 	echo "Could not connect to /var/run/hostapd-global" | ||||
| 	exit 1 | ||||
|     fi | ||||
|     sleep 1 | ||||
| done | ||||
| 
 | ||||
| exit 0 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Jouni Malinen
						Jouni Malinen