... | ... | @@ -22,53 +22,87 @@ $ git bisect run ghc-bisect.sh |
|
|
This will run the script for each point in the bisection, skipping commits which are unbuildable. Hopefully this will end with a message informing you of the first bad commit. A log of this procedure will be place in `$logs`: `$logs/all` gives a nice high-level overview and the remaining files record each step of the bisection.
|
|
|
|
|
|
|
|
|
|
|
|
By default the script will clean the tree for every commit. While this is likely to give correct results, it performs a number of potentially redundant rebuilds. The process can be made faster by setting `ALWAYS_CLEAN=0`, which will only clean the tree when a commit fails to build.
|
|
|
|
|
|
|
|
|
## ghc-bisect.sh
|
|
|
|
|
|
|
|
|
```
|
|
|
#!/bin/bash
|
|
|
logs=/mnt/work/ghc/tickets/T13930/logs
|
|
|
make_opts="-j9"ghc=`pwd`/inplace/bin/ghc-stage2
|
|
|
|
|
|
mkdir -p $logsrev=$(git rev-parse HEAD)# Bisection step return codes
|
|
|
function skip_commit(){exit125;}function commit_good(){exit0;}function commit_bad(){exit1;}function stop_bisection(){exit255;}function log(){echo"$@"| tee -a $logs/all
|
|
|
}function do_it(){step=$1shift
|
|
|
log "Commit $rev: $step = $@"$@2>&1| tee $logs/$rev-$step.log
|
|
|
logs=/mnt/work/ghc/tickets/T13930/logs
|
|
|
make_opts="-j9"
|
|
|
ghc=`pwd`/inplace/bin/ghc-stage2
|
|
|
|
|
|
mkdir -p $logs
|
|
|
rev=$(git rev-parse HEAD)
|
|
|
|
|
|
# Bisection step return codes
|
|
|
function skip_commit() { exit 125; }
|
|
|
function commit_good() { exit 0; }
|
|
|
function commit_bad() { exit 1; }
|
|
|
function stop_bisection() { exit 255; }
|
|
|
|
|
|
function log() {
|
|
|
echo "$@" | tee -a $logs/all
|
|
|
}
|
|
|
|
|
|
function do_it() {
|
|
|
step=$1
|
|
|
shift
|
|
|
log "Commit $rev: $step = $@"
|
|
|
$@ 2>&1 | tee $logs/$rev-$step.log
|
|
|
ret="${PIPESTATUS[0]}"
|
|
|
log "Commit $rev: $step = $ret"return$ret}function build_ghc(){
|
|
|
log "Commit $rev: $step = $ret"
|
|
|
return $ret
|
|
|
}
|
|
|
|
|
|
function build_ghc() {
|
|
|
do_it submodules git submodule update || skip_commit
|
|
|
# We run `make` twice as sometimes it will spuriously fail with -j
|
|
|
if[ -z "$ALWAYS_CLEAN" -o "x$ALWAYS_CLEAN"=="x0"];then# First try building without cleaning, if that fails then clean and try again
|
|
|
do_it ghc1 make $make_opts||\
|
|
|
do_it ghc2 make $make_opts||\
|
|
|
do_it clean make clean &&\
|
|
|
do_it ghc3 make $make_opts||\
|
|
|
do_it ghc4 make $make_opts||\
|
|
|
if [ -z "$ALWAYS_CLEAN" -o "x$ALWAYS_CLEAN" == "x0" ]; then
|
|
|
# First try building without cleaning, if that fails then clean and try again
|
|
|
do_it ghc1 make $make_opts || \
|
|
|
do_it ghc2 make $make_opts || \
|
|
|
do_it clean make clean && \
|
|
|
do_it ghc3 make $make_opts || \
|
|
|
do_it ghc4 make $make_opts || \
|
|
|
skip_commit
|
|
|
else
|
|
|
do_it clean make clean || log "clean failed"
|
|
|
do_it ghc1 make $make_opts|| do_it ghc2 make $make_opts|| skip_commit
|
|
|
fi}# This is the actual testcase
|
|
|
do_it ghc1 make $make_opts || do_it ghc2 make $make_opts || skip_commit
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# This is the actual testcase
|
|
|
# Note that this particular case depended upon the `cabal`
|
|
|
# library, which is checked out in $tree
|
|
|
function run_test(){tree=$HOME/trees/cabal
|
|
|
cd$tree#do_it "clean-test" rm -R dist-newstyle
|
|
|
function run_test() {
|
|
|
tree=$HOME/trees/cabal
|
|
|
cd $tree
|
|
|
#do_it "clean-test" rm -R dist-newstyle
|
|
|
do_it "build-test" cabal new-build cabal-install --disable-library-profiling --allow-newer=time --with-compiler=$ghc
|
|
|
do_it "make-links" /home/ben/.env/bin/mk-cabal-bin.sh
|
|
|
do_it "run-test" timeout 10 bin/cabal configure
|
|
|
|
|
|
# The test has succeeded if the rule fired
|
|
|
if["x$?"="x124"];then
|
|
|
if [ "x$?" = "x124" ]; then
|
|
|
log "Commit $rev: failed"
|
|
|
commit_bad
|
|
|
else
|
|
|
log "Commit $rev: passed"
|
|
|
commit_good
|
|
|
fi}if[ -z "$@"];then
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
if [ -z "$@" ]; then
|
|
|
build_ghc
|
|
|
run_test
|
|
|
else$@fi
|
|
|
else
|
|
|
$@
|
|
|
fi
|
|
|
```
|
|
|
|
|
|
## Gotchas
|
... | ... | |