Changeset 787510d in mainline
- Timestamp:
- 2014-04-22T06:54:29Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88a0f58
- Parents:
- 170e181
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/tools/random_check.sh
r170e181 r787510d 37 37 [ -z "$COMPILERS" ] && COMPILERS="gcc_cross gcc_helenos clang" 38 38 39 40 run_clean() {41 echo " Cleaning after previous build." >&242 make distclean -j$PARALLELISM 2>&1 || exit 143 }44 45 run_random_config() {46 echo " Preparing random configuration." >&247 make random-config 2>&1 || exit 148 }49 50 run_make() {51 BASIC_CONFIG=`sed -n \52 -e 's#PLATFORM = \(.*\)#\1#p' \53 -e 's#MACHINE = \(.*\)#\1#p' \54 -e 's#COMPILER = \(.*\)#\1#p' \55 Makefile.config \56 | paste '-sd,' | sed 's#,#, #g'`57 58 echo -n " Building ($BASIC_CONFIG)... " >&259 60 make -j$PARALLELISM 2>&161 if [ $? -eq 0 ]; then62 echo "okay." >&263 return 064 else65 echo "failed." >&266 return 167 fi68 }69 70 71 72 39 COUNTER=0 73 40 FAILED=0 74 SKIPPED=075 41 while [ $COUNTER -lt $LOOPS ]; do 76 42 COUNTER=$(( $COUNTER + 1 )) 77 echo "Try #$COUNTER (F$FAILED/S$SKIPPED):" >&2 43 echo "Try #$COUNTER ($FAILED failed):" >&2 44 78 45 ( 79 run_clean 80 run_random_config 81 CC=`sed -n 's#^COMPILER = \(.*\)#\1#p' <Makefile.config` 82 if ! echo " $COMPILERS " | grep -q " $CC "; then 83 echo " Skipping this one (compiler is $CC)." >&2 84 exit 2 46 echo " Cleaning after previous build." >&2 47 make distclean -j$PARALLELISM 2>&1 || exit 1 48 49 50 echo " Preparing random configuration." >&2 51 # It would be nicer to allow set the constraints directly to 52 # the tools/config.py script but this usually works. 53 # We retry several times if the compiler is wrong and abort if 54 # we do not succeed after many attempts. 55 RETRIES=0 56 while true; do 57 RETRIES=$(( $RETRIES + 1 )) 58 if [ $RETRIES -ge 20 ]; then 59 echo " Failed to generate random configuration with given constraints after $RETRIES tries." >&2 60 exit 2 61 fi 62 63 make random-config 2>&1 || exit 1 64 65 CC=`sed -n 's#^COMPILER = \(.*\)#\1#p' <Makefile.config` 66 if echo " $COMPILERS " | grep -q " $CC "; then 67 break 68 fi 69 done 70 71 72 # Report basic info about the configuration and build it 73 BASIC_CONFIG=`sed -n \ 74 -e 's#PLATFORM = \(.*\)#\1#p' \ 75 -e 's#MACHINE = \(.*\)#\1#p' \ 76 -e 's#COMPILER = \(.*\)#\1#p' \ 77 Makefile.config \ 78 | paste '-sd,' | sed 's#,#, #g'` 79 echo -n " Building ($BASIC_CONFIG)... " >&2 80 81 make -j$PARALLELISM 2>&1 82 if [ $? -eq 0 ]; then 83 echo "okay." >&2 84 exit 0 85 else 86 echo "failed." >&2 87 exit 1 85 88 fi 86 run_make 87 exit $? 89 88 90 ) >random_run_$COUNTER.log 89 91 RC=$? 90 if [ $RC -eq 2 ]; then 91 SKIPPED=$(( $SKIPPED + 1 )) 92 elif [ $RC -ne 0 ]; then 92 93 if [ $RC -ne 0 ]; then 93 94 tail -n 10 random_run_$COUNTER.log | sed 's#.*# | &#' 94 95 FAILED=$(( $FAILED + 1 )) 95 96 fi 96 cp Makefile.config random_run_$COUNTER.Makefile.config 97 cp config.h random_run_$COUNTER.config.h 97 98 if [ -e Makefile.config ]; then 99 cp Makefile.config random_run_$COUNTER.Makefile.config 100 cp config.h random_run_$COUNTER.config.h 101 fi 98 102 done 99 103 100 echo "Out of $LOOPS tries, $SKIPPED were skipped and $FAILED configurations failed to compile." >&2 104 105 echo "Out of $LOOPS tries, $FAILED configurations failed to compile." >&2
Note:
See TracChangeset
for help on using the changeset viewer.