#At bzr+ssh://bk-internal.mysql.com/bzrroot/mysql-falcon/ based on revid:john.embretsen@stripped
385 John H. Embretsen 2009-04-29
Upgrade/downgrade test for Falcon, automation part: Fixes to env file edits and Email sending.
- Now always making a working copy of the original environment (.env) file.
- Will never edit/customize the original env file, just the copy. Avoids issues with repeated runs.
- Using perl instead of sed for text modifications, because sed on solaris does not support -i (in-place replace).
- Sending BCC copies of E-mails to ADMIN.
modified:
upgrade-downgrade/RUNME.bash
upgrade-downgrade/build.bash
upgrade-downgrade/bzr_checkout.bash
upgrade-downgrade/include/host_urd07.inc
upgrade-downgrade/prepare_test.bash
upgrade-downgrade/run_test.bash
=== modified file 'upgrade-downgrade/RUNME.bash'
=== modified file 'upgrade-downgrade/RUNME.bash'
--- a/upgrade-downgrade/RUNME.bash 2009-04-28 13:31:54 +0000
+++ b/upgrade-downgrade/RUNME.bash 2009-04-29 12:07:27 +0000
@@ -42,6 +42,7 @@
########### MAIL ######################
# Compose the mail
echo "To: ${TO_ADDRESS}" > ${MAILFILE}
+ echo "Bcc: ${ADMIN}" >> ${MAILFILE}
echo "From: ${ADMIN}" >> ${MAILFILE}
echo "Content-type: text/plain" >> ${MAILFILE}
echo "Subject: [AUTO_updown] ${MSG}" >> ${MAILFILE}
@@ -119,6 +120,19 @@
echo "AUTO_BASE: ${AUTO_BASE}" >> ${RUNME_LOG}
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}
+
#######################################################################
#
=== modified file 'upgrade-downgrade/build.bash'
--- a/upgrade-downgrade/build.bash 2009-04-28 12:39:53 +0000
+++ b/upgrade-downgrade/build.bash 2009-04-29 12:07:27 +0000
@@ -147,7 +147,7 @@
# 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}
#
# Look for mysqld binary in TOP_DIR_OLD and TOP_DIR_NEW.
=== modified file 'upgrade-downgrade/bzr_checkout.bash'
--- a/upgrade-downgrade/bzr_checkout.bash 2009-04-28 12:39:53 +0000
+++ b/upgrade-downgrade/bzr_checkout.bash 2009-04-29 12:07:27 +0000
@@ -21,7 +21,9 @@
# "include/host_<hostname>.inc" first. Copy from another host_<hostname>.inc
# file and adjust the variables as necessary.
#
-# Requires sed, cat, bzr.
+# 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$
@@ -122,7 +124,7 @@
# 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}
#
# Examine values of TOP_DIR_OLD and TOP_DIR_NEW, whether they are full paths
@@ -176,16 +178,14 @@
DO_FALCON_BRANCHING=true
fi
- # Make backup of environment file (needed for in-place sed).
- BACKUP_ENV=${AUTO_BASE}/updown_backup.env
- cp ${UPDOWN_ENV_FILE} ${BACKUP_ENV} 2>>$LOG
- # Replace TOP_DIR_OLD's value:
- echo "[INFO] TOP_DIR_OLD: Trying to replace $TOP_DIR_OLD with $FALCON_LOCAL_WORK_BZR" >> $LOG
- # Using % as separator in sed since path will include slashes.
- cat ${BACKUP_ENV} | sed -e "s%^TOP_DIR_OLD.*%TOP_DIR_OLD=${FALCON_LOCAL_WORK_BZR}%" > ${UPDOWN_ENV_FILE} 2>>$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} failed!" >> $LOG
- echo "[ERROR_bzr] Replacing TOP_DIR_OLD in ${UPDOWN_ENV_FILE} failed!"
+ 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
@@ -236,17 +236,14 @@
DO_FALCON_BRANCHING=true
fi
- # Replace value of TOP_DIR_NEW with actual path to use.
- # Make backup of environment file (needed for in-place sed) first.
- BACKUP_ENV=${AUTO_BASE}/updown_backup.env
- cp ${UPDOWN_ENV_FILE} ${BACKUP_ENV} 2>>$LOG
- # Replace TOP_DIR_NEW's value:
+ # 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 sed since path will include slashes.
- cat ${BACKUP_ENV} | sed -e "s%^TOP_DIR_NEW.*%TOP_DIR_NEW=${FALCON_LOCAL_WORK_BZR}%" > ${UPDOWN_ENV_FILE} 2>>$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} failed!" >> $LOG
- echo "[ERROR_bzr] Replacing TOP_DIR_NEW in ${UPDOWN_ENV_FILE} failed!"
+ 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
@@ -286,7 +283,7 @@
fi
# Re-read environment file now that we may have changed paths.
-source ${UPDOWN_ENV_FILE} 2>>$LOG
+source ${UPDOWN_ENV_FILE_COPY} 2>>$LOG
echo "" >> $LOG
echo ${TIMESTAMP} >> ${VERSION_FILE}
=== modified file 'upgrade-downgrade/include/host_urd07.inc'
--- a/upgrade-downgrade/include/host_urd07.inc 2009-04-28 12:20:36 +0000
+++ b/upgrade-downgrade/include/host_urd07.inc 2009-04-29 12:07:27 +0000
@@ -89,8 +89,12 @@
#
# 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.
=== modified file 'upgrade-downgrade/prepare_test.bash'
--- a/upgrade-downgrade/prepare_test.bash 2009-04-28 12:20:36 +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.
@@ -65,7 +65,7 @@
# 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 @@
#
# 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-28 12:20:36 +0000
+++ b/upgrade-downgrade/run_test.bash 2009-04-29 12:07:27 +0000
@@ -45,7 +45,7 @@
#
# 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.
@@ -66,7 +66,7 @@
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
Attachment: [text/bzr-bundle] bzr/john.embretsen@sun.com-20090429120727-athe18fiy1135wgm.bundle
| Thread |
|---|
| • bzr commit into mysql-falcon branch (john.embretsen:385) | John H. Embretsen | 29 Apr |