2007-10-04 08:57:41 -07:00
|
|
|
#!/bin/bash -e
|
2007-06-12 08:46:42 -07:00
|
|
|
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
# License.
|
|
|
|
#
|
|
|
|
# The Original Code is mozilla.org code.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Mozilla Corporation.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2006.
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
|
|
|
# Bob Clary <bob@bclary.com>
|
|
|
|
#
|
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
#
|
|
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
|
2008-04-03 09:22:29 -07:00
|
|
|
source $TEST_DIR/bin/library.sh
|
2007-06-12 08:46:42 -07:00
|
|
|
|
|
|
|
#
|
|
|
|
# options processing
|
|
|
|
#
|
|
|
|
options="p:b:u:f:c:B:T:x:N:D:L:U:E:d:"
|
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
cat<<EOF
|
2009-08-18 00:30:00 -07:00
|
|
|
usage:
|
2007-06-12 08:46:42 -07:00
|
|
|
$SCRIPT -p product -b branch
|
2009-08-18 00:30:00 -07:00
|
|
|
[-u url [-f filepath] [-c credentials]]
|
|
|
|
[-B buildcommands -T buildtype]
|
2007-06-12 08:46:42 -07:00
|
|
|
[-x executablepath]
|
2009-08-18 00:30:00 -07:00
|
|
|
[-N profilename [-D profiledirectory [-L profiletemplate
|
2007-06-12 08:46:42 -07:00
|
|
|
[-U userpreferences]]]]
|
|
|
|
[-E extensiondir]
|
2009-08-18 00:30:00 -07:00
|
|
|
[-d datafiles]
|
2007-06-12 08:46:42 -07:00
|
|
|
|
|
|
|
variable description
|
|
|
|
=============== ===========================================================
|
2009-08-18 00:30:00 -07:00
|
|
|
-p product required. one of js firefox.
|
|
|
|
-b branch required. supported branch. see library.sh
|
2007-06-12 08:46:42 -07:00
|
|
|
-u url optional. url where to download build
|
|
|
|
-f filepath optional. location to save downloaded build or to find
|
|
|
|
previously downloaded build. If not specified, the
|
|
|
|
default will be the basename of the url saved to the
|
|
|
|
/tmp directory. If there is no basename, then the
|
|
|
|
filepath will be /tmp/\$product-\$branch-file.
|
|
|
|
-B buildcommands optional. one or more of clean checkout build
|
|
|
|
-T buildtype optional. one of opt debug
|
2009-08-18 00:30:00 -07:00
|
|
|
-x executablepath optional. directory tree containing executable with same
|
|
|
|
name as product. If the build is downloaded and executable
|
|
|
|
path is not specified, it will be defaulted to
|
|
|
|
/tmp/\$product-\$branch.
|
|
|
|
For cvs builds it will be defaulted to the appropriate
|
|
|
|
directory in
|
2008-04-03 09:22:29 -07:00
|
|
|
${BUILDDIR}/\$branch/mozilla/\$product-\$buildtype/
|
2009-08-18 00:30:00 -07:00
|
|
|
-N profilename optional. profilename. profilename is required if
|
2007-10-04 08:57:41 -07:00
|
|
|
profiledirectory or extensiondir are specified.
|
2009-08-18 00:30:00 -07:00
|
|
|
-D profiledirectory optional. If profiledirectory is specified, a new profile
|
2007-10-04 08:57:41 -07:00
|
|
|
will be created in the directory.
|
2009-08-18 00:30:00 -07:00
|
|
|
-L profiletemplate optional. If a new profile is created, profiletemplate is
|
|
|
|
the path to an existing profile which will be copied over
|
2007-10-04 08:57:41 -07:00
|
|
|
the new profile.
|
2009-08-18 00:30:00 -07:00
|
|
|
-U userpreferences optional. If a new profile is created, userpreferences is
|
|
|
|
the path to a user.js file to be copied into the new
|
2007-10-04 08:57:41 -07:00
|
|
|
profile.
|
2009-08-18 00:30:00 -07:00
|
|
|
If userpreferences is not specified when a new profile is
|
2007-10-04 08:57:41 -07:00
|
|
|
created, it is defaulted to
|
2008-04-03 09:22:29 -07:00
|
|
|
${TEST_DIR}/prefs/test-user.js
|
2009-08-18 00:30:00 -07:00
|
|
|
-E extensiondir optional. path to directory tree containing extensions to
|
2007-10-04 08:57:41 -07:00
|
|
|
be installed.
|
2009-08-18 00:30:00 -07:00
|
|
|
-d datafiles optional. one or more filenames of files containing
|
2007-10-04 08:57:41 -07:00
|
|
|
environment variable definitions to be included.
|
2007-09-28 08:31:05 -07:00
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
note that the environment variables should have the same
|
2007-10-04 08:57:41 -07:00
|
|
|
names as in the "variable" column.
|
2007-09-28 08:31:05 -07:00
|
|
|
|
2007-06-12 08:46:42 -07:00
|
|
|
EOF
|
2007-09-28 08:31:05 -07:00
|
|
|
exit 1
|
2007-06-12 08:46:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
unset product branch url filepath credentials buildcommands buildtype executablepath profilename profiledirectory profiletemplate userpreferences extenstiondir datafiles
|
|
|
|
|
2009-08-18 00:30:00 -07:00
|
|
|
while getopts $options optname ;
|
|
|
|
do
|
2007-06-12 08:46:42 -07:00
|
|
|
case $optname in
|
|
|
|
p) product="$OPTARG";;
|
|
|
|
b) branch="$OPTARG";;
|
|
|
|
|
|
|
|
u) url="$OPTARG";;
|
|
|
|
f) filepath="$OPTARG";;
|
|
|
|
c) credentials="$OPTARG";;
|
|
|
|
|
|
|
|
B) buildcommands="$OPTARG";;
|
|
|
|
T) buildtype="$OPTARG";;
|
|
|
|
|
|
|
|
x) executablepath="$OPTARG";;
|
|
|
|
|
|
|
|
N) profilename="$OPTARG";;
|
|
|
|
D) profiledirectory="$OPTARG";;
|
|
|
|
L) profiletemplate="$OPTARG";;
|
|
|
|
U) userpreferences="$OPTARG";;
|
|
|
|
|
|
|
|
E) extensiondir="$OPTARG";;
|
|
|
|
|
|
|
|
d) datafiles="$OPTARG";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# include environment variables
|
2008-06-25 14:51:22 -07:00
|
|
|
loaddata $datafiles
|
2007-06-12 08:46:42 -07:00
|
|
|
|
2007-07-05 09:36:55 -07:00
|
|
|
TEST_PRODUCT=$product
|
|
|
|
TEST_BRANCH=$branch
|
|
|
|
TEST_BUILDCOMMANDS=$buildcommands
|
|
|
|
TEST_BUILDTYPE=$buildtype
|
|
|
|
TEST_EXECUTABLEPATH=$executablepath
|
2009-01-14 07:16:17 -08:00
|
|
|
if [[ -n "$profilename" ]]; then
|
|
|
|
TEST_PROFILENAME=$profilename
|
|
|
|
fi
|
|
|
|
if [[ -n "$profiletemplate" ]];then
|
|
|
|
TEST_PROFILETEMPLATE=$profiletemplate
|
|
|
|
fi
|
|
|
|
if [[ -n "$userpreferences" ]]; then
|
|
|
|
TEST_USERPREFERENCES=$userpreferences
|
|
|
|
fi
|
|
|
|
if [[ -n "$extensiondir" ]]; then
|
|
|
|
TEST_EXTENSIONDIR=$extensiondir
|
|
|
|
fi
|
2007-07-05 09:36:55 -07:00
|
|
|
TEST_DATAFILES=$datafiles
|
|
|
|
|
|
|
|
dumpenvironment
|
2008-06-25 14:51:22 -07:00
|
|
|
dumphardware
|
2007-07-05 09:36:55 -07:00
|
|
|
|
2007-06-12 08:46:42 -07:00
|
|
|
if [[ -z "$product" || -z "$branch" ]]; then
|
|
|
|
echo "product and branch are required"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2009-01-14 07:16:17 -08:00
|
|
|
checkProductBranch $product $branch
|
|
|
|
|
2007-06-12 08:46:42 -07:00
|
|
|
if [[ ( -n "$url" || -n "$filepath" ) && ( -n "$buildcommands" ) ]]; then
|
|
|
|
echo "you can not both download and build cvs builds at the same time"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$buildcommands" && -n "$executablepath" ]]; then
|
|
|
|
echo "You can not specify the executable path and build cvs builds at the same time"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ (-n "$profiledirectory" || -n "$extensiondir" ) && -z "$profilename" ]]; then
|
|
|
|
echo "You must specify a profilename if you specify a profiledirectory or extensiondir"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if the url is specified but not the filepath
|
2009-08-18 00:30:00 -07:00
|
|
|
# generate a default path where to save the
|
2007-06-12 08:46:42 -07:00
|
|
|
# downloaded build.
|
|
|
|
if [[ -n "$url" && -z "$filepath" ]]; then
|
|
|
|
filepath=`basename $url`
|
|
|
|
if [[ -z "$filepath" ]]; then
|
|
|
|
filepath="$product-$branch-file"
|
|
|
|
fi
|
|
|
|
filepath="/tmp/$filepath"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$url" ]]; then
|
|
|
|
download.sh -u "$url" -c "$credentials" -f "$filepath" -t "$TEST_DOWNLOAD_TIMEOUT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install the build at the specified filepath
|
|
|
|
if [[ -n "$filepath" ]]; then
|
|
|
|
if [[ -z "$executablepath" ]]; then
|
|
|
|
executablepath="/tmp/$product-$branch"
|
|
|
|
fi
|
|
|
|
install-build.sh -p $product -b $branch -x $executablepath -f $filepath
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$buildcommands" ]]; then
|
|
|
|
|
|
|
|
if [[ -z "$buildtype" ]]; then
|
|
|
|
echo "You must specify a buildtype if you are building from cvs"
|
|
|
|
usage
|
|
|
|
elif [[ "$buildtype" != "opt" && "$buildtype" != "debug" ]]; then
|
|
|
|
echo "buildtype must be one of opt debug"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2007-07-05 09:36:55 -07:00
|
|
|
case "$OSID" in
|
2007-07-12 10:09:23 -07:00
|
|
|
mac)
|
2007-07-05 09:36:55 -07:00
|
|
|
if [[ "$product" == "firefox" ]]; then
|
|
|
|
App=Firefox
|
|
|
|
fi
|
|
|
|
if [[ "$buildtype" == "debug" ]]; then
|
|
|
|
AppType=Debug
|
|
|
|
fi
|
2008-04-03 09:22:29 -07:00
|
|
|
executablepath="${BUILDDIR}/$branch/mozilla/$product-$buildtype/dist/$App$AppType.app/Contents/MacOS"
|
2007-07-05 09:36:55 -07:00
|
|
|
;;
|
|
|
|
*)
|
2008-04-03 09:22:29 -07:00
|
|
|
executablepath="${BUILDDIR}/$branch/mozilla/$product/$buildtype/dist/bin"
|
2007-07-05 09:36:55 -07:00
|
|
|
esac
|
2007-06-12 08:46:42 -07:00
|
|
|
|
|
|
|
if echo "$buildcommands" | grep -iq clean; then
|
|
|
|
clean.sh -p $product -b $branch -t $buildtype
|
|
|
|
fi
|
|
|
|
|
|
|
|
if echo "$buildcommands" | grep -iq checkout; then
|
|
|
|
checkout.sh -p $product -b $branch -t $buildtype
|
|
|
|
fi
|
|
|
|
|
|
|
|
if echo "$buildcommands" | grep -iq build; then
|
|
|
|
build.sh -p $product -b $branch -t $buildtype
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$profiledirectory" ]]; then
|
|
|
|
|
|
|
|
if [[ -z "$userpreferences" ]]; then
|
2008-04-03 09:22:29 -07:00
|
|
|
userpreferences=${TEST_DIR}/prefs/test-user.js
|
2007-06-12 08:46:42 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
unset optargs
|
|
|
|
if [[ -n "$profiletemplate" ]]; then
|
|
|
|
optargs="$optargs -L $profiletemplate"
|
|
|
|
fi
|
|
|
|
if [[ -n "$userpreferences" ]]; then
|
|
|
|
optargs="$optargs -U $userpreferences"
|
|
|
|
fi
|
|
|
|
|
|
|
|
create-profile.sh -p $product -b $branch \
|
|
|
|
-x $executablepath -D $profiledirectory -N $profilename \
|
|
|
|
$optargs
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$extensiondir" ]]; then
|
|
|
|
|
2008-02-06 12:00:53 -08:00
|
|
|
install-extensions.sh -p $product -b $branch \
|
|
|
|
-x $executablepath -N $profilename -E $extensiondir
|
2007-06-12 08:46:42 -07:00
|
|
|
|
2008-02-06 12:00:53 -08:00
|
|
|
check-spider.sh -p $product -b $branch \
|
|
|
|
-x $executablepath -N $profilename
|
2007-06-12 08:46:42 -07:00
|
|
|
|
|
|
|
fi
|