Home | History | Annotate | Line # | Download | only in bin
reg-hunt revision 1.1.1.1.8.2
      1  1.1.1.1.8.2  tls #! /bin/bash
      2  1.1.1.1.8.2  tls 
      3  1.1.1.1.8.2  tls #set -x
      4  1.1.1.1.8.2  tls 
      5  1.1.1.1.8.2  tls ########################################################################
      6  1.1.1.1.8.2  tls #
      7  1.1.1.1.8.2  tls # File:    reg-hunt
      8  1.1.1.1.8.2  tls # Author:  Janis Johnson <janis187 (at] us.ibm.com>
      9  1.1.1.1.8.2  tls # Date:    2003/08/19
     10  1.1.1.1.8.2  tls #
     11  1.1.1.1.8.2  tls # Search for the patch identifier for which results for a test changed,
     12  1.1.1.1.8.2  tls # using a binary search.  The functionality for getting sources,
     13  1.1.1.1.8.2  tls # building the component to test, and running the test are in other
     14  1.1.1.1.8.2  tls # scripts that are run from here.  Before the search begins, we verify
     15  1.1.1.1.8.2  tls # that we get the expected behavior for the first and last patch
     16  1.1.1.1.8.2  tls # identifiers.
     17  1.1.1.1.8.2  tls #
     18  1.1.1.1.8.2  tls # Define these in a file whose name is the argument to this script:
     19  1.1.1.1.8.2  tls #   LOW_PATCH:  Patch identifier.
     20  1.1.1.1.8.2  tls #   HIGH_PATCH: Patch identifier.
     21  1.1.1.1.8.2  tls #   REG_UPDATE: Pathname of script to update your source tree; returns
     22  1.1.1.1.8.2  tls #               zero for success, nonzero for failure.
     23  1.1.1.1.8.2  tls #   REG_BUILD:  Pathname of script to build enough of the product to run
     24  1.1.1.1.8.2  tls #               the test; returns zero for success, nonzero for failure.
     25  1.1.1.1.8.2  tls #   REG_TEST:   Pathname of script to run the test; returns 1 if we
     26  1.1.1.1.8.2  tls #               should search later patches, 0 if we should search
     27  1.1.1.1.8.2  tls #               earlier patches, and something else if there was an
     28  1.1.1.1.8.2  tls #               unexpected failure.
     29  1.1.1.1.8.2  tls # Optional:
     30  1.1.1.1.8.2  tls #   REG_REPORT  Pathname of script to call at the end with the id of the
     31  1.1.1.1.8.2  tls #               patch that caused the change in behavior.
     32  1.1.1.1.8.2  tls #   REG_FINISH  Pathname of script to call at the end with the two final
     33  1.1.1.1.8.2  tls #               patch identifiers as arguments.
     34  1.1.1.1.8.2  tls #   REG_NEWMID  Pathname of script to call when a build has failed, with
     35  1.1.1.1.8.2  tls #               arguments of the failed id and the current low and high
     36  1.1.1.1.8.2  tls #   SKIP_LOW    If 1, skip verifying the low patch identifier of the
     37  1.1.1.1.8.2  tls #               range; define this only if you're restarting and have
     38  1.1.1.1.8.2  tls #               already tested the low patch.
     39  1.1.1.1.8.2  tls #   SKIP_HIGH   If 1, skip verifying the high patch identifier of the
     40  1.1.1.1.8.2  tls #               range; define this only if you're restarting and have
     41  1.1.1.1.8.2  tls #               already tested the high patch.
     42  1.1.1.1.8.2  tls #   FIRST_MID   Use this as the first midpoint, to avoid a midpoint that
     43  1.1.1.1.8.2  tls #               is known not to build.
     44  1.1.1.1.8.2  tls #   VERBOSITY   Default is 0, to print only errors and final message.
     45  1.1.1.1.8.2  tls #   DATE_IN_MSG If set to anything but 0, include the time and date in
     46  1.1.1.1.8.2  tls #               messages.
     47  1.1.1.1.8.2  tls #
     48  1.1.1.1.8.2  tls #
     49  1.1.1.1.8.2  tls #
     50  1.1.1.1.8.2  tls # Copyright (c) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
     51  1.1.1.1.8.2  tls #
     52  1.1.1.1.8.2  tls # This file is free software; you can redistribute it and/or modify
     53  1.1.1.1.8.2  tls # it under the terms of the GNU General Public License as published by
     54  1.1.1.1.8.2  tls # the Free Software Foundation; either version 3 of the License, or
     55  1.1.1.1.8.2  tls # (at your option) any later version.
     56  1.1.1.1.8.2  tls #
     57  1.1.1.1.8.2  tls # This program is distributed in the hope that it will be useful,
     58  1.1.1.1.8.2  tls # but WITHOUT ANY WARRANTY; without even the implied warranty of
     59  1.1.1.1.8.2  tls # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     60  1.1.1.1.8.2  tls # GNU General Public License for more details.
     61  1.1.1.1.8.2  tls #
     62  1.1.1.1.8.2  tls # For a copy of the GNU General Public License, write the the
     63  1.1.1.1.8.2  tls # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     64  1.1.1.1.8.2  tls # Boston, MA 02111-1301, USA.
     65  1.1.1.1.8.2  tls # 
     66  1.1.1.1.8.2  tls ########################################################################
     67  1.1.1.1.8.2  tls 
     68  1.1.1.1.8.2  tls ########################################################################
     69  1.1.1.1.8.2  tls # Functions
     70  1.1.1.1.8.2  tls ########################################################################
     71  1.1.1.1.8.2  tls 
     72  1.1.1.1.8.2  tls # Issue a message if its verbosity level is high enough.
     73  1.1.1.1.8.2  tls 
     74  1.1.1.1.8.2  tls msg() {
     75  1.1.1.1.8.2  tls   test ${1} -gt ${VERBOSITY}  && return
     76  1.1.1.1.8.2  tls 
     77  1.1.1.1.8.2  tls   if [ "x${DATE_IN_MSG}" = "x" ]; then
     78  1.1.1.1.8.2  tls     echo "${2}"
     79  1.1.1.1.8.2  tls   else
     80  1.1.1.1.8.2  tls     echo "`date`  ${2}"
     81  1.1.1.1.8.2  tls   fi
     82  1.1.1.1.8.2  tls }
     83  1.1.1.1.8.2  tls 
     84  1.1.1.1.8.2  tls # Issue an error message and exit with a non-zero status.  If there
     85  1.1.1.1.8.2  tls # is a valid current range whose end points have been tested, report
     86  1.1.1.1.8.2  tls # it so the user can start again from there.
     87  1.1.1.1.8.2  tls 
     88  1.1.1.1.8.2  tls error() {
     89  1.1.1.1.8.2  tls   msg 0 "error: ${1}"
     90  1.1.1.1.8.2  tls   test ${VALID_RANGE} -eq 1 && \
     91  1.1.1.1.8.2  tls     echo "current range:"
     92  1.1.1.1.8.2  tls     echo "LOW_PATCH=${LATER_THAN}"
     93  1.1.1.1.8.2  tls     echo "HIGH_PATCH=${EARLIER_THAN}"
     94  1.1.1.1.8.2  tls   exit 1
     95  1.1.1.1.8.2  tls }
     96  1.1.1.1.8.2  tls 
     97  1.1.1.1.8.2  tls # Build the components to test using sources as of a particular patch
     98  1.1.1.1.8.2  tls # and run a test case.  Pass each of the scripts the patch identifier
     99  1.1.1.1.8.2  tls # that we're testing; the first one needs it, the others can ignore it
    100  1.1.1.1.8.2  tls # if they want.
    101  1.1.1.1.8.2  tls 
    102  1.1.1.1.8.2  tls process_patch () {
    103  1.1.1.1.8.2  tls   TEST_ID=${1}
    104  1.1.1.1.8.2  tls 
    105  1.1.1.1.8.2  tls   # If we're keeping track of known failures, see if TEST_ID is one and
    106  1.1.1.1.8.2  tls   # if so, don't bother updating sources and trying to build.
    107  1.1.1.1.8.2  tls 
    108  1.1.1.1.8.2  tls   FAILS=0
    109  1.1.1.1.8.2  tls   SKIP=0
    110  1.1.1.1.8.2  tls   if [ ${SKIP_FAILURES} -eq 1 ]; then
    111  1.1.1.1.8.2  tls     ${REG_CHECKFAIL} ${TEST_ID}
    112  1.1.1.1.8.2  tls     if [ $? -eq 0 ]; then
    113  1.1.1.1.8.2  tls       msg 1 "skipping ${TEST_ID}; it is a known build failure"
    114  1.1.1.1.8.2  tls       FAILS=1
    115  1.1.1.1.8.2  tls       SKIP=1
    116  1.1.1.1.8.2  tls     fi
    117  1.1.1.1.8.2  tls   fi
    118  1.1.1.1.8.2  tls 
    119  1.1.1.1.8.2  tls   if [ ${FAILS} -eq 0 ]; then
    120  1.1.1.1.8.2  tls     ${REG_UPDATE} ${TEST_ID} || error "source update failed for ${TEST_ID}"
    121  1.1.1.1.8.2  tls     ${REG_BUILD} ${TEST_ID}
    122  1.1.1.1.8.2  tls     if [ $? -ne 0 ]; then
    123  1.1.1.1.8.2  tls       FAILS=1
    124  1.1.1.1.8.2  tls       msg 1 "build failed for ${TEST_ID}"
    125  1.1.1.1.8.2  tls       if [ ${SKIP_FAILURES} -eq 1 ]; then
    126  1.1.1.1.8.2  tls         ${REG_RECORDFAIL} ${TEST_ID}
    127  1.1.1.1.8.2  tls       fi
    128  1.1.1.1.8.2  tls     fi
    129  1.1.1.1.8.2  tls   fi
    130  1.1.1.1.8.2  tls 
    131  1.1.1.1.8.2  tls   if [ ${FAILS} -eq 0 ]; then
    132  1.1.1.1.8.2  tls     ${REG_TEST} ${TEST_ID}
    133  1.1.1.1.8.2  tls     LATER=$?
    134  1.1.1.1.8.2  tls     if [ $LATER -ne 0 -a $LATER -ne 1 ]; then
    135  1.1.1.1.8.2  tls       msg 0 "unexpected test failure for ${TEST_ID}"
    136  1.1.1.1.8.2  tls       exit 1
    137  1.1.1.1.8.2  tls     fi
    138  1.1.1.1.8.2  tls   else
    139  1.1.1.1.8.2  tls 
    140  1.1.1.1.8.2  tls     # The build failed, or this patch is already known to fail to build.
    141  1.1.1.1.8.2  tls     # If it's an endpoint, or if we don't have a way to recover from
    142  1.1.1.1.8.2  tls     # build failures, quit now.
    143  1.1.1.1.8.2  tls 
    144  1.1.1.1.8.2  tls     if [ ${SKIP} -eq 0 ]; then
    145  1.1.1.1.8.2  tls       if [ "x${REG_NEWMID}" == "x" \
    146  1.1.1.1.8.2  tls            -o ${TEST_ID} -eq ${LATER_THAN} \
    147  1.1.1.1.8.2  tls            -o ${TEST_ID} -eq ${EARLIER_THAN} ]; then
    148  1.1.1.1.8.2  tls         error "build failed for ${TEST_ID}"
    149  1.1.1.1.8.2  tls       fi
    150  1.1.1.1.8.2  tls     fi
    151  1.1.1.1.8.2  tls 
    152  1.1.1.1.8.2  tls     # Try to find a new patch to try within the current range.
    153  1.1.1.1.8.2  tls 
    154  1.1.1.1.8.2  tls     FIRST_MID=`${REG_NEWMID} ${LATER_THAN} ${EARLIER_THAN}`
    155  1.1.1.1.8.2  tls     if [ ${FIRST_MID} -eq 0 ]; then
    156  1.1.1.1.8.2  tls 
    157  1.1.1.1.8.2  tls       # The heuristics in the tool ran out of patches to try next;
    158  1.1.1.1.8.2  tls       # let the user handle it from here.+
    159  1.1.1.1.8.2  tls       error "build failed for ${TEST_ID}, could not find new candidate"
    160  1.1.1.1.8.2  tls     fi
    161  1.1.1.1.8.2  tls     msg 1 "using ${FIRST_MID}, between ${LATER_THAN} and ${EARLIER_THAN}"
    162  1.1.1.1.8.2  tls   fi
    163  1.1.1.1.8.2  tls 
    164  1.1.1.1.8.2  tls   # Return with a valid LATER value or a new ID to try in FIRST_MID.
    165  1.1.1.1.8.2  tls }
    166  1.1.1.1.8.2  tls 
    167  1.1.1.1.8.2  tls # Get the number of a patch within the range.  It's not actually the
    168  1.1.1.1.8.2  tls # middle one, but the one that might minimize the number of checks.
    169  1.1.1.1.8.2  tls 
    170  1.1.1.1.8.2  tls get_mid_special() {
    171  1.1.1.1.8.2  tls   LOW=$1
    172  1.1.1.1.8.2  tls   HIGH=$2
    173  1.1.1.1.8.2  tls 
    174  1.1.1.1.8.2  tls   let DIFF=HIGH-LOW
    175  1.1.1.1.8.2  tls   M=1
    176  1.1.1.1.8.2  tls   POWER2=1
    177  1.1.1.1.8.2  tls   while
    178  1.1.1.1.8.2  tls       [ $POWER2 -lt $DIFF ]
    179  1.1.1.1.8.2  tls   do
    180  1.1.1.1.8.2  tls       let M=POWER2
    181  1.1.1.1.8.2  tls       let POWER2=POWER2*2
    182  1.1.1.1.8.2  tls   done
    183  1.1.1.1.8.2  tls   let MID=LOW+M
    184  1.1.1.1.8.2  tls }
    185  1.1.1.1.8.2  tls 
    186  1.1.1.1.8.2  tls # Get the number of the patch in the middle of the range.
    187  1.1.1.1.8.2  tls 
    188  1.1.1.1.8.2  tls get_mid () {
    189  1.1.1.1.8.2  tls   LOW=$1
    190  1.1.1.1.8.2  tls   HIGH=$2
    191  1.1.1.1.8.2  tls 
    192  1.1.1.1.8.2  tls   let DIFF=HIGH-LOW
    193  1.1.1.1.8.2  tls   let M=DIFF/2
    194  1.1.1.1.8.2  tls   let MID=LOW+M
    195  1.1.1.1.8.2  tls }
    196  1.1.1.1.8.2  tls 
    197  1.1.1.1.8.2  tls # Perform a binary search on patch identifiers within the range
    198  1.1.1.1.8.2  tls # specified by the arguments.
    199  1.1.1.1.8.2  tls 
    200  1.1.1.1.8.2  tls search_patches () {
    201  1.1.1.1.8.2  tls   LOW=$1
    202  1.1.1.1.8.2  tls   HIGH=$2
    203  1.1.1.1.8.2  tls 
    204  1.1.1.1.8.2  tls   # Get an identifier within the range.  The user can override the
    205  1.1.1.1.8.2  tls   # initial mid patch if it is known to have problems, e.g., if a
    206  1.1.1.1.8.2  tls   # build fails for that patch.
    207  1.1.1.1.8.2  tls 
    208  1.1.1.1.8.2  tls   if [ ${FIRST_MID} -ne 0 ]; then
    209  1.1.1.1.8.2  tls     MID=${FIRST_MID}
    210  1.1.1.1.8.2  tls     FIRST_MID=0
    211  1.1.1.1.8.2  tls     let DIFF=HIGH-LOW
    212  1.1.1.1.8.2  tls   else
    213  1.1.1.1.8.2  tls     get_mid $LOW $HIGH
    214  1.1.1.1.8.2  tls   fi
    215  1.1.1.1.8.2  tls 
    216  1.1.1.1.8.2  tls   while [ ${DIFF} -gt 1 ]; do
    217  1.1.1.1.8.2  tls     TEST_ID="${MID}"
    218  1.1.1.1.8.2  tls 
    219  1.1.1.1.8.2  tls     # Test it.
    220  1.1.1.1.8.2  tls 
    221  1.1.1.1.8.2  tls     process_patch ${TEST_ID}
    222  1.1.1.1.8.2  tls 
    223  1.1.1.1.8.2  tls     # FIRST_MID being set is a signal that the build failed and we
    224  1.1.1.1.8.2  tls     # should start over again.
    225  1.1.1.1.8.2  tls     
    226  1.1.1.1.8.2  tls     test ${FIRST_MID} -ne 0 && return
    227  1.1.1.1.8.2  tls 
    228  1.1.1.1.8.2  tls     # Narrow the search based on the outcome of testing TEST_ID.
    229  1.1.1.1.8.2  tls 
    230  1.1.1.1.8.2  tls     if [ ${LATER} -eq 1 ]; then
    231  1.1.1.1.8.2  tls       msg 1 "search patches later than ${TEST_ID}"
    232  1.1.1.1.8.2  tls       LATER_THAN=${TEST_ID}
    233  1.1.1.1.8.2  tls       let LOW=MID
    234  1.1.1.1.8.2  tls     else
    235  1.1.1.1.8.2  tls       msg 1 "search patches earlier than ${TEST_ID}"
    236  1.1.1.1.8.2  tls       EARLIER_THAN=${TEST_ID}
    237  1.1.1.1.8.2  tls       let HIGH=MID
    238  1.1.1.1.8.2  tls     fi
    239  1.1.1.1.8.2  tls 
    240  1.1.1.1.8.2  tls     get_mid $LOW $HIGH
    241  1.1.1.1.8.2  tls   done
    242  1.1.1.1.8.2  tls }
    243  1.1.1.1.8.2  tls 
    244  1.1.1.1.8.2  tls ########################################################################
    245  1.1.1.1.8.2  tls # Main program (so to speak)
    246  1.1.1.1.8.2  tls ########################################################################
    247  1.1.1.1.8.2  tls 
    248  1.1.1.1.8.2  tls # The error function uses this.
    249  1.1.1.1.8.2  tls 
    250  1.1.1.1.8.2  tls VALID_RANGE=0
    251  1.1.1.1.8.2  tls 
    252  1.1.1.1.8.2  tls # Process the configuration file.
    253  1.1.1.1.8.2  tls 
    254  1.1.1.1.8.2  tls if [ $# != 1 ]; then
    255  1.1.1.1.8.2  tls   echo Usage: $0 config_file
    256  1.1.1.1.8.2  tls   exit 1
    257  1.1.1.1.8.2  tls fi
    258  1.1.1.1.8.2  tls 
    259  1.1.1.1.8.2  tls CONFIG=${1}
    260  1.1.1.1.8.2  tls if [ ! -f ${CONFIG} ]; then
    261  1.1.1.1.8.2  tls   error "configuration file ${CONFIG} does not exist"
    262  1.1.1.1.8.2  tls fi
    263  1.1.1.1.8.2  tls 
    264  1.1.1.1.8.2  tls # OK, the config file exists.  Source it, make sure required parameters
    265  1.1.1.1.8.2  tls # are defined and their files exist, and give default values to optional
    266  1.1.1.1.8.2  tls # parameters.
    267  1.1.1.1.8.2  tls 
    268  1.1.1.1.8.2  tls . ${CONFIG}
    269  1.1.1.1.8.2  tls 
    270  1.1.1.1.8.2  tls test "x${REG_UPDATE}" = "x" && error "REG_UPDATE is not defined"
    271  1.1.1.1.8.2  tls test "x${REG_BUILD}" = "x" && error "REG_BUILD is not defined"
    272  1.1.1.1.8.2  tls test "x${REG_TEST}" = "x" && error "REG_TEST is not defined"
    273  1.1.1.1.8.2  tls test -x ${REG_TEST} || error "REG_TEST is not an executable file"
    274  1.1.1.1.8.2  tls test "x${SKIP_LOW}" = "x" && SKIP_LOW=0
    275  1.1.1.1.8.2  tls test "x${SKIP_HIGH}" = "x" && SKIP_HIGH=0
    276  1.1.1.1.8.2  tls test "x${VERBOSITY}" = "x" && VERBOSITY=0
    277  1.1.1.1.8.2  tls test "x${REG_FINISH}" = "x" && REG_FINISH=true
    278  1.1.1.1.8.2  tls test "x${REG_REPORT}" = "x" && REG_REPORT=true
    279  1.1.1.1.8.2  tls 
    280  1.1.1.1.8.2  tls msg 2 "LOW_PATCH  = ${LOW_PATCH}"
    281  1.1.1.1.8.2  tls msg 2 "HIGH_PATCH = ${HIGH_PATCH}"
    282  1.1.1.1.8.2  tls msg 2 "REG_UPDATE = ${REG_UPDATE}"
    283  1.1.1.1.8.2  tls msg 2 "REG_BUILD  = ${REG_BUILD}"
    284  1.1.1.1.8.2  tls msg 2 "REG_TEST   = ${REG_TEST}"
    285  1.1.1.1.8.2  tls msg 2 "REG_NEWMID = ${REG_NEWMID}"
    286  1.1.1.1.8.2  tls msg 2 "SKIP_LOW   = ${SKIP_LOW}"
    287  1.1.1.1.8.2  tls msg 2 "SKIP_HIGH  = ${SKIP_HIGH}"
    288  1.1.1.1.8.2  tls msg 2 "FIRST_MID  = ${FIRST_MID}"
    289  1.1.1.1.8.2  tls msg 2 "VERBOSITY  = ${VERBOSITY}"
    290  1.1.1.1.8.2  tls 
    291  1.1.1.1.8.2  tls # If REG_NEWMID was defined, assume that we're skipping known failures
    292  1.1.1.1.8.2  tls # and adding to the list for new failures.  If the list of failures
    293  1.1.1.1.8.2  tls # doesn't exist, create it.  We use a different flag, SKIP_FAILURES,
    294  1.1.1.1.8.2  tls # to make it easier to separate the flag from REG_NEWMID if we want
    295  1.1.1.1.8.2  tls # to change the usage later.
    296  1.1.1.1.8.2  tls 
    297  1.1.1.1.8.2  tls if [ "x${REG_NEWMID}" != "x" ]; then
    298  1.1.1.1.8.2  tls   touch ${REG_FAILLIST}
    299  1.1.1.1.8.2  tls   SKIP_FAILURES=1
    300  1.1.1.1.8.2  tls else
    301  1.1.1.1.8.2  tls   SKIP_FAILURES=0
    302  1.1.1.1.8.2  tls fi
    303  1.1.1.1.8.2  tls 
    304  1.1.1.1.8.2  tls # If FIRST_MID was defined, make sure it's in the range.
    305  1.1.1.1.8.2  tls 
    306  1.1.1.1.8.2  tls if [ "x${FIRST_MID}" != "x" ]; then
    307  1.1.1.1.8.2  tls   test ${FIRST_MID} -le ${LOW_PATCH}  && \
    308  1.1.1.1.8.2  tls     error "FIRST_MID id is lower than LOW_PATCH"
    309  1.1.1.1.8.2  tls   test ${FIRST_MID} -ge ${HIGH_PATCH} && \
    310  1.1.1.1.8.2  tls     error "FIRST_MID is higher than HIGH_PATCH"
    311  1.1.1.1.8.2  tls else
    312  1.1.1.1.8.2  tls   FIRST_MID=0
    313  1.1.1.1.8.2  tls fi 
    314  1.1.1.1.8.2  tls 
    315  1.1.1.1.8.2  tls # Keep track of the bounds of the range where the test behavior changes.
    316  1.1.1.1.8.2  tls 
    317  1.1.1.1.8.2  tls LATER_THAN=${LOW_PATCH}
    318  1.1.1.1.8.2  tls EARLIER_THAN=${HIGH_PATCH}
    319  1.1.1.1.8.2  tls LATER=1
    320  1.1.1.1.8.2  tls 
    321  1.1.1.1.8.2  tls msg 1 "LATER_THAN   = ${LATER_THAN}"
    322  1.1.1.1.8.2  tls msg 1 "EARLIER_THAN = ${EARLIER_THAN}"
    323  1.1.1.1.8.2  tls 
    324  1.1.1.1.8.2  tls # Verify that the range isn't backwards.
    325  1.1.1.1.8.2  tls 
    326  1.1.1.1.8.2  tls test ${LOW_PATCH} -lt ${HIGH_PATCH} || \
    327  1.1.1.1.8.2  tls   error "patch identifier range is backwards"
    328  1.1.1.1.8.2  tls 
    329  1.1.1.1.8.2  tls # Verify that the first and last patches in the range get the results we
    330  1.1.1.1.8.2  tls # expect.  If not, quit, because any of several things could be wrong.
    331  1.1.1.1.8.2  tls 
    332  1.1.1.1.8.2  tls if [ ${SKIP_HIGH} -eq 0 ]; then
    333  1.1.1.1.8.2  tls   process_patch ${EARLIER_THAN}
    334  1.1.1.1.8.2  tls   test ${LATER} -ne 0 && \
    335  1.1.1.1.8.2  tls     error "unexpected result for high patch ${EARLIER_THAN}"
    336  1.1.1.1.8.2  tls   msg 1 "result for high patch ${EARLIER_THAN} is as expected"
    337  1.1.1.1.8.2  tls fi
    338  1.1.1.1.8.2  tls 
    339  1.1.1.1.8.2  tls if [ ${SKIP_LOW} -eq 0 ]; then
    340  1.1.1.1.8.2  tls   process_patch ${LATER_THAN}
    341  1.1.1.1.8.2  tls   test ${LATER} -ne 1 && \
    342  1.1.1.1.8.2  tls     error "unexpected result for low patch ${LATER_THAN}"
    343  1.1.1.1.8.2  tls   msg 1 "result for low patch ${LATER_THAN} is as expected"
    344  1.1.1.1.8.2  tls fi
    345  1.1.1.1.8.2  tls 
    346  1.1.1.1.8.2  tls # Search within the range, now that we know that the end points are valid.
    347  1.1.1.1.8.2  tls # If the build failed then FIRST_MID is set to a new patch to try.
    348  1.1.1.1.8.2  tls 
    349  1.1.1.1.8.2  tls VALID_RANGE=1
    350  1.1.1.1.8.2  tls while true; do
    351  1.1.1.1.8.2  tls   search_patches ${LATER_THAN} ${EARLIER_THAN}
    352  1.1.1.1.8.2  tls   test ${FIRST_MID} -eq 0 && break
    353  1.1.1.1.8.2  tls done
    354  1.1.1.1.8.2  tls 
    355  1.1.1.1.8.2  tls # Report where the test behavior changes.
    356  1.1.1.1.8.2  tls 
    357  1.1.1.1.8.2  tls echo "Test result changes with id ${EARLIER_THAN}"
    358  1.1.1.1.8.2  tls ${REG_REPORT} ${EARLIER_THAN}
    359  1.1.1.1.8.2  tls 
    360  1.1.1.1.8.2  tls # Invoke the optional script to verify the result and report additional
    361  1.1.1.1.8.2  tls # information about changes between the two patches.
    362  1.1.1.1.8.2  tls 
    363  1.1.1.1.8.2  tls ${REG_FINISH} ${LATER_THAN} ${EARLIER_THAN}
    364