Changeset e36a1c2 in mainline


Ignore:
Timestamp:
2014-04-24T07:42:29Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b065c9
Parents:
566da7f8
Message:

Refactor random_check.sh script (uses getopts)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/tools/random_check.sh

    r566da7f8 re36a1c2  
    2929#
    3030
    31 LOOPS="$1"
    32 PARALLELISM="$2"
    33 COMPILERS="$3"
    34 [ -z "$LOOPS" ] && LOOPS=1
    35 [ -z "$PARALLELISM" ] && PARALLELISM=1
    36 # By default, skip icc and native GCC
    37 [ -z "$COMPILERS" ] && COMPILERS="gcc_cross gcc_helenos clang"
     31
     32LOOPS=1
     33JOBS=1
     34MAX_RETRIES=20
     35FILENAME_PREFIX=random_run_
     36PRUNE_CONFIG_FILE=${FILENAME_PREFIX}prune.config
     37
     38echo -n "">"$PRUNE_CONFIG_FILE"
     39
     40while getopts n:j:x: option; do
     41        case $option in
     42        n)
     43                LOOPS="$OPTARG"
     44                ;;
     45        j)
     46                JOBS="$OPTARG"
     47                ;;
     48        x)
     49                echo "$OPTARG" | tr -d ' ' >>"$PRUNE_CONFIG_FILE"
     50                ;;
     51        *)
     52                echo "Usage: $0 [-n loops] [-j paralellism] [-x excluded option [-x ...]]"
     53                exit 1
     54                ;;
     55        esac
     56done
     57
    3858
    3959COUNTER=0
     
    5171                # It would be nicer to allow set the constraints directly to
    5272                # 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.
     73                # We retry $MAX_RETRIES before aborting this run completely.
    5574                RETRIES=0
    5675                while true; do
     
    6382                        make random-config 2>&1 || exit 1
    6483                       
    65                         CC=`sed -n 's#^COMPILER = \(.*\)#\1#p' <Makefile.config`
    66                         if echo " $COMPILERS " | grep -q " $CC "; then
     84                        tr -d ' ' <Makefile.config >"${FILENAME_PREFIX}config.trimmed"
     85                       
     86                        THIS_CONFIG_OKAY=true
     87                        while read pattern; do
     88                                if grep -q -e "$pattern" "${FILENAME_PREFIX}config.trimmed"; then
     89                                        THIS_CONFIG_OKAY=false
     90                                        break
     91                                fi
     92                        done <"$PRUNE_CONFIG_FILE"
     93                       
     94                        rm -f "${FILENAME_PREFIX}config.trimmed"
     95                       
     96                        if $THIS_CONFIG_OKAY; then
    6797                                break
    6898                        fi
     
    97127       
    98128        if [ -e Makefile.config ]; then
    99                 cp Makefile.config random_run_$COUNTER.Makefile.config
    100                 cp config.h random_run_$COUNTER.config.h
     129                cp Makefile.config "$FILENAME_PREFIX$COUNTER.Makefile.config"
     130                cp config.h "$FILENAME_PREFIX$COUNTER.config.h"
    101131        fi     
    102132done
    103133
     134rm "$PRUNE_CONFIG_FILE"
    104135
    105136echo "Out of $LOOPS tries, $FAILED configurations failed to compile." >&2
Note: See TracChangeset for help on using the changeset viewer.