summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2016-12-13 14:37:13 +0100
committerChristophe Lyon <christophe.lyon@linaro.org>2016-12-13 14:37:13 +0100
commit590416e8222cbb3cb824a5dc23e1577bdcc0c9cf (patch)
tree2103021592b82c4bd6bbef86f54764325d2be74e
parent5f585eda11e1f1570dc705caa019b943f52225d6 (diff)
downloadgcc-scripts-590416e8222cbb3cb824a5dc23e1577bdcc0c9cf.tar.gz
Add GCC bisect scripts
-rwxr-xr-xclean-bisect.sh23
-rwxr-xr-xgcc-bisect-build-only-script.sh37
-rwxr-xr-xgcc-bisect-build-only.sh48
-rwxr-xr-xgcc-bisect-script.sh53
-rwxr-xr-xgcc-bisect.sh62
5 files changed, 223 insertions, 0 deletions
diff --git a/clean-bisect.sh b/clean-bisect.sh
new file mode 100755
index 0000000..a62e8ee
--- /dev/null
+++ b/clean-bisect.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# This script cleans a previous bisect for a regression
+# Input as env. variable:
+# BAD
+
+# Check if the variable NAME is set
+check_set()
+{
+ name=$1
+ eval val=\$${name}
+ [ x$val = x ] && echo $1 not set && exit 1
+}
+
+check_set BAD
+DIR=reg-$BAD
+if [ -d sources/gcc-fsf/$DIR ]; then
+ pushd sources/gcc-fsf/$DIR
+ git bisect reset
+ git checkout master
+ git branch -d $DIR
+ popd
+fi
+rm -rf sources/gcc-fsf/$DIR buids/gcc-fsf-$DIR
diff --git a/gcc-bisect-build-only-script.sh b/gcc-bisect-build-only-script.sh
new file mode 100755
index 0000000..0d1941a
--- /dev/null
+++ b/gcc-bisect-build-only-script.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# This script is a helper to bisect GCC build regressions.
+# Inputs (as env. variables):
+# DIR: directory name of gcc sources
+# TARGET
+# CPU
+# FPU
+# MODE
+
+# Check if the variable NAME is set
+check_set()
+{
+ name=$1
+ eval val=\$${name}
+ [ x$val = x ] && echo $1 not set && exit 1
+}
+
+check_set TARGET
+check_set DIR
+check_set CPU
+check_set FPU
+check_set MODE
+
+cd $HOME/src/GCC
+case ${TARGET} in
+*linux*)
+ LANG="--lang fortran" ;;
+*)
+ LANG="" ;;
+esac
+
+PATH=$PWD/../work/bin:$PATH ../work/build-cross-gcc.sh --gcc-source ${DIR} --target ${TARGET} ${LANG} --no-check --cpu ${CPU} --fpu ${FPU} --mode ${MODE}
+status=$?
+[ $status -eq 0 ] && exit 0 # SUCCESS
+[ $status -eq 9 ] && exit 1 # FAILED
+exit 125 # If no PASS, something went wrong
diff --git a/gcc-bisect-build-only.sh b/gcc-bisect-build-only.sh
new file mode 100755
index 0000000..5db926d
--- /dev/null
+++ b/gcc-bisect-build-only.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# This script is a helper to bisect GCC build regressions.
+# Inputs (as env. variables):
+# DIR: directory name of gcc sources
+# GOOD
+# BAD
+# TARGET
+# CPU
+# FPU
+# MODE
+
+# Check if the variable NAME is set
+check_set()
+{
+ name=$1
+ eval val=\$${name}
+ [ x$val = x ] && echo $1 not set && exit 1
+}
+
+check_set TARGET
+check_set DIR
+check_set GOOD
+check_set BAD
+check_set CPU
+check_set FPU
+check_set MODE
+
+rundir=`pwd -P`
+mydir="$(dirname $0)"
+cd "${mydir}"
+mydir="$(pwd)"
+cd ${rundir}
+
+cd sources/gcc-fsf/trunk || (echo Wrong start directory && exit 1)
+
+git remote update -p && git rebase
+cd ..
+git-new-workdir trunk $DIR
+cd $DIR
+git bisect start
+GOODSHA1=`git log --format=format:"%H" --grep=trunk@${GOOD} master`
+BASHA1=`git log --format=format:"%H" --grep=trunk@${BAD} master`
+
+git bisect good ${GOODSHA1}
+git bisect bad ${BASHA1}
+
+DIR=${DIR} TARGET=${TARGET} CPU=${CPU} FPU=${FPU} MODE=${MODE} git bisect run ${mydir}/gcc-bisect-build-only-script.sh
diff --git a/gcc-bisect-script.sh b/gcc-bisect-script.sh
new file mode 100755
index 0000000..ca937c3
--- /dev/null
+++ b/gcc-bisect-script.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+set -x
+
+# This script is a helper to bisect GCC regressions.
+# Inputs (as env. variables):
+# EXP: name of .exp file to run
+# TESTNAME: name of test to run
+# DIR: directory name of gcc sources
+# TARGET
+# CPU
+# FPU
+# MODE
+# SIMU
+# TARGETBOARD: additional test flags
+
+# Check if the variable NAME is set
+check_set()
+{
+ name=$1
+ eval val=\$${name}
+ [ x$val = x ] && echo $1 not set && exit 1
+}
+
+check_set EXP
+check_set TESTNAME
+check_set TARGET
+check_set CPU
+check_set FPU
+check_set MODE
+check_set SIMU
+check_set DIR
+
+cd $HOME/src/GCC
+case ${TARGET} in
+*linux*)
+ LANG="--lang fortran" ;;
+*)
+ LANG="" ;;
+esac
+
+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
+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
+exit 125 # If no PASS, something went wrong
+
diff --git a/gcc-bisect.sh b/gcc-bisect.sh
new file mode 100755
index 0000000..e9b192a
--- /dev/null
+++ b/gcc-bisect.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# This script is a helper to bisect GCC regressions.
+# Inputs (as env. variables):
+# EXP: name of .exp file to run
+# TESTNAME: name of test to run
+# GOOD
+# BAD
+# TARGET
+# CPU
+# FPU
+# MODE
+# SIMU
+# TARGETBOARD: additional test flags
+
+# Check if the variable NAME is set
+check_set()
+{
+ name=$1
+ eval val=\$${name}
+ [ x$val = x ] && echo $1 not set && exit 1
+}
+
+check_set EXP
+check_set TESTNAME
+check_set TARGET
+check_set CPU
+check_set FPU
+check_set MODE
+check_set SIMU
+check_set GOOD
+check_set BAD
+#check_set TARGETBOARD
+
+rundir=`pwd -P`
+mydir="$(dirname $0)"
+cd "${mydir}"
+mydir="$(pwd)"
+cd ${rundir}
+
+cd sources/gcc-fsf/trunk || (echo Wrong start directory && exit 1)
+
+DIR=reg-$BAD
+[ -d ../$DIR ] && echo $DIR already exists && exit 1
+
+(git remote update -p && git rebase) || exit 1
+cd ..
+#set -x
+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
+
+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