2013-08-08 01:54:08 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# usage:
|
|
|
|
# edit $(srcdir)/test.rb
|
2019-05-07 09:53:45 -04:00
|
|
|
# git bisect start <bad> <good>
|
2013-08-08 01:54:08 -04:00
|
|
|
# cd <builddir>
|
|
|
|
# make bisect (or bisect-ruby for full ruby)
|
|
|
|
|
|
|
|
if [ "x" = "x$MAKE" ]; then
|
|
|
|
MAKE=make
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
miniruby | ruby ) # (miniruby|ruby) <srcdir>
|
2016-10-06 01:46:55 -04:00
|
|
|
srcdir="$2"
|
2013-08-08 01:54:08 -04:00
|
|
|
builddir=`pwd` # assume pwd is builddir
|
2016-10-06 01:46:55 -04:00
|
|
|
path="$builddir/_bisect.sh"
|
2013-08-08 01:54:08 -04:00
|
|
|
echo "path: $path"
|
2016-10-06 01:46:55 -04:00
|
|
|
cp "$0" "$path"
|
|
|
|
cd "$srcdir"
|
|
|
|
set -x
|
|
|
|
exec git bisect run "$path" "run-$1"
|
2013-08-08 01:54:08 -04:00
|
|
|
;;
|
|
|
|
run-miniruby )
|
2018-02-28 22:26:05 -05:00
|
|
|
prep=mini
|
|
|
|
run=run
|
2013-08-08 01:54:08 -04:00
|
|
|
;;
|
|
|
|
run-ruby )
|
2018-02-28 22:26:05 -05:00
|
|
|
prep=program
|
|
|
|
run=runruby
|
2013-08-08 01:54:08 -04:00
|
|
|
;;
|
|
|
|
"" )
|
2018-02-28 22:26:05 -05:00
|
|
|
echo missing command 1>&2
|
|
|
|
exit 1
|
2013-08-08 01:54:08 -04:00
|
|
|
;;
|
|
|
|
* )
|
2016-10-06 08:15:00 -04:00
|
|
|
echo unknown command "'$1'" 1>&2
|
2016-10-06 01:46:55 -04:00
|
|
|
exit 1
|
2013-08-08 01:54:08 -04:00
|
|
|
;;
|
|
|
|
esac
|
2018-02-28 22:26:05 -05:00
|
|
|
|
2020-12-29 07:05:37 -05:00
|
|
|
# Apply $(srcdir)/bisect.patch to build if exists
|
|
|
|
# e.g., needs 5c2508060b~2..5c2508060b to use Bison 3.5.91.
|
|
|
|
if [ -f bisect.patch ]; then
|
|
|
|
if ! patch -p1 -N < bisect.patch || git diff --no-patch --exit-code; then
|
|
|
|
exit 125
|
|
|
|
fi
|
|
|
|
git status
|
|
|
|
exec=
|
|
|
|
else
|
|
|
|
exec=exec
|
|
|
|
fi
|
|
|
|
|
2018-02-28 22:26:05 -05:00
|
|
|
case "$0" in
|
|
|
|
*/*)
|
|
|
|
# assume a copy of this script is in builddir
|
|
|
|
cd `echo "$0" | sed 's:\(.*\)/.*:\1:'` || exit 125
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
for target in srcs Makefile $prep; do
|
|
|
|
$MAKE $target || exit 125
|
|
|
|
done
|
2020-12-29 07:05:37 -05:00
|
|
|
$exec $MAKE $run
|
|
|
|
status=$?
|
|
|
|
git checkout -f HEAD
|
|
|
|
exit $status
|