2008-09-24 23:59:41 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
|
|
|
|
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
# License.
|
|
|
|
#
|
|
|
|
# The Original Code is Mozilla JavaScript Testing Utilities
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Mozilla Corporation.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2008
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s): Bob Clary <bclary@bclary.com>
|
|
|
|
#
|
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
#
|
|
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
|
|
|
|
if [[ -z "$TEST_DIR" ]]; then
|
|
|
|
cat <<EOF
|
|
|
|
`basename $0`: error
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
TEST_DIR, the location of the Sisyphus framework,
|
2008-09-24 23:59:41 -07:00
|
|
|
is required to be set prior to calling this script.
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2008-09-24 23:59:41 -07:00
|
|
|
EOF
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -e $TEST_DIR/bin/library.sh ]]; then
|
|
|
|
cat <<EOF
|
|
|
|
TEST_DIR=$TEST_DIR"
|
|
|
|
|
|
|
|
This script requires the Sisyphus testing framework. Please
|
|
|
|
cvs check out the Sisyphys framework from mozilla/testing/sisyphus
|
|
|
|
and set the environment variable TEST_DIR to the directory where it
|
|
|
|
located.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
source $TEST_DIR/bin/library.sh
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
usage: bisect.sh -p product -b branch -e extra\\
|
|
|
|
-T buildtype \\
|
|
|
|
-t test \\
|
|
|
|
-S string \\
|
|
|
|
-G good -B bad \\
|
|
|
|
[-J javascriptoptions]
|
|
|
|
|
|
|
|
variable description
|
|
|
|
=============== ============================================================
|
|
|
|
-p bisect_product one of js, firefox
|
2009-08-18 00:30:00 -07:00
|
|
|
-b bisect_branches one of supported branches. see library.sh
|
2008-09-24 23:59:41 -07:00
|
|
|
-e bisect_extra optional. extra qualifier to pick build tree and mozconfig.
|
|
|
|
-T bisect_buildtype one of build types opt debug
|
|
|
|
-t bisect_test Test to be bisected.
|
2009-08-18 00:30:00 -07:00
|
|
|
-S bisect_string optional. String containing a regular expression which
|
2008-09-24 23:59:41 -07:00
|
|
|
can be used to distinguish different failures for the given
|
2009-08-18 00:30:00 -07:00
|
|
|
test. The script will search the failure log for the pattern
|
2008-09-24 23:59:41 -07:00
|
|
|
"\$bisect_test.*\$string" to determine if a test failure
|
|
|
|
matches the expected failure.
|
2009-08-18 00:30:00 -07:00
|
|
|
bisect_string can contain any extended regular expressions
|
2008-09-24 23:59:41 -07:00
|
|
|
supported by egrep.
|
|
|
|
-G bisect_good For branches 1.8.0, 1.8.1, 1.9.0, date test passed
|
2009-01-14 07:16:17 -08:00
|
|
|
For branch 1.9.1 and later, revision test passed
|
2008-09-24 23:59:41 -07:00
|
|
|
-B bisect_bad For branches, 1.8.0, 1.8.1, 1.9.0 date test failed
|
2009-08-18 00:30:00 -07:00
|
|
|
For branch 1.9.1 and later, revision test failed.
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
If the good revision (test passed) occurred prior to the bad revision
|
|
|
|
(test failed), the script will search for the first bad revision which
|
2008-09-24 23:59:41 -07:00
|
|
|
caused the test to regress.
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
If the bad revision (test failed) occurred prior to the good revision
|
|
|
|
(test passed), the script will search for the first good revision which
|
2008-09-24 23:59:41 -07:00
|
|
|
fixed the failing test.
|
2008-11-27 02:28:55 -08:00
|
|
|
|
|
|
|
-D By default, clobber builds will be used. For mercurial based builds
|
|
|
|
on branch 1.9.1 and later, you may specify -D to use depends builds.
|
|
|
|
This may achieve significant speed advantages by eliminating the need
|
|
|
|
to perform clobber builds for each bisection.
|
|
|
|
|
2008-09-24 23:59:41 -07:00
|
|
|
-J javascriptoptions optional. Set JavaScript options:
|
2009-08-18 00:30:00 -07:00
|
|
|
-Z n Set gczeal to n. Currently, only valid for
|
2008-09-24 23:59:41 -07:00
|
|
|
debug builds of Gecko 1.8.1.15, 1.9.0 and later.
|
|
|
|
-z optional. use split objects in the shell.
|
|
|
|
-j optional. use JIT in the shell. Only available on 1.9.1 and later
|
|
|
|
EOF
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2008-09-24 23:59:41 -07:00
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
|
|
|
|
verbose=0
|
|
|
|
|
2008-11-27 02:28:55 -08:00
|
|
|
while getopts "p:b:T:e:t:S:G:B:J:D" optname;
|
2008-09-24 23:59:41 -07:00
|
|
|
do
|
|
|
|
case $optname in
|
|
|
|
p) bisect_product=$OPTARG;;
|
|
|
|
b) bisect_branch=$OPTARG;;
|
|
|
|
T) bisect_buildtype=$OPTARG;;
|
|
|
|
e) bisect_extra="$OPTARG"
|
|
|
|
bisect_extraflag="-e $OPTARG";;
|
|
|
|
t) bisect_test="$OPTARG";;
|
|
|
|
S) bisect_string="$OPTARG";;
|
|
|
|
G) bisect_good="$OPTARG";;
|
|
|
|
B) bisect_bad="$OPTARG";;
|
|
|
|
J) javascriptoptions=$OPTARG;;
|
2008-11-27 02:28:55 -08:00
|
|
|
D) bisect_depends=1;;
|
2008-09-24 23:59:41 -07:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# javascriptoptions will be passed by environment to runtests.sh
|
|
|
|
|
|
|
|
if [[ -z "$bisect_product" || -z "$bisect_branch" || -z "$bisect_buildtype" || -z "$bisect_test" || -z "$bisect_good" || -z "$bisect_bad" ]]; then
|
2008-10-10 05:06:40 -07:00
|
|
|
echo "bisect_product: $bisect_product, bisect_branch: $bisect_branch, bisect_buildtype: $bisect_buildtype, bisect_test: $bisect_test, bisect_good: $bisect_good, bisect_bad: $bisect_bad"
|
2008-09-24 23:59:41 -07:00
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
OPTIND=1
|
|
|
|
|
2009-08-18 00:29:59 -07:00
|
|
|
# evaluate set-build-env.sh in this process to pick up the necessary environment
|
|
|
|
# variables, but restore the PATH and PYTHON to prevent their interfering with
|
|
|
|
# Sisyphus.
|
|
|
|
|
|
|
|
savepath="$PATH"
|
|
|
|
savepython="$PYTHON"
|
2008-09-24 23:59:41 -07:00
|
|
|
eval source $TEST_DIR/bin/set-build-env.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype > /dev/null
|
2009-08-18 00:29:59 -07:00
|
|
|
PATH=$savepath
|
|
|
|
PYTHON=$savepython
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2008-10-20 08:32:18 -07:00
|
|
|
# TEST_JSDIR must be set after set-build-env.sh is called
|
|
|
|
# on Windows since TEST_DIR can be modified in set-build-env.sh
|
|
|
|
# from the pure cygwin path /work/... to a the cygwin windows path
|
|
|
|
# /c/work/...
|
|
|
|
TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if [[ "$bisect_branch" == "1.8.0" || "$bisect_branch" == "1.8.1" || \
|
|
|
|
"$bisect_branch" == "1.9.0" ]]; then
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
#
|
|
|
|
# binary search using CVS
|
|
|
|
#
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# convert dates to seconds for ordering
|
|
|
|
localgood=`dateparse.pl $bisect_good`
|
|
|
|
localbad=`dateparse.pl $bisect_bad`
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# if good < bad, then we are searching for a regression,
|
|
|
|
# i.e. the first bad changeset
|
|
|
|
# if bad < good, then we are searching for a fix.
|
|
|
|
# i.e. the first good changeset. so we reverse the nature
|
|
|
|
# of good and bad.
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if (( $localgood < $localbad )); then
|
|
|
|
cat <<EOF
|
2008-10-10 05:06:40 -07:00
|
|
|
|
|
|
|
searching for a regression between $bisect_good and $bisect_bad
|
|
|
|
the bisection is searching for the transition from test failure not found, to test failure found.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
searchtype="regression"
|
|
|
|
bisect_start=$bisect_good
|
|
|
|
bisect_stop=$bisect_bad
|
|
|
|
else
|
|
|
|
cat <<EOF
|
2008-10-10 05:06:40 -07:00
|
|
|
|
|
|
|
searching for a fix between $bisect_bad and $bisect_good
|
|
|
|
the bisection is searching for the transition from test failure found to test failure not found.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
searchtype="fix"
|
|
|
|
bisect_start=$bisect_bad
|
|
|
|
bisect_stop=$bisect_good
|
|
|
|
fi
|
|
|
|
|
|
|
|
let seconds_start="`dateparse.pl $bisect_start`"
|
|
|
|
let seconds_stop="`dateparse.pl $bisect_stop`"
|
|
|
|
|
|
|
|
echo "checking that the test fails in the bad revision $bisect_bad"
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
|
|
|
export MOZ_CO_DATE="$bisect_bad"
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "checkout" > /dev/null
|
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
|
|
|
if [[ -z "$bisect_log" ]]; then
|
|
|
|
echo "test $bisect_test not run."
|
|
|
|
else
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, bad revision $bisect_bad confirmed"
|
|
|
|
bad_confirmed=1
|
2008-10-10 05:06:40 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, bad revision $bisect_bad *not* confirmed"
|
2008-10-10 05:06:40 -07:00
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$bad_confirmed" != "1" ]]; then
|
|
|
|
error "bad revision not confirmed";
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "checking that the test passes in the good revision $bisect_good"
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
|
|
|
export MOZ_CO_DATE="$bisect_good"
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "checkout" > /dev/null
|
|
|
|
|
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
|
|
|
if [[ -z "$bisect_log" ]]; then
|
|
|
|
echo "test $bisect_test not run."
|
|
|
|
else
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, good revision $bisect_good *not* confirmed"
|
2008-10-10 05:06:40 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, good revision $bisect_good confirmed"
|
|
|
|
good_confirmed=1
|
2008-10-10 05:06:40 -07:00
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if [[ "$good_confirmed" != "1" ]]; then
|
|
|
|
error "good revision not confirmed";
|
|
|
|
fi
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "bisecting $bisect_start to $bisect_stop"
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
#
|
|
|
|
# place an array of dates of checkins into an array and
|
|
|
|
# perform a binary search on those dates.
|
|
|
|
#
|
|
|
|
declare -a seconds_array date_array
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# load the cvs checkin dates into an array. the array will look like
|
|
|
|
# date_array[i] date value
|
|
|
|
# date_array[i+1] time value
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
pushd $BUILDTREE/mozilla
|
|
|
|
date_array=(`cvs -q -z3 log -N -d "$bisect_start<$bisect_stop" | grep "^date: " | sed 's|^date: \([^;]*\).*|\1|' | sort -u`)
|
|
|
|
popd
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
let seconds_index=0 1
|
|
|
|
let date_index=0 1
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
while (( $date_index < ${#date_array[@]} )); do
|
|
|
|
seconds_array[$seconds_index]=`dateparse.pl "${date_array[$date_index]} ${date_array[$date_index+1]} UTC"`
|
|
|
|
let seconds_index=$seconds_index+1
|
|
|
|
let date_index=$date_index+2
|
|
|
|
done
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
let seconds_index_start=0 1
|
|
|
|
let seconds_index_stop=${#seconds_array[@]}
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
while true; do
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if (( $seconds_index_start+1 >= $seconds_index_stop )); then
|
|
|
|
echo "*** date `perl -e 'print scalar localtime $ARGV[0];' ${seconds_array[$seconds_index_stop]}` found ***"
|
|
|
|
break;
|
|
|
|
fi
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
unset result
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# clobber before setting new changeset.
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
let seconds_index_middle="($seconds_index_start + $seconds_index_stop)/2"
|
|
|
|
let seconds_middle="${seconds_array[$seconds_index_middle]}"
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
bisect_middle="`perl -e 'print scalar localtime $ARGV[0];' $seconds_middle`"
|
|
|
|
export MOZ_CO_DATE="$bisect_middle"
|
|
|
|
echo "testing $MOZ_CO_DATE"
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "checkout" > /dev/null
|
|
|
|
|
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
|
|
|
if [[ -z "$bisect_log" ]]; then
|
|
|
|
echo "test $bisect_test not run. Skipping changeset"
|
|
|
|
let seconds_index_start=$seconds_index_start+1
|
|
|
|
else
|
|
|
|
if [[ "$searchtype" == "regression" ]]; then
|
|
|
|
# searching for a regression, pass -> fail
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found"
|
|
|
|
let seconds_index_stop=$seconds_index_middle;
|
|
|
|
else
|
|
|
|
echo "test failure $bisect_test.*$bisect_string not found"
|
|
|
|
let seconds_index_start=$seconds_index_middle
|
|
|
|
fi
|
2008-10-10 05:06:40 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
# searching for a fix, fail -> pass
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found"
|
|
|
|
let seconds_index_start=$seconds_index_middle
|
2008-10-10 05:06:40 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test failure $bisect_test.*$bisect_string not found"
|
|
|
|
let seconds_index_stop=$seconds_index_middle
|
2008-10-10 05:06:40 -07:00
|
|
|
fi
|
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
done
|
|
|
|
else
|
|
|
|
#
|
|
|
|
# binary search using mercurial
|
|
|
|
#
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
TEST_MOZILLA_HG_LOCAL=${TEST_MOZILLA_HG_LOCAL:-$BUILDDIR/hg.mozilla.org/`basename $TEST_MOZILLA_HG`}
|
|
|
|
hg -R $TEST_MOZILLA_HG_LOCAL pull -r tip
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
REPO=$BUILDTREE/mozilla
|
|
|
|
hg -R $REPO pull -r tip
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# convert revision numbers to local revision numbers for ordering
|
|
|
|
localgood=`hg -R $REPO id -n -r $bisect_good`
|
|
|
|
localbad=`hg -R $REPO id -n -r $bisect_bad`
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
# if good < bad, then we are searching for a regression,
|
|
|
|
# i.e. the first bad changeset
|
|
|
|
# if bad < good, then we are searching for a fix.
|
|
|
|
# i.e. the first good changeset. so we reverse the nature
|
|
|
|
# of good and bad.
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if (( $localgood < $localbad )); then
|
|
|
|
cat <<EOF
|
2008-09-24 23:59:41 -07:00
|
|
|
|
|
|
|
searching for a regression between $localgood:$bisect_good and $localbad:$bisect_bad
|
|
|
|
the result is considered good when the test result does not appear in the failure log, bad otherwise.
|
|
|
|
the bisection is searching for the transition from test failure not found, to test failure found.
|
|
|
|
|
|
|
|
EOF
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
searchtype="regression"
|
|
|
|
bisect_start=$bisect_good
|
|
|
|
bisect_stop=$bisect_bad
|
|
|
|
else
|
|
|
|
cat <<EOF
|
2008-09-24 23:59:41 -07:00
|
|
|
|
|
|
|
searching for a fix between $localbad:$bisect_bad and $localgood:$bisect_good
|
|
|
|
the result is considered good when the test result does appear in the failure log, bad otherwise.
|
|
|
|
the bisection is searching for the transition from test failure found to test failure not found.
|
|
|
|
|
|
|
|
EOF
|
2008-10-10 05:06:40 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
searchtype="fix"
|
|
|
|
bisect_start=$bisect_bad
|
|
|
|
bisect_stop=$bisect_good
|
|
|
|
fi
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "checking that the test fails in the bad revision $localbad:$bisect_bad"
|
|
|
|
if [[ -z "$bisect_depends" ]]; then
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
|
|
|
fi
|
|
|
|
hg -R $REPO update -C -r $bisect_bad
|
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
|
|
|
if [[ -z "$bisect_log" ]]; then
|
|
|
|
echo "test $bisect_test not run."
|
|
|
|
else
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, bad revision $localbad:$bisect_bad confirmed"
|
|
|
|
bad_confirmed=1
|
2008-09-24 23:59:41 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, bad revision $localbad:$bisect_bad *not* confirmed"
|
2008-09-24 23:59:41 -07:00
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$bad_confirmed" != "1" ]]; then
|
|
|
|
error "bad revision not confirmed";
|
|
|
|
fi
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "checking that the test passes in the good revision $localgood:$bisect_good"
|
|
|
|
if [[ -z "$bisect_depends" ]]; then
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
|
|
|
fi
|
|
|
|
hg -R $REPO update -C -r $bisect_good
|
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
|
|
|
if [[ -z "$bisect_log" ]]; then
|
|
|
|
echo "test $bisect_test not run."
|
|
|
|
else
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, good revision $localgood:$bisect_good *not* confirmed"
|
|
|
|
else
|
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, good revision $localgood:$bisect_good confirmed"
|
|
|
|
good_confirmed=1
|
2008-09-24 23:59:41 -07:00
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$good_confirmed" != "1" ]]; then
|
|
|
|
error "good revision not confirmed";
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "bisecting $REPO $bisect_start to $bisect_stop"
|
|
|
|
hg -q -R $REPO bisect --reset
|
|
|
|
hg -q -R $REPO bisect --good $bisect_start
|
|
|
|
hg -q -R $REPO bisect --bad $bisect_stop
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
unset result
|
|
|
|
|
|
|
|
# clobber before setting new changeset.
|
2008-11-27 02:28:55 -08:00
|
|
|
if [[ -z "$bisect_depends" ]]; then
|
|
|
|
eval $TEST_DIR/bin/builder.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -B "clobber" > /dev/null
|
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
|
|
|
|
# remove extraneous in-tree changes
|
|
|
|
# See https://bugzilla.mozilla.org/show_bug.cgi?id=480680 for details
|
|
|
|
# of why this is necessary.
|
|
|
|
hg -R $REPO update -C
|
|
|
|
|
|
|
|
hg -R $REPO bisect
|
|
|
|
# save the revision id so we can update to it discarding local
|
|
|
|
# changes in the working directory.
|
|
|
|
rev=`hg -R $REPO id -i`
|
|
|
|
|
2008-09-24 23:59:41 -07:00
|
|
|
bisect_log=`eval $TEST_JSDIR/runtests.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype -I $bisect_test -B "build" -c -t -X /dev/null 2>&1 | grep '_js.log $' | sed 's|log: \([^ ]*\) |\1|'`
|
2009-08-18 00:30:00 -07:00
|
|
|
# remove extraneous in-tree changes
|
|
|
|
# See https://bugzilla.mozilla.org/show_bug.cgi?id=480680 for details
|
|
|
|
# of why this is necessary.
|
|
|
|
hg -R $REPO update -C -r $rev
|
|
|
|
|
2008-09-24 23:59:41 -07:00
|
|
|
if [[ -z "$bisect_log" ]]; then
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test $bisect_test not run. Skipping changeset"
|
|
|
|
hg -R $REPO bisect --skip
|
2008-09-24 23:59:41 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
if [[ "$searchtype" == "regression" ]]; then
|
|
|
|
# searching for a regression
|
|
|
|
# the result is considered good when the test does not appear in the failure log
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, marking revision bad"
|
|
|
|
if ! result=`hg -R $REPO bisect --bad 2>&1`; then
|
|
|
|
echo "bisect bad failed"
|
|
|
|
error "$result"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, marking revision good"
|
|
|
|
if ! result=`hg -R $REPO bisect --good 2>&1`; then
|
|
|
|
echo "bisect good failed"
|
|
|
|
error "$result"
|
|
|
|
fi
|
|
|
|
fi
|
2008-09-24 23:59:41 -07:00
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
# searching for a fix
|
|
|
|
# the result is considered good when the test does appear in the failure log
|
|
|
|
if egrep -q "$bisect_test.*$bisect_string" ${bisect_log}-results-failures.log; then
|
|
|
|
echo "test failure $bisect_test.*$bisect_string found, marking revision good"
|
|
|
|
if ! result=`hg -R $REPO bisect --good 2>&1`; then
|
|
|
|
echo "bisect good failed"
|
|
|
|
error "$result"
|
2008-09-24 23:59:41 -07:00
|
|
|
fi
|
|
|
|
else
|
2009-08-18 00:30:00 -07:00
|
|
|
echo "test failure $bisect_test.*$bisect_string not found, marking revision bad"
|
|
|
|
if ! result=`hg -R $REPO bisect --bad 2>&1`; then
|
|
|
|
echo "bisect bad failed"
|
|
|
|
error "$result"
|
2008-09-24 23:59:41 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2009-08-18 00:30:00 -07:00
|
|
|
fi
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
if echo $result | egrep -q "The first (good|bad) revision is:"; then
|
|
|
|
result_revision=`echo $result | sed "s|The first .* revision is:.*changeset: [0-9]*:\([^ ]*\).*|\1|"`
|
|
|
|
echo $result | sed "s|The first .* revision is:|$searchtype|"
|
|
|
|
echo "*** revision $result_revision found ***"
|
|
|
|
break
|
|
|
|
fi
|
2008-09-24 23:59:41 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
done
|
|
|
|
fi
|