summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-12-11 13:52:25 +0100
committerChristophe Lyon <christophe.lyon@linaro.org>2017-12-11 13:52:25 +0100
commit78d2f3751f812f030441cfbb7d88c16cbe0f9c51 (patch)
tree8274b030ee4cfe0d6d05e5a7ca04a0cd5b42e41f
parent590416e8222cbb3cb824a5dc23e1577bdcc0c9cf (diff)
downloadgcc-scripts-master.tar.gz
gcc-bisect*: Support PATCH, and improve robustness.HEADmaster
-rwxr-xr-xgcc-bisect-build-helper.sh11
-rwxr-xr-xgcc-bisect-script.sh28
-rwxr-xr-xgcc-bisect.sh54
3 files changed, 82 insertions, 11 deletions
diff --git a/gcc-bisect-build-helper.sh b/gcc-bisect-build-helper.sh
new file mode 100755
index 0000000..bf0be46
--- /dev/null
+++ b/gcc-bisect-build-helper.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -x
+
+if [ x"${PATCH}" != x ]; then
+ pushd sources/gcc-fsf/${DIR}
+ git reset --hard
+ patch -p1 < ${PATCH}
+ popd
+fi
+
+RUNTESTFLAGS=${EXP}=${TESTNAME} PATH=$PWD/../work/bin:$PATH ../work/build-cross-gcc.sh --gcc-source ${DIR} --target ${TARGET} --cpu ${CPU} --fpu ${FPU} --mode ${MODE} --simu ${SIMU} ${LANGS} --target-board=${TARGETBOARD}
diff --git a/gcc-bisect-script.sh b/gcc-bisect-script.sh
index ca937c3..bac311d 100755
--- a/gcc-bisect-script.sh
+++ b/gcc-bisect-script.sh
@@ -12,6 +12,8 @@ set -x
# MODE
# SIMU
# TARGETBOARD: additional test flags
+# TESTMSG: TESTNAME with additional messages
+# PATCH: patch to apply before building
# Check if the variable NAME is set
check_set()
@@ -30,24 +32,32 @@ check_set MODE
check_set SIMU
check_set DIR
+rundir=`pwd -P`
+mydir="$(dirname $0)"
+cd "${mydir}"
+mydir="$(pwd)"
+cd ${rundir}
+
cd $HOME/src/GCC
-case ${TARGET} in
-*linux*)
- LANG="--lang fortran" ;;
-*)
- LANG="" ;;
-esac
+
+if [ x"${TESTMSG}" = x ]; then
+ TESTMSG=${TESTNAME}
+fi
echo AT `date` BISECT TRYING:
cd sources/gcc-fsf/${DIR} ; git show --format=%H -s ; cd ../../..
-RUNTESTFLAGS=${EXP}=${TESTNAME} PATH=$PWD/../work/bin:$PATH ../work/build-cross-gcc.sh --gcc-source ${DIR} --target ${TARGET} --cpu ${CPU} --fpu ${FPU} --mode ${MODE} --simu ${SIMU} ${LANG} --target-board=${TARGETBOARD} > /dev/null 2>&1
+
+PATCH=${PATCH} EXP=${EXP} TESTNAME=${TESTNAME} DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} SIMU=${SIMU} LANGS=${LANGS} TARGETBOARD=${TARGETBOARD} ${mydir}/gcc-bisect-build-helper.sh > /dev/null 2>&1
+
case ${MODE} in
thumb) SUFFIX=-thumb ;;
*) SUFFIX= ;;
esac
sums=`find builds/gcc-fsf-$DIR${SUFFIX} -name "*.sum"`
-grep ${TESTNAME} $sums | grep FAIL && exit 1 # FAILED
-grep ${TESTNAME} $sums | grep PASS && exit 0 # SUCCESS
+grep "${TESTMSG}" $sums | grep FAIL && exit 1 # FAILED
+grep "${TESTMSG}" $sums | grep PASS && exit 0 # SUCCESS
+# If we couldn't find the exact message, try with the testname
+grep "${TESTNAME}" $sums | grep FAIL && exit 1
exit 125 # If no PASS, something went wrong
diff --git a/gcc-bisect.sh b/gcc-bisect.sh
index e9b192a..889ef39 100755
--- a/gcc-bisect.sh
+++ b/gcc-bisect.sh
@@ -12,6 +12,8 @@
# MODE
# SIMU
# TARGETBOARD: additional test flags
+# TESTMSG: TESTNAME with additional messages
+# PATCH: patch to apply before building
# Check if the variable NAME is set
check_set()
@@ -31,6 +33,8 @@ check_set SIMU
check_set GOOD
check_set BAD
#check_set TARGETBOARD
+#check_set TESTMSG
+#check_set PATCH
rundir=`pwd -P`
mydir="$(dirname $0)"
@@ -49,14 +53,60 @@ cd ..
git-new-workdir trunk $DIR
cd $DIR
git checkout -b $DIR fsf/master
-git bisect start
+
+
GOODSHA1=`git log --format=format:"%H" --grep=trunk@${GOOD} master`
BADSHA1=`git log --format=format:"%H" --grep=trunk@${BAD} master`
echo GOOD: $GOODSHA1
echo BAD: $BADSHA1
+[ "x${GOODSHA1}" = "x" ] && echo "Could not find good revision: $GOOD" && exit 1
+[ "x${BADSHA1}" = "x" ] && echo "Could not find bad revision: $BAD" && exit 1
+
+case ${MODE} in
+thumb) SUFFIX=-thumb ;;
+*) SUFFIX= ;;
+esac
+
+case ${TARGET} in
+*linux*)
+ LANGS="--lang fortran" ;;
+*)
+ LANGS="" ;;
+esac
+
+set -x
+echo CHECKING GOOD:
+git checkout ${GOODSHA1}
+pushd $HOME/src/GCC
+PATCH=${PATCH} EXP=${EXP} TESTNAME=${TESTNAME} DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} SIMU=${SIMU} LANGS=${LANGS} TARGETBOARD=${TARGETBOARD} ${mydir}/gcc-bisect-build-helper.sh > /dev/null 2>&1
+sums=`find builds/gcc-fsf-$DIR${SUFFIX} -name "*.sum"`
+grep "${TESTMSG}" $sums | grep FAIL
+good_nb_fail=$(grep "${TESTMSG}" $sums | grep -c FAIL)
+good_nb_pass=$(grep "${TESTMSG}" $sums | grep -c PASS)
+popd
+
+echo CHECKING BAD:
+git checkout ${BADSHA1}
+pushd $HOME/src/GCC
+PATCH=${PATCH} EXP=${EXP} TESTNAME=${TESTNAME} DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} SIMU=${SIMU} LANGS=${LANGS} TARGETBOARD=${TARGETBOARD} ${mydir}/gcc-bisect-build-helper.sh > /dev/null 2>&1
+sums=`find builds/gcc-fsf-$DIR${SUFFIX} -name "*.sum"`
+grep "${TESTMSG}" $sums | grep FAIL
+bad_nb_fail=$(grep "${TESTMSG}" $sums | grep -c FAIL)
+bad_nb_pass=$(grep "${TESTMSG}" $sums | grep -c PASS)
+popd
+
+# make sure BAD has more failures than GOOD
+if [ $bad_nb_fail -le $good_nb_fail ]; then
+ echo "ERROR: BAD ($BAD) does not have more failures ($bad_nb_fail) than GOOD ($GOOD) ($good_nb_fail)"
+ exit 1
+fi
+
+git checkout fsf/master
+git bisect start
git bisect good ${GOODSHA1}
git bisect bad ${BADSHA1}
-EXP=${EXP} TESTNAME=${TESTNAME} DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} SIMU=${SIMU} TARGETBOARD=${TARGETBOARD} git bisect run ${mydir}/gcc-bisect-script.sh
+TESTMSG=$(echo ${TESTMSG} | sed -e 's/\\/./g' -e 's/\[/./g' -e 's/]/./g')
+EXP=${EXP} TESTNAME=${TESTNAME} TESTMSG="${TESTMSG}" DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} SIMU=${SIMU} TARGETBOARD=${TARGETBOARD} PATCH=${PATCH} LANGS=${LANGS} git bisect run ${mydir}/gcc-bisect-script.sh