| [97a858] | 1 | #!/bin/bash -x
 | 
|---|
 | 2 | #
 | 
|---|
 | 3 | # here, we check a release for every possible enable/disable combination.
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | # we enable or disable according to a bit combination of length #packets
 | 
|---|
 | 6 | packets=("debug" "qtgui" "jobmarket" "vmg" "ecut") #"python"
 | 
|---|
 | 7 | length=${#packets[*]}
 | 
|---|
 | 8 | end=`units "2^$length" | awk -F": " {'print $2'}`
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | function bitcheck {
 | 
|---|
 | 11 |         # $1 is the bit array
 | 
|---|
 | 12 |         # $2 is the length of the bit array
 | 
|---|
 | 13 |         # $3 is the bit to check (starting at 0)
 | 
|---|
 | 14 |         # we print 0 or 1 depending on the bit
 | 
|---|
 | 15 |         let inverse=$2-$3-1
 | 
|---|
 | 16 |         bits=$1
 | 
|---|
 | 17 |         while [ $inverse -gt 0 ]; do
 | 
|---|
 | 18 |                 let bits=$bits/2
 | 
|---|
 | 19 |                 ((inverse-=1))
 | 
|---|
 | 20 |         done
 | 
|---|
 | 21 |         let bit=$bits%2
 | 
|---|
 | 22 |         echo $bit
 | 
|---|
 | 23 | }
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | if [ -z $1 ]; then
 | 
|---|
 | 26 |         echo "Usage: $0 <source repo> <path where to check> <commit> [configure flags]"
 | 
|---|
 | 27 |         exit 1
 | 
|---|
 | 28 | fi
 | 
|---|
 | 29 | SOURCEDIR="$1"
 | 
|---|
 | 30 | shift
 | 
|---|
 | 31 | DIR="$1"
 | 
|---|
 | 32 | shift
 | 
|---|
 | 33 | commit="$1"
 | 
|---|
 | 34 | shift
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | # variables to define
 | 
|---|
 | 37 | LOG="`pwd`/commitcheck-${commit}"
 | 
|---|
 | 38 | checkdir="commitchecking"
 | 
|---|
 | 39 | cores=12
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 | # check whether target is empty and create clone of git repo
 | 
|---|
 | 42 | if [ -e $DIR ]; then
 | 
|---|
 | 43 |         echo "Target directory $DIR must not be present!"
 | 
|---|
 | 44 |         exit 255
 | 
|---|
 | 45 | fi
 | 
|---|
 | 46 | echo -e "#Begin of Logfile" >${LOG}.log
 | 
|---|
 | 47 | git clone $SOURCEDIR $DIR | tee -a ${LOG}.log
 | 
|---|
 | 48 | DIR=`realpath $DIR`
 | 
|---|
 | 49 | if [ ! $? -eq 0 ]; then
 | 
|---|
 | 50 |         echo "Please install realpath package!"
 | 
|---|
 | 51 |         exit 128
 | 
|---|
 | 52 | fi
 | 
|---|
 | 53 | OLDDIR=`pwd`
 | 
|---|
 | 54 | cd $DIR
 | 
|---|
 | 55 | 
 | 
|---|
 | 56 | i=0
 | 
|---|
 | 57 | while [ $i -lt $end ]; do
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | # GENERATING configure line
 | 
|---|
 | 60 |         configureline="--enable-python "
 | 
|---|
 | 61 |         j=0
 | 
|---|
 | 62 |         while [ $j -lt ${#packets[*]} ]; do
 | 
|---|
 | 63 |                 bit=`bitcheck $i $length $j`
 | 
|---|
 | 64 |                 if [ $bit -eq 0 ]; then
 | 
|---|
 | 65 |                         configureline=${configureline}" --disable-${packets[$j]}"
 | 
|---|
 | 66 |                 else
 | 
|---|
 | 67 |                         configureline=${configureline}" --enable-${packets[$j]}"
 | 
|---|
 | 68 |                 fi
 | 
|---|
 | 69 |                 ((j+=1))
 | 
|---|
 | 70 |         done
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | # PERFORMING CHECKS
 | 
|---|
 | 73 |         git checkout -f ${commit}
 | 
|---|
 | 74 |         # copy some overrides
 | 
|---|
 | 75 |         for testfile in `find tests -name 'Makefile.am'`; do
 | 
|---|
 | 76 |                 sed -i -e "s#max_jobs = 4#max_jobs = $cores#" $testfile
 | 
|---|
 | 77 |         done
 | 
|---|
 | 78 |         ./bootstrap
 | 
|---|
 | 79 |         rm -rf $checkdir
 | 
|---|
 | 80 |         mkdir -p $checkdir
 | 
|---|
 | 81 |         cd $checkdir
 | 
|---|
 | 82 |         echo "Now testing version `git describe --dirty --always` with $configureline" &>${LOG}-${i}.log
 | 
|---|
 | 83 |         ../configure --prefix=${DIR}/$checkdir ${configureline} "$@" &>>${LOG}-${i}.log
 | 
|---|
 | 84 |         make -k -j${cores} check &>>${LOG}-${i}.log
 | 
|---|
 | 85 |         resultcode=$?
 | 
|---|
 | 86 |         # add failed testsuite.logs
 | 
|---|
 | 87 |         echo "#################################################################################" >>${LOG}-${i}.log
 | 
|---|
 | 88 |         for failedlog in `find tests/ -regex '.*/[0-9]*/.*' -name 'testsuite.log' -exec grep -l "FAILED" {} \;`; do
 | 
|---|
 | 89 |                 echo -e "\t$failedlog" >>${LOG}-${i}.log
 | 
|---|
 | 90 |                 echo "#################################################################################" >>${LOG}-${i}.log
 | 
|---|
 | 91 |                 cat <$failedlog >>${LOG}-${i}.log
 | 
|---|
 | 92 |                 echo "#################################################################################" >>${LOG}-${i}.log
 | 
|---|
 | 93 |         done
 | 
|---|
 | 94 |         if [ $resultcode -gt 0 ]; then
 | 
|---|
 | 95 |                 echo -e "${i}: `git describe --dirty --always`, ${configureline}: FAILED." >>${LOG}.log
 | 
|---|
 | 96 |         else
 | 
|---|
 | 97 |                 echo -e "${i}: `git describe --dirty --always`, ${configureline}: ok." >>${LOG}.log
 | 
|---|
 | 98 |         fi
 | 
|---|
 | 99 |         cd ..
 | 
|---|
 | 100 | 
 | 
|---|
 | 101 |         ((i+=1))
 | 
|---|
 | 102 | done
 | 
|---|
 | 103 | cd $OLDDIR
 | 
|---|