2008-01-07 16:54:00 -08:00
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
# License.
|
|
|
|
#
|
|
|
|
# The Original Code is Mozilla Corporation Code.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Clint Talbert.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2007
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
|
|
|
# Clint Talbert <ctalbert@mozilla.com>
|
|
|
|
#
|
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
#
|
|
|
|
# ***** END LICENSE BLOCK *****
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-01-07 16:54:00 -08:00
|
|
|
#!/bin/bash
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
# Uncomment following line for debug output
|
|
|
|
# set -x
|
|
|
|
|
2008-01-07 16:54:00 -08:00
|
|
|
options="n:f:m:l:o:b:c:v:"
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
cat<<EOF
|
|
|
|
usage:
|
2008-01-07 16:54:00 -08:00
|
|
|
$script -n buildName -f FirefoxDir -m MinotaurDir -l locale -o outputXML -b bookmarks -c release-channel -v FirefoxVersion
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
variable description
|
|
|
|
============= ================================================
|
|
|
|
-n buildName required, a name for Firefox build under test
|
|
|
|
-m MinotaurDir required, the path to the directory where Minotaur is
|
|
|
|
-f firefoxDir required, path to Firefox installed build
|
|
|
|
-l locale required, locale identifier of this build
|
|
|
|
-o outputXML optional, the output XML to compare against
|
|
|
|
-b bookmarks optional, bookmarks.html to compare against
|
|
|
|
-c release-channel optional, release-channel verification file
|
2008-01-07 16:54:00 -08:00
|
|
|
-v firefox Version required, the firefox version number under test
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
Notes
|
|
|
|
==========
|
|
|
|
* If you do not include the verification files, the test will run and export
|
|
|
|
information for you to use on future runs of this build and locale.
|
|
|
|
* minotaurdir/tests.manifest must also point to the containing directory
|
|
|
|
of the minotaur tests, with a trailing slash
|
2008-01-07 16:54:00 -08:00
|
|
|
* Output will be in ./<buildname>/<version>/<locale>/ relevant to the directory
|
|
|
|
where Minotaur was run from.
|
|
|
|
* Note that the test REQUIRES that you have write access to ~/ on your machine,
|
|
|
|
yes, that goes for Windows machines too. Your shell should resolve ~/ somewhere
|
|
|
|
on your box.
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
|
|
|
|
while getopts $options optname ;
|
|
|
|
do
|
|
|
|
case $optname in
|
|
|
|
n) fxname=$OPTARG;;
|
|
|
|
m) minotaurdir=$OPTARG;;
|
|
|
|
f) fxdir=$OPTARG;;
|
|
|
|
l) locale=$OPTARG;;
|
|
|
|
o) outputVerify=$OPTARG;;
|
|
|
|
b) bookmarksVerify=$OPTARG;;
|
|
|
|
c) releaseVerify=$OPTARG;;
|
2008-01-07 16:54:00 -08:00
|
|
|
v) fxver=$OPTARG;;
|
2007-09-13 20:28:15 -07:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# If anything is not defined, display the usage string above
|
2008-01-07 16:54:00 -08:00
|
|
|
if [[ -z "$fxname" || -z "$fxdir" || -z "$locale" || -z "$minotaurdir" || -z "$fxver" ]]
|
2007-09-13 20:28:15 -07:00
|
|
|
then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2008-03-04 15:16:55 -08:00
|
|
|
# Get our OS and Executable and profile directory names
|
2007-09-13 20:28:15 -07:00
|
|
|
OS=$(python getOsInfo.py)
|
|
|
|
FFX_EXE=$(python getOsInfo.py -o $OS -f)
|
2008-03-04 15:16:55 -08:00
|
|
|
profileName=minotaur-"`uuidgen`"
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-03-04 15:16:55 -08:00
|
|
|
cp ${minotaurdir}/tests.manifest $fxdir/chrome/tests.manifest
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-03-04 15:16:55 -08:00
|
|
|
profileDir=`$fxdir/$FFX_EXE -CreateProfile $profileName 2>&1 | sed -e "s/.*at '\(.*\)[\/|\\]prefs\.js.*/\1/"`
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-03-04 15:16:55 -08:00
|
|
|
# Seed that profile with our preferences
|
|
|
|
cp ${minotaurdir}/user.js "$profileDir"/user.js
|
|
|
|
|
|
|
|
$fxdir/$FFX_EXE -no-remote -P $profileName -chrome chrome://minotaur/content/quit.xul
|
2007-09-13 20:28:15 -07:00
|
|
|
sleep 10
|
|
|
|
|
2008-01-07 16:54:00 -08:00
|
|
|
# create verification repository
|
|
|
|
mkdir ${minotaurdir}/$fxname
|
|
|
|
mkdir ${minotaurdir}/$fxname/$fxver
|
|
|
|
mkdir ${minotaurdir}/$fxname/$fxver/$locale
|
|
|
|
resultsdir=${minotaurdir}/$fxname/$fxver/$locale
|
|
|
|
|
|
|
|
# Turn on http debugging - we now put the log file directly into the resultsdir
|
2007-09-13 20:28:15 -07:00
|
|
|
export NSPR_LOG_MODULES=nsHttp:5,nsSocketTransport:5,nsHostResolver:5
|
2008-01-07 16:54:00 -08:00
|
|
|
export NSPR_LOG_FILE=${resultsdir}/http.log
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-01-07 16:54:00 -08:00
|
|
|
# Remove any existing log file
|
|
|
|
if [ -f $resultsdir/http.log ]; then
|
|
|
|
rm $resultsdir/http.log
|
|
|
|
fi
|
|
|
|
|
|
|
|
#run the extraction
|
2008-03-04 15:16:55 -08:00
|
|
|
$fxdir/$FFX_EXE -P $profileName -chrome chrome://minotaur/content
|
2007-09-13 20:28:15 -07:00
|
|
|
|
2008-01-07 16:54:00 -08:00
|
|
|
cp ./test-output.xml $resultsdir/test-output.xml
|
|
|
|
cp ./test-bookmarks.html $resultsdir/test-bookmarks.html
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
# If verification files not given, then skip verification
|
|
|
|
if [[ -z "$outputVerify" || -z "$bookmarksVerify" || -z "$releaseVerify" ]]; then
|
|
|
|
echo ----------- Verification Files Generated --------------
|
|
|
|
else
|
|
|
|
# Do Verification
|
|
|
|
#Prepare the log file
|
2008-01-07 16:54:00 -08:00
|
|
|
rm $fxname/$fxver/$locale/results.log
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
#Perform the output.xml diff
|
2008-03-04 15:16:55 -08:00
|
|
|
diff -u $outputVerify $resultsdir/test-output.xml >> $resultsdir/results.log
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
# Check the Bookmarks file
|
2008-03-04 15:16:55 -08:00
|
|
|
python diffBookmarks.py -l $bookmarksVerify -r $resultsdir/test-bookmarks.html -f $resultsdir/results.log
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
# Check the Http Debug Log to catch the release channel
|
2008-01-07 16:54:00 -08:00
|
|
|
python checkReleaseChannel.py -d $resultsdir/http.log -r $releaseVerify -l $resultsdir/results.log
|
2007-09-13 20:28:15 -07:00
|
|
|
|
|
|
|
# Check to see if we fail or pass
|
2008-01-07 16:54:00 -08:00
|
|
|
if [ -s $resultsdir/results.log ]; then
|
2007-09-13 20:28:15 -07:00
|
|
|
echo !!!!!!!!!!!!! TEST FAILS !!!!!!!!!!!!!!
|
2008-01-07 16:54:00 -08:00
|
|
|
echo Results.log:
|
|
|
|
cat $resultsdir/results.log
|
2007-09-13 20:28:15 -07:00
|
|
|
else
|
|
|
|
echo ------------- TEST PASSES -------------
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#CLEANUP
|
2008-01-07 16:54:00 -08:00
|
|
|
rm ./test-output.xml
|
|
|
|
rm ./test-bookmarks.html
|
|
|
|
rm $fxdir/chrome/tests.manifest
|
|
|
|
if [ -f ${minotaurdir}/EULA.txt ]; then
|
|
|
|
rm ${minotaurdir}/EULA.txt
|
|
|
|
fi
|
2008-03-04 15:16:55 -08:00
|
|
|
|
|
|
|
# Delete the profile directory
|
|
|
|
python mozInstall.py -o d -d "$profileDir"
|