List:Commits« Previous MessageNext Message »
From:Hakan Kuecuekyilmaz Date:May 14 2009 12:53pm
Subject:bzr commit into mysql-falcon branch (hky:383)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/mysql-falcon/ based on revid:hky@stripped

  383 Hakan Kuecuekyilmaz	2009-05-14 [merge]
      Merge.

    added:
      common/
      common/README
      common/machine-info.bash
      upgrade-downgrade/check_bzr_revid.bash
    modified:
      dbt2/include/host_caneland.inc
      upgrade-downgrade/README.txt
      upgrade-downgrade/RUNME.bash
      upgrade-downgrade/build.bash
      upgrade-downgrade/bzr_checkout.bash
      upgrade-downgrade/include/apply_patches.inc
      upgrade-downgrade/include/host_urd07.inc
      upgrade-downgrade/prepare_test.bash
      upgrade-downgrade/run_test.bash
      upgrade-downgrade/trd_falcon_updown_linux-32bit.env
=== added directory 'common'
=== added file 'common/README'
--- a/common/README	1970-01-01 00:00:00 +0000
+++ b/common/README	2009-05-05 15:08:57 +0000
@@ -0,0 +1,6 @@
+This directory is where to put scripts, binaries and tools that may
+be used directly by several different test suites etc. as part of 
+this repository.
+
+This way we avoid maintaining several copies/versions of the scripts/tools.
+

=== added file 'common/machine-info.bash'
--- a/common/machine-info.bash	1970-01-01 00:00:00 +0000
+++ b/common/machine-info.bash	2009-05-05 15:08:57 +0000
@@ -0,0 +1,200 @@
+#!/bin/bash
+
+###################################################################
+#
+# Displays information about the host on which this script is run.
+# CPU info, OS info, Memory, etc.
+#
+###################################################################
+
+PLATFORM=$(uname)
+
+if [ "${PLATFORM}" == "SunOS" ]; then
+    AWK='gawk'
+else
+    AWK='awk'
+fi
+
+# Common commands for all supported platforms:
+
+HOSTNAME=$(uname -n)
+HOSTNAME_FULL=$(cat /etc/hosts | grep ${HOSTNAME} | $AWK -F ' ' '{ print $3 }')
+# If unable to get full hostname this way, just use the simple version
+if [ "x${HOSTNAME_FULL}" == "x" ] || echo ${HOSTNAME_FULL} | grep "localhost" > /dev/null; then
+    HOSTNAME_FULL=${HOSTNAME}
+fi
+
+KERNEL=$(uname -srv)
+MODEL=$(uname -m)
+
+# Platform-specific commands:
+case $PLATFORM in
+
+    Linux)
+
+        ####################################
+        # Linux
+        
+        # Date / time
+        TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S %Z")
+        
+        # OS info
+        if [ -f "/etc/redhat-release" ]; then
+            # Red Hat, Fedora
+            OS_RELEASE=$(cat /etc/redhat-release)
+        elif [ -f "/etc/lsb-release" ] && cat /etc/lsb-release | grep "DISTRIB_DESCRIPTION" > /dev/null; then
+            # Ubuntu / Debian. OS version in lsb-release: "DISTRIB_DESCRIPTION=..."
+            source /etc/lsb-release
+            OS_RELEASE=${DISTRIB_DESCRIPTION}
+        elif [ -f "/etc/SuSE-release" ]; then
+            # SuSE
+            OS_RELEASE=$(cat /etc/SuSE-release | head -1)
+        elif [ -f "/etc/issue" ]; then
+            # Older Debian, SuSE or other linux.
+            OS_RELEASE=$(cat /etc/issue | grep -m1 [a-z])
+        else
+            # Don't know how to read OS release info for this OS
+            OS_RELEASE="Unknown"
+        fi
+        
+        
+        # CPU info
+        CPU_BRAND=$(cat  /proc/cpuinfo | grep -m1 "model name" | awk -F: '{ print $2 }')
+        # trim leading whitespace
+        CPU_BRAND=${CPU_BRAND## }  # trims leading spaces
+        
+        # Number of CPU cores and sockets/chips may be hard to get accurately.
+        # This is especially true for number of cores per chip. Hence, we
+        # base this on the other two numbers (# sockets, # cores) instead of
+        # doing the commented out part (below)
+        
+        # Some machines report non-sequential physical ids in random order. 
+        # So we must count distinct ids.
+        for id in $(cat /proc/cpuinfo | grep "physical id" | awk -F : '{ print $2 }')
+        do
+            # trim leading spaces
+            id=${id## }
+            # insert id into array at index $id in order to remove duplicates.
+            idarray[$id]=$id
+        done
+        NO_CPU_PHYSICAL=${#idarray[@]}  # element count
+        
+        # Doing division instead of this:
+        #NO_VCPU_PER_PHYSICAL=$(cat /proc/cpuinfo | grep -m1 "cpu cores" | awk -F : '{ print $2 }')
+        # Not all machines display # of cpu cores directly.
+        # Try using "siblings" instead if there is no core info..
+        #if [ -z "${NO_VCPU_PER_PHYSICAL}" ]; then
+        #    NO_VCPU_PER_PHYSICAL=$(cat /proc/cpuinfo | grep -m1 "siblings" | awk -F : '{ print $2 }')
+        #    NO_VCPU_PER_PHYSICAL=${NO_VCPU_PER_PHYSICAL## }  # trims leading spaces
+        #    NO_VCPU_PER_PHYSICAL="at least ${NO_VCPU_PER_PHYSICAL}"
+        #else
+        #    NO_VCPU_PER_PHYSICAL=${NO_VCPU_PER_PHYSICAL## }  # trims leading spaces
+        #fi
+        
+        NO_CPU_VIRTUAL=$(cat /proc/cpuinfo | grep processor | wc -l)
+        # ok, just do the math for vcpu (cores) per physical cpu (sockets)
+        let NO_VCPU_PER_PHYSICAL=${NO_CPU_VIRTUAL}/${NO_CPU_PHYSICAL}
+        VCPU_PER_PHYSICAL="Each physical processor seems to have ${NO_VCPU_PER_PHYSICAL} virtual processors"
+        CPU_FREQ=$(cat /proc/cpuinfo | grep -m1 "cpu MHz" | awk -F : '{ print $2 }')
+        CPU_FREQ=${CPU_FREQ## }  # trims leading spaces
+        CACHE=$(cat /proc/cpuinfo | grep -m1 "cache size" | awk -F : '{ print $2 }')
+        CACHE=${CACHE## }  # trims leading spaces
+        INSTR_SET_KERNEL=""
+        
+        
+        # Memory.   TODO: Refactor common code into functions.
+        MEM_TOTAL=$(cat /proc/meminfo | grep "MemTotal" | awk -F: '{ print $2 }')
+        MEM_TOTAL_MB=""
+        MEM_TOTAL_RAW_NUMBER=$(echo ${MEM_TOTAL} | awk -F' ' '{ print $1 }')
+        MEM_TOTAL_UNIT=$(echo ${MEM_TOTAL} | awk -F' ' '{ print $2 }')
+        if [ "${MEM_TOTAL_UNIT}" == "kB" ]; then
+            let m=$(echo "${MEM_TOTAL_RAW_NUMBER}/1024")
+            MEM_TOTAL_MB="($m MB)"
+        fi
+        MEM_FREE=$(cat /proc/meminfo | grep "MemFree" | awk -F: '{ print $2 }')
+        MEM_FREE="${MEM_FREE## }"  # trim leading spaces?
+        MEM_FREE_MB=""
+        MEM_FREE_RAW_NUMBER=$(echo ${MEM_FREE} | awk -F' ' '{ print $1 }')
+        MEM_FREE_UNIT=$(echo ${MEM_FREE} | awk -F' ' '{ print $2 }')
+        if [ "${MEM_FREE_UNIT}" == "kB" ]; then
+            let m=$(echo "${MEM_FREE_RAW_NUMBER}/1024")
+            MEM_FREE_MB="($m MB)"
+        fi
+        ;;
+        
+    SunOS)
+    
+        ####################################
+        # Solaris
+        
+        # TODO: Optimization: Run psrinfo etc. only once, store result in tmp file and read that file.
+
+        # Date / time
+        TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+        TIMESTAMP="${TIMESTAMP} (${TZ})"
+        
+        # OS
+        # Using sed to remove leading whitespace.
+        OS_RELEASE=$(cat /etc/release | head -1 | sed -e "s/^ *//") # Solaris
+        
+        # CPU info
+        CPU_BRAND=$(psrinfo -pv 1 | tail -1)
+        CPU_BRAND=${CPU_BRAND## }  # trims leading spaces
+        CPU_BRAND=${CPU_BRAND##[[:space:]]}  # trims single leading tab, see bash cookbook (2007) p. 270 (available on books.google.com)
+        NO_CPU_PHYSICAL=$(psrinfo -p)
+        VCPU_PER_PHYSICAL=$(psrinfo -pv | egrep "The physical processor has [0-9]+ virtual processors" | head -1 | sed -e "s/^The/Each/" | sed -e "s/processors.*/processors/")
+        NO_CPU_VIRTUAL=$(psrinfo | wc -l | sed -e "s/^ *//")
+        CPU_FREQ=$(psrinfo -v | grep "processor operates at " | head -1 | gawk '{ print $6 }')
+        CPU_FREQ=${CPU_FREQ## }  # trims leading spaces
+        CACHE="unknown"
+        INSTR_SET_KERNEL=$(isainfo -kv)
+        INSTR_SET_KERNEL="(${INSTR_SET_KERNEL})"
+        
+        # Memory.   TODO: Refactor common code into functions.
+        MEM_TOTAL=$(prtconf | grep "Memory size" | gawk -F: '{ print $2 }')
+        MEM_TOTAL=${MEM_TOTAL## }  # trims leading spaces
+        MEM_TOTAL_MB=""
+        MEM_TOTAL_RAW_NUMBER=$(echo ${MEM_TOTAL} | gawk -F' ' '{ print $1 }')
+        MEM_TOTAL_UNIT=$(echo ${MEM_TOTAL} | gawk -F' ' '{ print $2 }')
+        if [ "${MEM_TOTAL_UNIT}" == "kB" ]; then
+            let m=$(echo "${MEM_TOTAL_RAW_NUMBER}/1024")
+            MEM_TOTAL_MB="($m MB)"
+        fi
+        MEM_FREE=$(vmstat 1 2 | tail -1 | gawk -F' ' '{ print $5 }')
+        #MEM_FREE=${MEM_FREE## }  # trim leading spaces
+        MEM_FREE_MB=""
+        MEM_FREE_RAW_NUMBER=$(echo ${MEM_FREE} | gawk -F' ' '{ print $1 }')
+        # assuming that MEM_FREE unit is Kbytes
+        let m=$(echo "${MEM_FREE_RAW_NUMBER}/1024")
+        MEM_FREE_MB="($m MB)"
+
+
+        # Todo: ZFS version: modinfo | grep zfs....?
+        #                or: zfs upgrade
+        ;;
+    *)
+        echo '[ERROR]: Platform not supported yet. Exiting.'
+        exit 1
+        ;;
+esac
+
+#####################################
+# PRINT INFO
+
+echo
+echo "Machine info for ${HOSTNAME} at ${TIMESTAMP}:"
+echo "-----------------------------------------------------------------------------"
+echo "Host name:    ${HOSTNAME_FULL}"
+echo "OS:           ${OS_RELEASE}"
+echo "Kernel:       ${KERNEL} ${INSTR_SET_KERNEL}"
+echo "CPU:          ${CPU_BRAND}"
+echo "  ${VCPU_PER_PHYSICAL} (all assumed equal)"
+echo "  Physical CPUs (chips, sockets): ${NO_CPU_PHYSICAL}"
+echo "  Total vCPUs (cores, threads):   ${NO_CPU_VIRTUAL}"
+echo "  Clock speed:                    ${CPU_FREQ} MHz"
+echo "  Cache:                          ${CACHE}"
+echo "  Model:                          ${MODEL}"
+echo "Total Memory: ${MEM_TOTAL} ${MEM_TOTAL_MB}"
+echo "Free Memory:  ${MEM_FREE} ${MEM_FREE_MB}"
+echo ""
+

=== modified file 'dbt2/include/host_caneland.inc'
--- a/dbt2/include/host_caneland.inc	2008-12-18 06:38:48 +0000
+++ b/dbt2/include/host_caneland.inc	2009-05-04 17:52:24 +0000
@@ -4,11 +4,11 @@
 #
 #     caneland.mysql.com
 #
-# OS:                Linux (SUSE)
+# OS:                Linux Fedora 10
 # CPU:               Intel Xeon,
-#                    24 x 2.66 GHz (4 x 6 cores), 16MB L2 Cache
+#                    24 x 2.9 GHz (4 x 6 cores), 16MB L2 Cache
 # RAM:               32 GB
-# Local file system: ext3
+# Local file system: ext3, hardware RAID 10
 #
 # John H. Embretsen, <john dot embretsen at sun dot com>, 2008-07-22.
 # $Id$
@@ -79,14 +79,11 @@ DO_OPROFILE[100]='032 192'
 PATH="/usr/local/bin:$PATH"
 PATCH=patch
 MAKE=make
-OPCONTROL='sudo /usr/local/bin/opcontrol'
-OPREPORT='sudo /usr/local/bin/opreport'
+OPCONTROL='sudo /usr/bin/opcontrol'
+OPREPORT='sudo /usr/bin/opreport'
 
 # Path to mail program which accepts -s for sending mails.
 MAIL=mail
 
 # Path to Perl with Statistics::Descriptive.
 PERL=/usr/bin/perl
-
-# Where to find datagen.
-DATAGEN='/usr/local/bin/datagen'

=== modified file 'upgrade-downgrade/README.txt'
--- a/upgrade-downgrade/README.txt	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/README.txt	2009-04-28 12:20:36 +0000
@@ -5,26 +5,50 @@ Falcon storage engine.
 For more information about the "updown" test framework, see
 https://inside.mysql.com/wiki/QA_UpDown_Howto
 
+Versions to test:
+------------------
+
 You can adjust the location of the binaries you want to test in the environment
 file pointed to by the variable "UPDOWN_ENV_FILE" in the host-specific script
 which you can find in the include/ directory.
 
 For example, such an environment file could be "trd_falcon_updown.env".
 
+To run against the most recent version of the branch specified by the variable
+FALCON (usually mysql-6.0-falcon-team), specify a string not containing slashes
+or any characters that may confuse a "sed -e s/...." command
+as TOP_DIR_NEW or TOP_DIR_OLD in the environment file.
+
 The environment file will be copied automatically to the local working copy of the 
 mysql-test-extra-6.0 repository when the test is run (see prepare_test.bash).
 
+
+Running the test:
+------------------
 You can run the test by doing:
 
 bash ./RUNME.bash
 
+
+Further configuration:
+-----------------------
+
 See host-specific .inc file in include/ for details regarding variables used
-in the various other scripts.
+in the various other scripts. If you cannot find such a file for your host,
+please add one by copying an existing host file and adjusting the values to
+suit your environment.
+
+Patches:
+---------
+The build script will try to apply patches in the directory specified by the
+PATCHES variable in the host script, if and only if the patch file name includes
+the name of the bzr branch against which the patch should be aplied.
+
+For example, if you want to have a patch to be applied against the 
+mysql-test-extra-6.0 branch every time you run the test, add it to the
+PATCHES directory and make sure the file name contains the string
+"mysql-test-extra-6.0". To disable a patch, rename it or (re)move it.
 
-TODOs:
- - Build TOP_DIR_OLD / TOP_DIR_NEW if mysqld binary not found in these dirs?
- - Do not use FALCON_LOCAL_WORK_BZR, only TOP_DIR_OLD and TOP_DIR_NEW?
- - Add support for E-mail reporting?
 
 -- 
 John H. Embretsen, John.Embretsen [at] Sun.COM

=== modified file 'upgrade-downgrade/RUNME.bash'
--- a/upgrade-downgrade/RUNME.bash	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/RUNME.bash	2009-05-05 12:32:00 +0000
@@ -5,11 +5,11 @@
 #
 #  - Code / test checkout from bzr repositories
 #  - Patch relevant working copies if applicable
-#  (- Build binaries from source code)
-#  (- Prepare test run)
-#  (- Run test)
-#  (- Collect and analyze results)
-#  (- Report results)
+#  - Build binaries from source code (if needed)
+#  - Prepare test run
+#  - Run test
+#  - Collect and analyze results
+#  - Report results
 #  (- Archive results )
 #
 # John Embretsen, <john dot embretsen at sun dot com>, 2009-04-21.
@@ -20,6 +20,62 @@
 #  - bash 3 or newer
 #
 
+##########################################################################
+#
+# functions.
+#
+##########################################################################
+
+# Sends an E-mail
+#
+# Required parameters:
+#    1: E-mail address to send E-mail to.
+#    2: Special log file to append to E-mail
+#    3: Message to be used as part of E_mail subject. Keep it short.
+send_mail ()
+{
+    local TO_ADDRESS="$1"
+    local SPECIAL_LOG="$2"
+    local MSG="$3"
+    TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
+    
+    ########### MAIL ######################
+    # Compose the mail
+    echo "To: ${TO_ADDRESS}" > ${MAILFILE}
+    echo "Bcc: ${ADMIN}" >> ${MAILFILE}
+    echo "From: ${ADMIN}" >> ${MAILFILE}
+    # Need Return-Path to send to public mysql lists
+    echo "Return-Path: ${ADMIN}" >> ${MAILFILE}
+    echo "Content-type: text/plain" >> ${MAILFILE}
+    echo "Subject: [AUTO_updown] ${MSG}" >> ${MAILFILE}
+    echo "" >> ${MAILFILE}
+    echo ${MSG} >> ${MAILFILE}
+    echo "" >> ${MAILFILE}
+    echo "${TSTAMP}:" >> ${MAILFILE} 
+    echo "  This is an automatically generated E-mail." >> ${MAILFILE}
+    echo "  See logs in ${LOG_DIR} on ${HOSTNAME} for details." >> ${MAILFILE}
+    echo "  Partial log follows below." >> ${MAILFILE}
+    echo "" >> ${MAILFILE}
+    echo "" >> ${MAILFILE}
+    echo ${MSG} >> ${RUNME_LOG}
+    cat ${RUNME_LOG} >> ${MAILFILE}
+    if [ -f "${SPECIAL_LOG}" ]; then
+        echo "" >> ${MAILFILE}
+        echo "---------------- SPECIFIC LOG FOLLOWS: ${SPECIAL_LOG##*/} -----------------" >> ${MAILFILE}
+        echo "" >> ${MAILFILE}
+        cat ${SPECIAL_LOG} >> ${MAILFILE}
+    fi
+    # Send the mail
+    cat ${MAILFILE} | ${MAIL} -t
+    # Delete the (temporary) mail text
+    rm ${MAILFILE} 2>>${RUNME_LOG}
+    ########## END MAIL ###################
+    
+    echo "[INFO] Mail sent to ${TO_ADDRESS}" >> ${RUNME_LOG}   
+}
+
+########### END OF FUNCTION DEFINITIONS ##################################
+
 #
 # Hostname. Needed for various paths, directories, includes.
 #
@@ -57,6 +113,7 @@ cd ${AUTO_BASE}
 # Files
 #
 RUNME_LOG="${LOG_DIR}/runme.log"
+MAILFILE="${AUTO_BASE}/mailfile.txt"
 
 echo "********* MySQL/Falcon Upgrade/Downgrade testing - RUNME SCRIPT **********" >> ${RUNME_LOG}
 echo "" >> ${RUNME_LOG}
@@ -67,31 +124,84 @@ echo "" >> ${RUNME_LOG}
 
 #######################################################################
 #
+# Environment file preparation.
+#
+#######################################################################
+
+# We may edit the environment file later, for example in order to specify
+# the real location of the MySQL binaries at run time.
+# Always make a copy of the environment file and use that in the rest of
+# these scripts, to avoid interference with later test runs.
+echo "[INFO_runme]: Copying the test environment file..." >> ${RUNME_LOG}
+cp ${UPDOWN_ENV_FILE} ${UPDOWN_ENV_FILE_COPY} 2>>${RUNME_LOG}
+
+
+#######################################################################
+#
 # bzr checkout and patching of working dirs.
 #
+# Do not branch, build and run if we did the same with the exact same
+# version in the previous test run.
+#
+# Check bzr revision of the NEW version (if it is a bzr branch) against
+# a possibly previously recorded revision-id.
+# Skip running the test if the versions match, unless 
+# SKIP_TEST_IF_BRANCH_UNCHANGED=false.
+#
 #######################################################################
 TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
-echo "[RUNME_${TSTAMP}] Running bzr_checkout.sh..." >> ${RUNME_LOG}
+echo "[RUNME_${TSTAMP}] Running bzr_checkout.bash..." >> ${RUNME_LOG}
 ${AUTO_BASE}/bzr_checkout.bash
-if [ $? != 0 ]; then
-    echo "[ERROR_RUNME] bzr checkout script failed!" >> ${RUNME_LOG}
-    echo "[ERROR_RUNME] bzr checkout script failed!"
+EXIT_CODE=$?
+if [ ${EXIT_CODE} -eq 144 ]; then
+    echo "[INFO_RUNME] Got exit code 144: bzr revid same as in previous test run!" >> ${RUNME_LOG}
+    echo "[INFO_RUNME] SKIP_TEST_IF_BRANCH_UNCHANGED: ${SKIP_TEST_IF_BRANCH_UNCHANGED}" >> ${RUNME_LOG}
+
+    if $SKIP_TEST_IF_BRANCH_UNCHANGED; then
+        echo "[INFO_RUNME] Skipping this test run" >> ${RUNME_LOG}
+
+        # Send report by E-mail...
+        TO_ADDRESS="${ADMIN}"
+        SPECIAL_LOG="${LOG_DIR}/check_bzr_revid.log"
+        MSG="SKIP upgrade/downgrade test due to same bzr revid as last run on ${HOSTNAME}"
+        send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
+        exit 0
+    fi
+elif [ ${EXIT_CODE} -ne 0 ]; then
+    # exit code was not 0 and not 144
+    echo "[ERROR_RUNME] bzr checkout script failed with exit code ${EXIT_CODE}!" >> ${RUNME_LOG}
+    echo "[ERROR_RUNME] bzr checkout script failed with exit code ${EXIT_CODE}!"
     echo "[ERROR_RUNME] See logs in ${LOG_DIR}"
+
+    # Send report by E-mail...
+    TO_ADDRESS="${ADMIN}"
+    SPECIAL_LOG="${LOG_DIR}/bzr.log"
+    MSG="ERROR during bzr operations prior to upgrade/downgrade test on ${HOSTNAME}"
+    send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
+    
     exit 1
 fi
 
+# else: exit code is 0, so we just continue.
+
 #######################################################################
 #
 # build necessary binaries.
 #
 #######################################################################
 TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
-echo "[RUNME_${TSTAMP}] Running build.sh..." >> ${RUNME_LOG}
+echo "[RUNME_${TSTAMP}] Running build.bash..." >> ${RUNME_LOG}
 ${AUTO_BASE}/build.bash
 if [ $? != 0 ]; then
     echo "[ERROR_RUNME] build.sh script failed!" >> ${RUNME_LOG}
     echo "[ERROR_RUNME] build.sh script failed!"
     echo "[ERROR_RUNME] See logs in ${LOG_DIR}"
+    
+    TO_ADDRESS="${ADMIN}"
+    SPECIAL_LOG="${LOG_DIR}/build.log"
+    MSG="ERROR during build script for upgrade/downgrade test on ${HOSTNAME}"
+    send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
+
     exit 1
 fi
 
@@ -107,6 +217,13 @@ if [ $? != 0 ]; then
     echo "[ERROR_RUNME] prepare_test.bash script failed!" >> ${RUNME_LOG}
     echo "[ERROR_RUNME] prepare_test.bash script failed!"
     echo "[ERROR_RUNME] See logs in ${LOG_DIR}"
+
+    # Send report on E-mail
+    TO_ADDRESS="${ADMIN}"
+    SPECIAL_LOG="${LOG_DIR}/prepare_test.log"
+    MSG="ERROR while preparing upgrade/downgrade test on $HOSTNAME"
+    send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
+
     exit 1
 fi
 
@@ -117,12 +234,28 @@ fi
 #######################################################################
 TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
 echo "[RUNME_${TSTAMP}] Running run_test.bash..." >> ${RUNME_LOG}
-${AUTO_BASE}/run_test.bash 2>${RUNME_LOG}
+${AUTO_BASE}/run_test.bash 2>>${RUNME_LOG}
 if [ $? != 0 ]; then
     echo "[ERROR_RUNME] run_test.bash script failed!" >> ${RUNME_LOG}
     echo "[ERROR_RUNME] run_test.bash script failed!"
     echo "[ERROR_RUNME] See logs in ${LOG_DIR}"
+
+    # Send report by E_mail
+    TO_ADDRESS="${REPORT_TO}"
+    SPECIAL_LOG="${LOG_DIR}/run_test.log"
+    MSG="FAIL: Upgrade/downgrade test run FAILED on ${HOSTNAME}"
+    send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
+
     exit 1
+else
+    # Success! Send report by E_mail
+    TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
+    echo "[RUNME_${TSTAMP}] Test script completed with success." >> ${RUNME_LOG}
+    
+    TO_ADDRESS="${REPORT_TO}"
+    SPECIAL_LOG="${VERSION_FILE}"
+    MSG="Upgrade/downgrade test run succeeded on ${HOSTNAME}"
+    send_mail "${TO_ADDRESS}" "${SPECIAL_LOG}" "${MSG}"
 fi
 
 

=== modified file 'upgrade-downgrade/build.bash'
--- a/upgrade-downgrade/build.bash	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/build.bash	2009-04-29 12:07:27 +0000
@@ -1,9 +1,10 @@
 #! /bin/bash
 #
-# Build source version of MySQL / Falcon if needed.
+# Build source version(s) of MySQL / Falcon if needed.
 #
-# Not building if local work directories do not correspond to TOP_DIR_OLD
-# or TOP_DIR_NEW in environment file for this test (see prepare_test.bash).
+# Looks in directories specified by variable TOP_DIR_OLD and TOP_DIR_NEW for
+# mysqld binaries. If the binary is not found in expected locations, we try to
+# build it ourselves.
 #
 # When running this script for the first time on a given host, add a file named
 # "include/host_<hostname>.inc" first. Copy from another host_<hostname>.inc
@@ -18,7 +19,8 @@
 HOSTNAME=$(hostname)
 
 #
-# Name of directory where this script is located
+# Name of directory where this script is located.
+# Assumes that this script was called with full path.
 #
 DIRNAME="${0%/*}"
 
@@ -49,96 +51,120 @@ ARCH=$(uname -m)
 #
 # Files
 #
-BUILD_LOG=${LOG_DIR}/build.log
+BUILD_LOG=${LOG_DIR}/build.log   # If you change the file name make sure you keep RUNME.bash up to date.
 
-#
-# Read paths from the environment file
-# We need:
-#  TOP_DIR_OLD (top-level dir of installation / src+build of OLD version to test.)
-#  TOP_DIR_NEW (top-level dir of installation / src+build of NEW version to test.)
-#
-source ${UPDOWN_ENV_FILE}
+echo "[INFO]: Starting build.bash for test run of $TIMESTAMP" > $BUILD_LOG
 
+#####################################################
 #
-# IF both TOP_DIR_OLD and TOP_DIR_NEW are different from FALCON_LOCAL_WORK_BZR,
-# then do not build anything.
-#
-# TODO: Build TOP_DIR_OLD / TOP_DIR_NEW if mysqld binary not found?
-#       Do not use FALCON_LOCAL_WORK_BZR if we are testing releases?
+# Functions
 #
-if [ "${TOP_DIR_OLD}" != "${FALCON_LOCAL_WORK_BZR}" ] && [ "${TOP_DIR_NEW}" != "${FALCON_LOCAL_WORK_BZR}" ]; then
-    echo "[INFO] Local bzr checkout ${FALCON_LOCAL_WORK_BZR} not defined in updown env file." >> $BUILD_LOG
-    echo "[INFO] Not doing build, assuming we are testing pre-build versions." >> ${BUILD_LOG}
-    exit
-fi
-
+#####################################################
 #
 # Build new mysqld with Falcon support.
 #
 # Check whether we had a successful branch on file server
 # and build latest mysqld.
-echo "[INFO]: Starting build.sh for test run of $TIMESTAMP" > $BUILD_LOG
-if [ -d ${FALCON_LOCAL_WORK_BZR} ]; then
-    cd ${FALCON_LOCAL_WORK_BZR}
-    echo "[INFO] Running: BUILD/autorun.sh" >> $BUILD_LOG 2>&1 
-    BUILD/autorun.sh >> $BUILD_LOG 2>&1
-
-    case $PLATFORM in
-        Linux)
-            # Linux gcc
-            source ${AUTO_BASE}/include/configure_linux_gcc.inc >> $BUILD_LOG 2>&1
-
-            J=$(cat /proc/cpuinfo | grep processor | wc -l)
-            J=$(( $J + 1 ))
-            ;;
-        SunOS)
-            if [ x"$ARCH" = x'i86pc' ]; then
-                # Solaris/x86 gcc
-                source ${BZR_BASE}/include/configure_solaris_x86_gcc.inc >> $BUILD_LOG 2>&1
-
-                J=$(psrinfo  | wc -l)
+build_from_sources ()
+{
+    # Parameter 1: Full path to source dir.
+    SOURCE_DIR="$1"
+    
+    if [ -d ${SOURCE_DIR} ]; then
+        TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
+        echo "[INFO] ${TSTAMP}: Building ${SOURCE_DIR}..." >> ${BUILD_LOG}
+        cd ${SOURCE_DIR}
+        echo "[INFO] Running: BUILD/autorun.sh" >> $BUILD_LOG 2>&1 
+        BUILD/autorun.sh >> $BUILD_LOG 2>&1
+    
+        case $PLATFORM in
+            Linux)
+                # Linux gcc
+                source ${AUTO_BASE}/include/configure_linux_gcc.inc >> $BUILD_LOG 2>&1
+    
+                J=$(cat /proc/cpuinfo | grep processor | wc -l)
                 J=$(( $J + 1 ))
-            elif [ x"$ARCH" =  x'sun4v' ]; then
-                # Solaris/SPARC gcc
-                source ${BZR_BASE}/include/configure_solaris_sparc_gcc.inc >> $BUILD_LOG 2>&1
-
-                J=8
-            fi
-            ;;
-        *)
-            echo '[ERROR]: Platform not supported yet. Exiting.' >> $BUILD_LOG
-            echo '[ERROR]: Platform not supported yet. Exiting.'
+                ;;
+            SunOS)
+                if [ x"$ARCH" = x'i86pc' ]; then
+                    # Solaris/x86 gcc
+                    source ${AUTO_BASE}/include/configure_solaris_x86_gcc.inc >> $BUILD_LOG 2>&1
+    
+                    J=$(psrinfo  | wc -l)
+                    J=$(( $J + 1 ))
+                elif [ x"$ARCH" =  x'sun4v' ]; then
+                    # Solaris/SPARC gcc
+                    source ${AUTO_BASE}/include/configure_solaris_sparc_gcc.inc >> $BUILD_LOG 2>&1
+    
+                    J=8
+                fi
+                ;;
+            *)
+                echo '[ERROR]: Platform not supported yet. Exiting.' >> $BUILD_LOG
+                echo '[ERROR]: Platform not supported yet. Exiting.'
+                exit 1
+                ;;
+        esac
+    
+        ###############################
+        # CONFIGURE
+        ###############################
+        echo "" >> ${BUILD_LOG} 2>&1
+        echo '[INFO] Running configure:'  >> ${BUILD_LOG} 2>&1
+        echo "./configure $CONFIGURATION"  >> ${BUILD_LOG} 2>&1
+        echo ""  >> ${BUILD_LOG} 2>&1
+        ./configure $CONFIGURATION >> ${BUILD_LOG} 2>&1
+        
+        ###############################
+        # MAKE
+        ###############################
+        echo "" >> ${BUILD_LOG} 2>&1
+        echo "======================================================================" >> ${BUILD_LOG} 2>&1
+        echo '[INFO] Running make:'  >> ${BUILD_LOG} 2>&1
+        echo "$MAKE -j$J" >> ${BUILD_LOG} 2>&1
+        echo ""  >> ${BUILD_LOG} 2>&1
+        $MAKE -j$J >> $BUILD_LOG 2>&1
+
+        # ${VAR##*/} is a bash-efficient way of doing $(basename $VAR)
+        if [ $? != 0 ]; then
+            TSTAMP=$(date +%Y-%m-%d_T_%H%M%S)
+            echo "[ERROR] Build of ${SOURCE_DIR##*/} failed! ${TSTAMP}" >> $BUILD_LOG
             exit 1
-            ;;
-    esac
-
-    ###############################
-    # CONFIGURE
-    ###############################
-    echo "" >> ${BUILD_LOG} 2>&1
-    echo '[INFO] Running configure:'  >> ${BUILD_LOG} 2>&1
-    echo "./configure $CONFIGURATION"  >> ${BUILD_LOG} 2>&1
-    echo ""  >> ${BUILD_LOG} 2>&1
-    ./configure $CONFIGURATION >> ${BUILD_LOG} 2>&1
-    
-    ###############################
-    # MAKE
-    ###############################
-    echo "" >> ${BUILD_LOG} 2>&1
-    echo "======================================================================" >> ${BUILD_LOG} 2>&1
-    echo '[INFO] Running make:'  >> ${BUILD_LOG} 2>&1
-    echo "$MAKE -j$J" >> ${BUILD_LOG} 2>&1
-    echo ""  >> ${BUILD_LOG} 2>&1
-    $MAKE -j$J >> $BUILD_LOG 2>&1
-
-    if [ $? != 0 ]; then
-        echo "[ERROR] Build of ${FALCON} failed!" >> $BUILD_LOG
-        exit 1
+        else
+        echo "[INFO]: Build of ${SOURCE_DIR##*/} was successful! ${TSTAMP}" >> $BUILD_LOG
+        fi
     else
-        echo "[INFO]: Build of ${FALCON} was successful!" >> $BUILD_LOG
+        echo "[ERROR_build] Unable to find mysql sources at ${SOURCE_DIR}" >> $BUILD_LOG
+        exit 1
     fi
+}
+
+############# END OF FUNCTIONS #############################
+
+#
+# Read paths from the environment file
+# We need:
+#  TOP_DIR_OLD (top-level dir of installation / src+build of OLD version to test.)
+#  TOP_DIR_NEW (top-level dir of installation / src+build of NEW version to test.)
+#
+source ${UPDOWN_ENV_FILE_COPY}
+
+#
+# Look for mysqld binary in TOP_DIR_OLD and TOP_DIR_NEW.
+# Try to build sources only if binary is not found where expected.
+#
+if [ ! -f "${TOP_DIR_OLD}/sql/mysqld" ] && [ ! -f "${TOP_DIR_OLD}/bin/mysqld" ] && [ ! -f "${TOP_DIR_OLD}/libexec/mysqld" ]; then
+    echo "[INFO] mysqld binary not found in OLD version: ${TOP_DIR_OLD}" >> $BUILD_LOG
+    build_from_sources ${TOP_DIR_OLD}
 else
-    echo "[ERROR_build] Unable to find falcon sources at ${FALCON_LOCAL_WORK_BZR}" >> $BUILD_LOG
-    exit 1
+    echo "[INFO] mysqld binary found in TOP_DIR_OLD. No need to build." >> $BUILD_LOG
 fi
 
+if [ ! -f "${TOP_DIR_NEW}/sql/mysqld" ] && [ ! -f "${TOP_DIR_NEW}/bin/mysqld" ] && [ ! -f "${TOP_DIR_NEW}/libexec/mysqld" ]; then
+    echo "[INFO] mysqld binary not found in NEW version: ${TOP_DIR_NEW}" >> $BUILD_LOG
+    build_from_sources ${TOP_DIR_NEW}
+else
+    echo "[INFO] mysqld binary found in TOP_DIR_NEW. No need to build." >> $BUILD_LOG
+fi
+
+

=== modified file 'upgrade-downgrade/bzr_checkout.bash'
--- a/upgrade-downgrade/bzr_checkout.bash	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/bzr_checkout.bash	2009-05-08 08:24:29 +0000
@@ -1,14 +1,90 @@
 #! /bin/bash
 #
-# Pull latest HEAD of given repository and branch it.
+# Pull latest HEAD of given repository and branch it ("quick and dirty version").
+#
+# Looks in directories specified by variable TOP_DIR_OLD and TOP_DIR_NEW for
+# falcon sources.
+#
+# A special case is if TOP_DIR_OLD or TOP_DIR_NEW does not provide a full path
+# to a source/installation directory, but instead something else.
+# If the value if either if these variables does not contain one or more "/"
+# (slashes) we try to branch the falcon branch ourself, into the directory
+# pointed to by LOCAL_BZR_ROOT_SERVER.
+# The branch is identified by variables in the include file for this host.
+# If the value contains slashes but is not a valid path, the test run is aborted.
+#
+# Then, in the environment file, the value is replaced with the actual
+# path to the checked out branch, which is required for building binaries
+# and running the test through the updown framework.
 #
 # When running this script for the first time on a given host, add a file named
 # "include/host_<hostname>.inc" first. Copy from another host_<hostname>.inc
 # file and adjust the variables as necessary.
 #
+# Requires perl, cat, bzr.
+# (Using perl instead of sed for string replacements because sed on solaris
+#  does not support in-place replacement (-i))
+#
 # John Embretsen, <john dot embretsen at sun dot com>, 2009-04-20.
 # $Id$
 
+#####################################################
+#
+# Functions.
+#
+#####################################################
+
+#
+# Updates the falcon master branch if it exists, or creates the branch if
+# it cannot be found.
+# Also checking for a shared repository in the local bzr root directory for
+# mysql server checkouts. If not found, creating one (bzr init-repo). This is
+# to speed up subsequent branching.
+#
+update_falcon_master()
+{
+    if [ ! -d ${FALCON_LOCAL_MASTER} ]; then
+        echo '[INFO] Initial Falcon branch did not exist.' >> $LOG
+        if [ ! -d ${LOCAL_BZR_ROOT_SERVER}/.bzr ]; then
+            echo "[INFO] Shared bzr repository not found in ${LOCAL_BZR_ROOT_SERVER}." >> $LOG
+            echo '[INFO] Creating shared bzr repository: bzr init-repo' >> $LOG
+            bzr init-repo ${WORK} >> $LOG 2>&1
+        fi
+        echo 'Branching ${FALCON} now. This will take quite a while!' >> $LOG
+        echo "bzr branch ${FALCON_BZR_ROOT} ${FALCON_LOCAL_MASTER}" >> /dev/null 2>&1
+        bzr branch ${FALCON_BZR_ROOT} ${FALCON_LOCAL_MASTER} >> /dev/null 2>&1
+    fi
+
+    if [ $? != 0 ]; then
+        echo "[ERROR] Branching of ${FALCON_BZR_ROOT} failed" >> $LOG
+        return 1
+    fi
+
+    # Update local master branch
+    echo "[INFO] Updating (bzr pull) local master branch (falcon)..." >> $LOG
+    cd ${FALCON_LOCAL_MASTER}
+    bzr pull >> /dev/null 2>&1
+    if [ $? != 0 ]; then
+        echo "[ERROR] Pull of ${FALCON_LOCAL_MASTER} failed" >> $LOG
+        return 1
+    fi
+
+    cd ..
+
+}
+
+branch_falcon()
+{
+    # Get new working copy based on local master branch...
+    echo "[INFO] Branching working copy of ${FALCON} from local master branch..." >> $LOG
+    bzr branch ${FALCON_LOCAL_MASTER} ${FALCON_LOCAL_WORK_BZR} >> $LOG 2>&1
+    if [ $? != 0 ]; then
+        echo "[ERROR] Branching of ${FALCON_LOCAL_MASTER} into ${FALCON_LOCAL_WORK_BZR} failed." >> $LOG
+        return 1
+    fi
+}
+
+############## END OF FUNCTION DEFINITIONS ######################
 #
 # Hostname. Needed for various paths, directories, includes.
 #
@@ -40,6 +116,7 @@ source ${HOST_INCLUDE_FILE}
 #
 # Files.
 #
+# If you change a file name make sure you keep RUNME.bash up to date.
 LOG="${LOG_DIR}/bzr.log"
 
 #
@@ -56,90 +133,254 @@ TIMESTAMP_H=$(date +%Y-%m-%d_T_%H)
 
 echo "[INFO] Starting $0 (bzr checkouts) - $TIMESTAMP" >> $LOG
 
+#
+# Read paths from the environment file
+# We need:
+#  TOP_DIR_OLD (top-level dir of installation / src+build of OLD version to test.)
+#  TOP_DIR_NEW (top-level dir of installation / src+build of NEW version to test.)
+#
+source ${UPDOWN_ENV_FILE_COPY}
+
+#
+# Examine values of TOP_DIR_OLD and TOP_DIR_NEW, whether they are full paths
+# to an existing directory or something else.
+#
+#  - If both are full paths to a directory, assume there is no need to obtain
+#    bzr sources for MySQL (we still need a test-extra working copy).
+#
+#  - If one or more value is not a full path, then branch the falcon branch
+#    indicated by FALCON_BZR_ROOT into the directory specified by 
+#    LOCAL_BZR_ROOT_SERVER. Then edit the environment file so that
+#    the full path to the checked out sources can be found by other scripts.
+#
+# Detecting path by looking for / (slash) in variable's value. If found,
+# check if it is a directory. If not directory, bail out.
+
+# OLD version
+if echo "${TOP_DIR_OLD}" | grep "/" > /dev/null; then
+    # Slash found, assuming full path
+    if [ -d "${TOP_DIR_OLD}" ]; then
+        echo "[INFO] Found path to OLD version: ${TOP_DIR_OLD}" >> $LOG
+        # TODO: could add mmore checks here, for robustness.
+    else
+        echo "[ERROR_bzr] TOP_DIR_OLD not recognized as valid directory: ${TOP_DIR_OLD}" >> $LOG
+        echo "[ERROR_bzr] TOP_DIR_OLD not recognized as valid directory: ${TOP_DIR_OLD}"
+        exit 1
+    fi
+else
+    # Slash not found, assuming that we want to use a fresh falcon branch as
+    # specified in the host include file.
+    #
+    # Note: Support for refresh/bzr version of both OLD and NEW versions is not
+    #       well developed yet.
+    #
+    echo "[INFO] TOP_DIR_OLD=${TOP_DIR_OLD}" >> $LOG
+    echo "[INFO] TOP_DIR_OLD is not a path. Will try to use a local branch of ${FALCON} instead." >> $LOG
+    
+    # Replace TOP_DIR_OLD's value in environment file:
+    echo "[INFO] Customizing the working copy of the environment file ${UPDOWN_ENV_FILE_COPY}..." >> $LOG
+    echo "[INFO] TOP_DIR_OLD: Trying to replace \'$TOP_DIR_OLD\' with \'$FALCON_LOCAL_WORK_BZR\'" >> $LOG
+    # Using % as separator in replacement expression since path will include slashes.
+    $PERL -pi -e "s%^TOP_DIR_OLD.*%TOP_DIR_OLD=${FALCON_LOCAL_WORK_BZR}%" ${UPDOWN_ENV_FILE_COPY} 2>>$LOG
+    if [ $? -ne 0 ]; then
+        echo "[ERROR_bzr] Replacing TOP_DIR_OLD in ${UPDOWN_ENV_FILE_COPY} failed!" >> $LOG
+        echo "[ERROR_bzr] Replacing TOP_DIR_OLD in ${UPDOWN_ENV_FILE_COPY} failed!"
+        exit 1
+    fi
+    
+    if ! update_falcon_master; then
+        echo "[ERROR_bzr] Failed updating local falcon master branch. Aborting script." >> $LOG
+        echo "[ERROR_bzr] Failed updating local falcon master branch. Aborting script."
+        exit 1
+    fi
+    
+    if [ -d "${FALCON_LOCAL_WORK_BZR}" ]; then
+        echo "[INFO] Local branch exists at ${FALCON_LOCAL_WORK_BZR}." >> $LOG
+        if ${FALCON_REFRESH}; then
+            echo "[INFO] Will do a clean refresh of old branch/working dir." >> $LOG
+            echo "[INFO] Deleting old working copy of Falcon src at ${FALCON_LOCAL_WORK_BZR}" >> $LOG
+            rm -rf ${FALCON_LOCAL_WORK_BZR} 2>>$LOG
+            DO_FALCON_BRANCHING=true
+        else
+            echo "[INFO] No refresh; keeping branch at ${FALCON_LOCAL_WORK_BZR}". >> $LOG
+            DO_FALCON_BRANCHING=false
+            # Remember: We need to set the correct path in the environment file anyway.
+        fi
+    else 
+        echo "[INFO] Local branch not found. Will try branching a new one..." >> $LOG
+        DO_FALCON_BRANCHING=true
+    fi
+
+    if ${DO_FALCON_BRANCHING}; then
+        branch_falcon
+        if [ $? -eq 0 ]; then
+            echo "[INFO] Bzr branching of OLD version successful." >> $LOG
+         else
+            echo "[ERROR] Bzr branching of OLD version failed! Exiting." >> $LOG
+            echo "[ERROR] Bzr branching of OLD version (${FALCON}) failed!"
+            exit 1
+        fi
+        # reset flag before processing NEW version
+        DO_FALCON_BRANCHING=false
+    fi # end DO_FALCON_BRANCHING
+fi
+
+# NEW version
+if echo "${TOP_DIR_NEW}" | grep "/" > /dev/null; then
+    # Slash found, assuming full path
+    if [ -d "${TOP_DIR_NEW}" ]; then
+        echo "[INFO] Found path to NEW version: ${TOP_DIR_NEW}" >> $LOG
+        # TODO: could add more checks here, for robustness.
+    else
+        echo "[ERROR_bzr] TOP_DIR_NEW not recognized as valid directory: ${TOP_DIR_NEW}" >> $LOG
+        echo "[ERROR_bzr] TOP_DIR_NEW not recognized as valid directory: ${TOP_DIR_NEW}"
+        exit 1
+    fi
+else
+    # Slash not found, assuming that we want to use a falcon branch as
+    # specified in the host include file.
+    
+    # Replace TOP_DIR_NEW's value in the environment file:
+    echo "[INFO] Customizing the working copy of the environment file ${UPDOWN_ENV_FILE_COPY}..." >> $LOG
+    echo "[INFO] TOP_DIR_NEW: Trying to replace $TOP_DIR_NEW with $FALCON_LOCAL_WORK_BZR" >> $LOG
+    # Using % as separator in replacement expression since path will include slashes.
+    $PERL -pi -e "s%^TOP_DIR_NEW.*%TOP_DIR_NEW=${FALCON_LOCAL_WORK_BZR}%" ${UPDOWN_ENV_FILE_COPY} 2>>$LOG
+    if [ $? -ne 0 ]; then
+        echo "[ERROR_bzr] Replacing TOP_DIR_NEW in ${UPDOWN_ENV_FILE_COPY} failed!" >> $LOG
+        echo "[ERROR_bzr] Replacing TOP_DIR_NEW in ${UPDOWN_ENV_FILE_COPY} failed!"
+        exit 1
+    fi
+    
+    # Update (or get) the local falcon master branch on which to base the work branch.
+    if ! update_falcon_master; then
+        echo "[ERROR_bzr] Failed updating local falcon master branch. Aborting script." >> $LOG
+        echo "[ERROR_bzr] Failed updating local falcon master branch. Aborting script."
+        exit 1
+    fi
+    
+    # First, check if we tested this version in the previous run and if we should skip this run.
+    echo "[INFO] Running check_bzr_revid.bash..." >> $LOG
+    # check_bzr_revid returns exit code 144 if we should skip.
+    bash ${AUTO_BASE}/check_bzr_revid.bash
+    EXIT_CODE=$?
+    if [ ${EXIT_CODE} -ne 0 ]; then
+        # either "skip" or "error"
+        echo "[INFO] Non-zero exit code (${EXIT_CODE}); skipping the rest of this script..." >> $LOG
+        exit ${EXIT_CODE}
+    fi
+    
+    # We are not skipping, so continue with bzr preparations...
+    
+    echo "[INFO] TOP_DIR_NEW=${TOP_DIR_NEW}" >> $LOG
+    echo "[INFO] TOP_DIR_NEW is not a path. Will check for existing local branch." >> $LOG
+    if [ -d "${FALCON_LOCAL_WORK_BZR}" ]; then
+        echo "[INFO] Local branch exists." >> $LOG
+        if ${FALCON_REFRESH}; then
+            echo "[INFO] Will do a clean refresh of old working dir ${FALCON_LOCAL_WORK_BZR}" >> $LOG
+            echo "[INFO] Deleting old working copy of Falcon src at ${FALCON_LOCAL_WORK_BZR}" >> $LOG
+            rm -rf ${FALCON_LOCAL_WORK_BZR} 2>>$LOG
+            DO_FALCON_BRANCHING=true
+        else
+            echo "[INFO] No Falcon refresh; keeping branch at ${FALCON_LOCAL_WORK_BZR}". >> $LOG
+            DO_FALCON_BRANCHING=false
+            # Remember: We need to set the correct path in the environment file anyway.
+        fi
+    else 
+        echo "[INFO] Local branch not found. Will try branching a new one..." >> $LOG
+        DO_FALCON_BRANCHING=true
+    fi
+
+    if $DO_FALCON_BRANCHING; then
+        branch_falcon
+        if [ $? -eq 0 ]; then
+            echo "[INFO] Bzr branching of NEW version successful." >> $LOG
+        else
+            echo "[ERROR] Bzr branching of NEW version failed! Exiting." >> $LOG
+            echo "[ERROR] Bzr branching of NEW version (${FALCON}) failed!"
+            exit 1
+        fi
+    fi
+fi
+
 # Suppressing output from bzr branch & pull commands since the log quickly fills
 # up with "Build phase 1/11438" etc. messages otherwise.
 # Not using grep since that will affect the exit code from bzr which is used
 # to indicate success or failure.
 
-# Delete old working copies.
-echo "[INFO] Deleting old working copies of falcon src and test-extra." >> $LOG
-rm -rf ${FALCON_LOCAL_WORK_BZR} 2>/dev/null
-rm -rf ${TEST_EXTRA_LOCAL_WORK_BZR} 2>/dev/null
-
-if [ ! -d ${FALCON_LOCAL_MASTER} ]; then
-    echo '[INFO] Initial Falcon branch did not exist.' >> $LOG
-    if [ ! -d ${LOCAL_BZR_ROOT_SERVER}/.bzr ]; then
-        echo "[INFO] Shared bzr repository not found in ${WORK}." >> $LOG
-        echo '[INFO] Creating shared bzr repository: bzr init-repo' >> $LOG
-        bzr init-repo ${WORK} >> $LOG 2>&1
-    fi
-    echo 'Branching now. This will take quite a while!' >> $LOG
-    echo "bzr branch ${FALCON_BZR_ROOT} ${FALCON_LOCAL_MASTER}" >> /dev/null 2>&1
-    bzr branch ${FALCON_BZR_ROOT} ${FALCON_LOCAL_MASTER} >> /dev/null 2>&1
-fi
-if [ $? != 0 ]; then
-    echo "[ERROR] Branching of ${FALCON_BZR_ROOT} failed" >> $LOG
-    exit 1
-fi
-
-# Update local master branch
-echo "[INFO] Updating (bzr pull) local master branch (falcon)..." >> $LOG
-cd ${FALCON_LOCAL_MASTER}
-bzr pull >> /dev/null 2>&1
-if [ $? != 0 ]; then
-    echo "[ERROR] Pull of ${FALCON_LOCAL_MASTER} failed" >> $LOG
-    exit 1
+if $TEST_EXTRA_REFRESH
+then
+    echo "[INFO] Deleting old working copy of test-extra at ${TEST_EXTRA_LOCAL_WORK_BZR}" >> $LOG
+    rm -rf ${TEST_EXTRA_LOCAL_WORK_BZR} 2>/dev/null
 fi
 
-# Get new working copy based on local master branch
-echo "[INFO] Branching working copy of ${FALCON} from local master branch (suppressing output)..." >> $LOG
-bzr branch ${FALCON_LOCAL_MASTER} ${FALCON_LOCAL_WORK_BZR} >> /dev/null 2>&1
-if [ $? != 0 ]; then
-    echo "[ERROR] Branching of ${FALCON_LOCAL_MASTER} into ${FALCON_LOCAL_WORK_BZR} failed." >> $LOG
-    exit 1
+# Branch the test-extra branch unless indicated otherwise.
+if [ ! -d "${TEST_EXTRA_LOCAL_WORK_BZR}" ] || ( [ -d "${TEST_EXTRA_LOCAL_WORK_BZR}" ] && ${TEST_EXTRA_REFRESH} ); then
+    echo "[INFO] Branching test-extra branch: ${TEST_EXTRA}..." >> $LOG
+    bzr branch ${TEST_EXTRA_BZR_ROOT} ${TEST_EXTRA_LOCAL_WORK_BZR} >> /dev/null 2>&1
+    if [ $? != 0 ]; then
+        echo "[ERROR] Branching of ${TEST_EXTRA_BZR_ROOT} into ${TEST_EXTRA_LOCAL_WORK_BZR} failed." >> $LOG
+        exit 1
+    fi
+else
+    echo "[INFO] Keeping test-extra branch ${TEST_EXTRA_LOCAL_WORK_BZR}" >> $LOG
 fi
 
-# Branch the test-extra branch
-echo "[INFO] Branching test-extra branch: ${TEST_EXTRA}..." >> $LOG
-bzr branch ${TEST_EXTRA_BZR_ROOT} ${TEST_EXTRA_LOCAL_WORK_BZR} >> /dev/null 2>&1
-if [ $? != 0 ]; then
-    echo "[ERROR] Branching of ${TEST_EXTRA_BZR_ROOT} into ${TEST_EXTRA_LOCAL_WORK_BZR} failed." >> $LOG
-    exit 1
-fi
+# Re-read environment file now that we may have changed paths.
+source ${UPDOWN_ENV_FILE_COPY} 2>>$LOG
 
 echo "" >> $LOG
-echo "Using the following local branches (directories) for this test run:" >> $LOG
-echo "  ${FALCON_LOCAL_WORK_BZR}" >> $LOG
-echo "  ${TEST_EXTRA_LOCAL_WORK_BZR}" >> $LOG
-echo "  ${AUTO_BASE}" >> $LOG
-echo "" >> $LOG
+echo ${TIMESTAMP} >> ${VERSION_FILE}
+echo "Using the following local branches (directories) for this test run:" >> ${VERSION_FILE}
+echo "  OLD:     ${TOP_DIR_OLD}" >> ${VERSION_FILE}
+echo "  NEW:     ${TOP_DIR_NEW}" >> ${VERSION_FILE}
+echo "  TEST:    ${TEST_EXTRA_LOCAL_WORK_BZR}" >> ${VERSION_FILE}
+echo "  SCRIPTS: ${AUTO_BASE}" >> ${VERSION_FILE}
+echo "" >> ${VERSION_FILE}
 
-# Apply patches. Report versions.
+# Apply patches. Report bzr versions.
 # Pathces are located in a special directory and include branch name in file name.
 # See apply_patches.inc and host_<hostname>.inc for details.
-cd ${FALCON_LOCAL_WORK_BZR}
-echo "[INFO] ===================================================================" >> $LOG
-echo "[INFO] bzr version-info from ${FALCON}:" >> $LOG
-bzr version-info >> $LOG 2>&1
-echo "[INFO] ===================================================================" >> $LOG
-source ${AUTO_BASE}/include/apply_patches.inc >> $LOG 2>&1
-if [ -f ${PATCH_ERROR_FILE} ]; then
-    echo "[ERROR_bzr] Patching failed! Patch error file ${FALCON_LOCAL_WORK_BZR}/${PATCH_ERROR_FILE} found!" >> $LOG 2>&1
-    exit 1
-fi
 
+# If only running against existing releases, we do not have a bzr branch.
+# So, check if there is such a branch
+if [ -d "${FALCON_LOCAL_WORK_BZR}" ]; then
+    cd ${FALCON_LOCAL_WORK_BZR}
+    echo "[INFO] ===================================================================" >> $VERSION_FILE
+    echo "[INFO] bzr version-info from ${FALCON}:" >> $VERSION_FILE
+    bzr version-info >> $VERSION_FILE 2>&1
+    echo "[INFO] ===================================================================" >> $VERSION_FILE
+    source ${AUTO_BASE}/include/apply_patches.inc >> $VERSION_FILE 2>&1
+    if [ -f ${PATCH_ERROR_FILE} ]; then
+        cat ${VERSION_FILE} >> $LOG 2>&1
+        echo "[ERROR_bzr] Patching failed! Patch error file ${FALCON_LOCAL_WORK_BZR}/${PATCH_ERROR_FILE} found!" >> $LOG 2>&1
+        exit 1
+    fi
+fi
 
 cd ${TEST_EXTRA_LOCAL_WORK_BZR}
-echo "[INFO] ===================================================================" >> $LOG
-echo "[INFO] bzr version-info from ${TEST_EXTRA}:" >> $LOG
-bzr version-info >> $LOG 2>&1
-echo "[INFO] ===================================================================" >> $LOG
-source ${AUTO_BASE}/include/apply_patches.inc >> $LOG 2>&1
+echo "[INFO] ===================================================================" >> $VERSION_FILE
+echo "[INFO] bzr version-info from ${TEST_EXTRA}:" >> $VERSION_FILE
+bzr version-info >> $VERSION_FILE 2>&1
+echo "[INFO] ===================================================================" >> $VERSION_FILE
+source ${AUTO_BASE}/include/apply_patches.inc >> $VERSION_FILE 2>&1
 if [ -f ${PATCH_ERROR_FILE} ]; then
+    cat ${VERSION_FILE} >> $LOG 2>&1
     echo "[ERROR_bzr] Patching failed! Patch error file ${TEST_EXTRA_LOCAL_WORK_BZR}/${PATCH_ERROR_FILE} found!" >> $LOG 2>&1
     exit 1
 fi
 
+# Include machine specific info in version file:
+echo "[INFO] Obtaining machine info..." >> $LOG
+INFO_SCRIPT="${AUTO_BASE}/../common/machine-info.bash"
+if [ -f "${INFO_SCRIPT}" ]; then
+    bash ${INFO_SCRIPT} >> $VERSION_FILE
+else 
+    echo "[INFO] Script for pulling machine-info not found: ${INFO_SCRIPT}" >> $LOG
+fi
+
+# Also include version info in this script's log file.
+cat ${VERSION_FILE} >> $LOG 2>&1
+
 cd ${AUTO_BASE}
 
 rm -f ${AUTO_BASE}/bzr_updown_date* >> $LOG 2>&1

=== added file 'upgrade-downgrade/check_bzr_revid.bash'
--- a/upgrade-downgrade/check_bzr_revid.bash	1970-01-01 00:00:00 +0000
+++ b/upgrade-downgrade/check_bzr_revid.bash	2009-05-05 12:32:00 +0000
@@ -0,0 +1,113 @@
+#! /bin/bash
+#
+# Checks the revision ID of the MASTER bzr repository if the NEW version being 
+# tested is a bazaar branch, and compares the revid to a previously recorded 
+# revid, if it exists.
+#
+# Need to perform any path modifications in the environment file copy before
+# running this script.
+#
+# Exits with exit code 144 if the revid matched and there were no errors.
+# Exits with exit code 0 if the revid did not match and there were no errors.
+# Exits with exit code 1 (or != 144 nor 0) if there were errors.
+#
+# John Embretsen, <john dot embretsen at sun dot com>, 2009-05-04.
+#
+
+
+#
+# Hostname. Needed for various paths, directories, includes.
+#
+HOSTNAME=$(hostname)
+
+#
+# Name of directory where this script is located.
+# (assuming it was called with full path)
+#
+DIRNAME="${0%/*}"
+
+cd ${DIRNAME}
+
+##
+## Includes.
+##
+## There should be one include file per host, specifying
+## platform/host specific variables (paths etc.).
+#
+HOST_INCLUDE_FILE="include/host_${HOSTNAME}.inc"
+if [ ! -f "${HOST_INCLUDE_FILE}" ]; then
+    echo "[ERROR_runme] Include file for host ${HOSTNAME} not found." 
+    echo "Was looking for: ${PWD}/${HOST_INCLUDE_FILE}"
+    echo "Exiting."
+    exit 1
+fi
+source ${HOST_INCLUDE_FILE}
+
+
+#
+# Read paths from the (potentially modified copy of the) environment file
+# We need:
+#  TOP_DIR_NEW (top-level dir of installation / src+build of NEW version to test.)
+#
+# for determining if it is a bazaar branch, and if so get the revid.
+#
+source ${UPDOWN_ENV_FILE_COPY}
+
+# Assumes that all called scripts are present in the directory pointed to by
+# the variable AUTO_BASE, set in this host's include script.
+
+#
+# Files
+#
+LOG="${LOG_DIR}/check_bzr_revid.log"    # If you change the file name make sure you keep RUNME.bash up to date.
+
+# Read revid from previous test run. 
+# It it does not exist, we cannot continue. This is no error, though.
+
+if [ -s "${REVID_FILE_LAST_RUN}" ]; then
+    # File exists and is non-empty
+    echo "[INFO] Found file with revid from previous test run: ${REVID_FILE_LAST_RUN}" >> $LOG
+    PREVIOUS_REVID=$(cat ${REVID_FILE_LAST_RUN}) 2>>$LOG
+else
+    # File with revid from previous run was not found or empty.
+    # Nothing more to do here, so exit
+    echo "[INFO] Looked for file '${REVID_FILE_LAST_RUN}'" >> $LOG
+    echo "[INFO] No file containing the revid from the previous test run found." >> $LOG
+    exit 0
+fi
+
+
+# Check if the current NEW version is a bazaar branch. 
+# If so, get the revid of the MASTER branch.
+if [ ! -d "${TOP_DIR_NEW}/.bzr" ]; then
+    echo "[INFO] TOP_DIR_NEW is not a bzr branch. Skipping version check." >> $LOG
+    echo "[INFO] TOP_DIR_NEW: ${TOP_DIR_NEW}" >> $LOG
+    exit 0
+else
+    echo "[INFO] TOP_DIR_NEW: ${TOP_DIR_NEW}" >> $LOG
+fi
+
+if [ ! -d ${FALCON_LOCAL_MASTER} ]; then
+    echo '[INFO] Local master Falcon branch does not exist. Cannot obtain revid.' >> $LOG
+    exit 0
+else
+    cd ${FALCON_LOCAL_MASTER}
+    BZR_REVID=$(bzr version-info 2>/dev/null | grep "revision-id" | $AWK -F': ' '{ print $2 }')
+    if [ -z "${BZR_REVID}" ]; then
+        echo "[INFO] bzr version-info returned no revision-id. Probably not a versioned bzr branch." >>$LOG
+        exit 0
+    fi
+    
+    # We should have the current revid now.
+    # Compare to the previous revid.
+    if [ "${PREVIOUS_REVID}" == "${BZR_REVID}" ]; then
+        echo "[INFO] Current revid: ${BZR_REVID}" >> $LOG
+        echo "[INFO] Current revid is equal to the previous revid." >> $LOG
+        exit 144
+    else
+        echo "[INFO] Current revid is NOT equal to the previous revid" >> $LOG
+        echo "[INFO] Previous revid: ${PREVIOUS_REVID}" >> $LOG
+        echo "[INFO] Current revid:  ${BZR_REVID}" >> $LOG
+    fi
+fi
+

=== modified file 'upgrade-downgrade/include/apply_patches.inc'
--- a/upgrade-downgrade/include/apply_patches.inc	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/include/apply_patches.inc	2009-04-28 12:20:36 +0000
@@ -25,24 +25,43 @@ fi
 #
 ###########################################
 
+
 apply_patches ()
 {
     for file in ${PATCHES}/*
         do
         if [ $(echo $file | grep $BASENAME) ]; then
             echo "[INFO] Found patch $file. Trying to apply..."
-            patch -tN --dry-run -p0 < $file
+            local CMD
+            
+            # Trying both patch levels -p1 and -p0, as patch root dir may vary.
+            CMD="patch -tN -p0"
+            echo "[INFO] Trying dry-run of patch command: ${CMD}"
+            ${CMD} --dry-run < $file
             if [ $? -ne 0 ]; then
-                echo "[ERROR_patch] Patch dry run of $file failed."
-                echo "[ERROR_patch] Patch dry run of $file failed." >> ${PATCH_ERROR_FILE}
-            else
-                patch -tN -p0 < $file
+                echo "[ERROR_patch] Patch dry run using -p0 failed"
+                CMD="patch -tN -p1"
+                echo "[INFO] Trying dry-run of patch command: ${CMD}"
+                ${CMD} --dry-run < $file
                 if [ $? -ne 0 ]; then
-                    echo "[ERROR_patch] Patch $file failed."
-                    echo "[ERROR_patch] Patch $file failed." >> ${PATCH_ERROR_FILE}
+                    echo "[ERROR_patch] Patch dry run using -p1 failed"
+                    echo "[ERROR_patch] Patch dry run of $file failed."
+                    echo "[ERROR_patch] Patch dry run of $file failed." >> ${PATCH_ERROR_FILE}
+                    return 1
                 else
-                    echo "[INFO] Patch $file succeeded."
+                    echo "[INFO] Patch dry run with patch level -p1 suceeded."
                 fi
+            else
+                echo "[INFO] Patch dry run with patch level -p0 suceeded."
+            fi
+            
+            # Dry run succeeded, do the patching for real this time.
+            ${CMD} < $file
+            if [ $? -ne 0 ]; then
+                echo "[ERROR_patch] Patch $file failed."
+                echo "[ERROR_patch] Patch $file failed." >> ${PATCH_ERROR_FILE}
+            else
+                echo "[INFO] Patch $file succeeded."
             fi
         else
             echo "[INFO] No patch found in ${PATCHES} matching ${BASENAME}"

=== modified file 'upgrade-downgrade/include/host_urd07.inc'
--- a/upgrade-downgrade/include/host_urd07.inc	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/include/host_urd07.inc	2009-05-05 12:32:00 +0000
@@ -34,6 +34,14 @@ FALCONQA_BASEDIR="/export/home/tmp/falco
 # Also the place where the results are stored.
 AUTO_BASE="${FALCONQA_BASEDIR}/bzr-repos/mysql-falcon/upgrade-downgrade"
 
+#
+# Log directory for this run
+#
+LOG_DIR="${AUTO_BASE}/logs-${TIMESTAMP}"
+if [ ! -d ${LOG_DIR} ]; then
+    mkdir ${LOG_DIR} 2>/dev/null
+fi
+
 # User name and URL for bzr on MySQL's server.
 # Note: Make sure automatic SSH key authentication is properly set up, so
 #       that no password is needed.
@@ -59,6 +67,16 @@ FALCON_LOCAL_WORK_BZR="${LOCAL_BZR_ROOT_
 TEST_EXTRA_BZR_ROOT="${BZR_ROOT}/${TEST_EXTRA}"
 TEST_EXTRA_LOCAL_WORK_BZR="${LOCAL_BZR_ROOT}/${TEST_EXTRA}"
 
+# Whether or not to refresh the test-extra or Falcon branch if it already exists
+# Use true or false.
+TEST_EXTRA_REFRESH=false
+FALCON_REFRESH=true
+
+# Whether or not to run the test (testsuite) if no updates have been pushed 
+# since the last branching / test run (revid recorded in REVID_LAST_RUN file).
+SKIP_TEST_IF_BRANCH_UNCHANGED=true
+REVID_FILE_LAST_RUN="${AUTO_BASE}/revid_new_last_run.txt"
+
 # Where to find patches to apply to the checked out code base before building.
 #PATCHES="$HOME/mysql/patches/auto/$(hostname)"
 PATCHES="${AUTO_BASE}/patches"
@@ -69,24 +87,26 @@ PATCHES="${AUTO_BASE}/patches"
 PATCH_ERROR_FILE=patch-error.txt
 
 #
+# File in which to store version information for a single test run.
+#
+VERSION_FILE="${LOG_DIR}/versions.txt"
+
+
+#
 # Environment file for the updown test framework (in test-extra).
 # Specifies the location of the MySQL binaries to test and a few other things.
+# We make a copy of the file and modify that if needed. This way run-time
+# modifications will not affect subsequent test runs.
+# Copy has same name but prefixed with "copy_of_".
 #
 UPDOWN_ENV_FILE="${AUTO_BASE}/trd_falcon_updown_linux-32bit.env"
+UPDOWN_ENV_FILE_COPY=${LOG_DIR}/copy_of_${UPDOWN_ENV_FILE##*/}
 
 #
 # Directory of updown test suite in test-extra working copy.
 #
 UPDOWN_DIR="${TEST_EXTRA_LOCAL_WORK_BZR}/mysql-test/qa-suite/updown"
 
-#
-# Log directory for this run
-#
-LOG_DIR="${AUTO_BASE}/logs-${TIMESTAMP}"
-if [ ! -d ${LOG_DIR} ]; then
-    mkdir ${LOG_DIR} 2>/dev/null
-fi
-
 
 ##################
 # Binaries
@@ -101,3 +121,6 @@ MAIL=/usr/sbin/sendmail
 
 # Path to Perl intallation with required modules installed.
 PERL=/usr/bin/perl
+
+# awk command to use which supports '{ print $2 }' syntax. Default awk on Solaris does not, gawk does.
+AWK=awk

=== modified file 'upgrade-downgrade/prepare_test.bash'
--- a/upgrade-downgrade/prepare_test.bash	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/prepare_test.bash	2009-04-29 12:07:27 +0000
@@ -16,8 +16,8 @@
 #
 #
 # HOW TO SPECIFY WHICH VERSIONS TO TEST?
-#  - edit the file referred to by the variable $UPDOWN_ENV_FILE (see host script)
-#    (e.g. "trd_falcon_updown.env") in this directory before running the test.
+#  - edit the file referred to by the variable $UPDOWN_ENV_FILE_COPY (see host script)
+#    (e.g. "copy_of_trd_falcon_updown.env") in this directory before running the test.
 #
 #
 # John Embretsen, <john dot embretsen at sun dot com>, 2009-04-23.
@@ -57,7 +57,7 @@ cd ${AUTO_BASE}
 #
 # Files and directories.
 #
-LOG=${LOG_DIR}/prepare_test.log
+LOG=${LOG_DIR}/prepare_test.log   # If you change the file name make sure you keep RUNME.bash up to date.
 
 #
 # Read paths from the environment file
@@ -65,7 +65,7 @@ LOG=${LOG_DIR}/prepare_test.log
 #  TOP_DIR_OLD (top-level dir of installation / src+build of OLD version to test.)
 #  TOP_DIR_NEW (top-level dir of installation / src+build of NEW version to test.)
 #
-source ${UPDOWN_ENV_FILE}
+source ${UPDOWN_ENV_FILE_COPY}
 
 echo "[INFO] TOP_DIR_OLD=${TOP_DIR_OLD}" >> $LOG
 echo "[INFO] TOP_DIR_NEW=${TOP_DIR_OLD}" >> $LOG
@@ -73,8 +73,8 @@ echo "[INFO] TOP_DIR_NEW=${TOP_DIR_OLD}"
 #
 # Copy test environment file to the test-extra working dir.
 #
-echo "[INFO] Copying ${UPDOWN_ENV_FILE} to ${UPDOWN_DIR}" >> $LOG
-cp ${UPDOWN_ENV_FILE} ${UPDOWN_DIR}/bin/ 2>$LOG
+echo "[INFO] Copying ${UPDOWN_ENV_FILE_COPY} to ${UPDOWN_DIR}" >> $LOG
+cp ${UPDOWN_ENV_FILE_COPY} ${UPDOWN_DIR}/bin/ 2>>$LOG
 
 #
 # Verify that MTR v1 + Falcon works in each version to be tested.

=== modified file 'upgrade-downgrade/run_test.bash'
--- a/upgrade-downgrade/run_test.bash	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/run_test.bash	2009-05-05 12:32:00 +0000
@@ -45,7 +45,7 @@ cd ${AUTO_BASE}
 #
 # for retreiving server error logs.
 #
-source ${UPDOWN_ENV_FILE}
+source ${UPDOWN_ENV_FILE_COPY}
 
 # Assumes that all called scripts are present in the directory pointed to by
 # the variable AUTO_BASE, set in this host's include script.
@@ -53,7 +53,53 @@ source ${UPDOWN_ENV_FILE}
 #
 # Files
 #
-LOG="${LOG_DIR}/run_test.log"
+LOG="${LOG_DIR}/run_test.log"    # If you change the file name make sure you keep RUNME.bash up to date.
+
+
+##################################################
+#
+# Functions.
+#
+##################################################
+
+### store_bzr_revid
+#
+# Check and store bzr revid of bzr repos if exists.
+# Used to potentially skip test if revid is the same as last time.
+# Parameters:
+#   1 - Potential bzr directory
+#
+store_bzr_revid ()
+{
+    OLD_PWD=$PWD
+    local BZR_DIR=$1
+    if [ -z "${BZR_DIR}" ]; then
+        echo "[ERROR] Argument 1 to function store_bzr_revid was empty! Should be a valid directory path." >> $LOG
+        return 1
+    fi
+    
+    if [ ! -d ${BZR_DIR} ]; then
+        echo "[ERROR] Argument 1 to function store_bzr_revid is not a directory! Should be a valid directory path." >> $LOG
+        echo "        $BZR_DIR" >> $LOG
+        return 1
+    fi
+    
+    cd ${BZR_DIR}
+    bzr version-info 2>/dev/null | grep "revision-id" | $AWK -F': ' '{ print $2 }' > ${REVID_FILE_LAST_RUN} 2>>$LOG
+    cd ${OLD_PWD}
+    
+    if [ ! -s ${REVID_FILE_LAST_RUN} ]; then
+        # File is either empty or non-existent. 
+        echo "[INFO] Argument 1 to function store_bzr_revid: $BZR_DIR" >> $LOG
+        echo "       is probably not a versioned bzr branch." >> $LOG
+    fi
+    
+}
+
+########## END OF FUNCTION DEFINITIONS ###############
+
+# Store the current revid of the NEW version if it is a bzr branch.
+store_bzr_revid ${TOP_DIR_NEW}
 
 #
 # Run the test and store the output
@@ -66,7 +112,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-ENV_FILE_BASENAME="${UPDOWN_ENV_FILE##*/}"
+ENV_FILE_BASENAME="${UPDOWN_ENV_FILE_COPY##*/}"
 RUN_CMD="./run_updown --config=${ENV_FILE_BASENAME} --scenario=60minor-falcon.tst --test-num=08"
 
 echo "[INFO] Running the following command:" >> $LOG
@@ -86,7 +132,6 @@ if [ $? -ne 0 ]; then
     else
         echo "[ERROR_run_test] Unable to find error log from NEW server." >> $LOG
     fi
-    
     echo "[FAIL] Run of updown test failed!"
     echo "See ${LOG} for details. Exiting."
     exit 1

=== modified file 'upgrade-downgrade/trd_falcon_updown_linux-32bit.env'
--- a/upgrade-downgrade/trd_falcon_updown_linux-32bit.env	2009-04-24 10:38:01 +0000
+++ b/upgrade-downgrade/trd_falcon_updown_linux-32bit.env	2009-04-28 13:31:54 +0000
@@ -14,9 +14,15 @@
 ###########################################################################
 SUITE="updown"
 
-TOP_DIR_OLD=/export/home/tmp/falconQA/mysql-releases/mysql-6.0.9-alpha-linux-i686-glibc23   # Top directory of old MySQL version
-TOP_DIR_NEW=/export/home/tmp/falconQA/mysql-releases/mysql-6.0.10-alpha-linux-i686-glibc23
-#TOP_DIR_NEW=/export/home/tmp/falconQA/bzr-repos/server/mysql-6.0-falcon-team  # Top directory of new MySQL version
+#
+# For Falcon QA test runs:
+# When specifying Old (TOP_DIR_OLD) and New (TOP_DIR_NEW) versions:
+# Specify either a valid path to a MySQL source or binary installation,
+# OR a value that does not look like a path name (e.g "useBazaar").
+#
+TOP_DIR_OLD=/export/home/tmp/falconQA/mysql-releases/mysql-6.0.10-alpha-linux-i686-glibc23
+#TOP_DIR_NEW=/export/home/tmp/falconQA/mysql-releases/mysql-6.0.10-alpha-linux-i686-glibc23
+TOP_DIR_NEW=useFreshBazaarBranch
 TOP_TEST_EXTRA=/home/je159969/mysql/bzr-repos/mysql-test-extra-6.0  # Top directory for mysql-test-extra
 
 WINDOWS=0                                   # Set to '1' if running on Windows


Attachment: [text/bzr-bundle] bzr/hky@sun.com-20090514125305-5odmstbuwjm8n0mw.bundle
Thread
bzr commit into mysql-falcon branch (hky:383)Hakan Kuecuekyilmaz14 May