Fix bashims in configure and gcctestsuite.sh.
configure and gcctestsuite.sh shell scripts contains bashisms although being bourne shell script. This patch fixes the following bashisms: * Use of $RANDOM variable (replaced by reading in /dev/urandom) * Use == in tests instead of just = * Use $[] for arithmetic computation istead of $(())
This commit is contained in:
		
							parent
							
								
									a867f42597
								
							
						
					
					
						commit
						dc265feb63
					
				
					 2 changed files with 19 additions and 9 deletions
				
			
		
							
								
								
									
										20
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -11,11 +11,21 @@ else | |||
|     TMPDIR1="/tmp" | ||||
| fi | ||||
| 
 | ||||
| TMPC="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c" | ||||
| TMPO="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.o" | ||||
| TMPE="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}" | ||||
| TMPS="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.S" | ||||
| TMPH="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.h" | ||||
| RDM1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| RDM2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| TMPC="${TMPDIR1}/tcc-conf-${RDM1}-$$-${RDM2}.c" | ||||
| RDM1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| RDM2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| TMPO="${TMPDIR1}/tcc-conf-${RDM1}-$$-${RDM2}.o" | ||||
| RDM1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| RDM2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| TMPE="${TMPDIR1}/tcc-conf-${RDM1}-$$-${RDM2}" | ||||
| RDM1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| RDM2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| TMPS="${TMPDIR1}/tcc-conf-${RDM1}-$$-${RDM2}.S" | ||||
| RDM1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| RDM2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )" | ||||
| TMPH="${TMPDIR1}/tcc-conf-${RDM1}-$$-${RDM2}.h" | ||||
| 
 | ||||
| # default parameters | ||||
| build_cross="no" | ||||
|  |  | |||
|  | @ -8,11 +8,11 @@ nb_failed="0" | |||
| for src in $TESTSUITE_PATH/compile/*.c ; do | ||||
|   echo $TCC -o /tmp/test.o -c $src  | ||||
|   $TCC -o /tmp/test.o -c $src >> tcc.log 2>&1 | ||||
|   if [ "$?" == "0" ] ; then | ||||
|   if [ "$?" = "0" ] ; then | ||||
|      result="PASS" | ||||
|   else | ||||
|      result="FAIL" | ||||
|      nb_failed=$[ $nb_failed + 1 ] | ||||
|      nb_failed=$(( $nb_failed + 1 )) | ||||
|   fi | ||||
|   echo "$result: $src"  >> tcc.sum | ||||
| done | ||||
|  | @ -20,11 +20,11 @@ done | |||
| for src in $TESTSUITE_PATH/execute/*.c ; do | ||||
|   echo $TCC $src  | ||||
|   $TCC $src >> tcc.log 2>&1 | ||||
|   if [ "$?" == "0" ] ; then | ||||
|   if [ "$?" = "0" ] ; then | ||||
|      result="PASS" | ||||
|   else | ||||
|      result="FAIL" | ||||
|      nb_failed=$[ $nb_failed + 1 ] | ||||
|      nb_failed=$(( $nb_failed + 1 )) | ||||
|   fi | ||||
|   echo "$result: $src"  >> tcc.sum | ||||
| done | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue