2 # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Mozilla Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 2006.
21 # the Initial Developer. All Rights Reserved.
24 # Bob Clary <bob@bclary.com>
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 source $TEST_DIR/bin
/library.sh
45 options
="p:b:u:f:c:B:T:x:N:D:L:U:E:d:"
50 $SCRIPT -p product -b branch
51 [-u url [-f filepath] [-c credentials]]
52 [-B buildcommands -T buildtype]
54 [-N profilename [-D profiledirectory [-L profiletemplate
55 [-U userpreferences]]]]
60 =============== ===========================================================
61 -p product required. one of firefox, thunderbird or fennec
62 -b branch required. one of 1.8.0 1.8.1 1.9.0 1.9.1
63 -u url optional. url where to download build
64 -f filepath optional. location to save downloaded build or to find
65 previously downloaded build. If not specified, the
66 default will be the basename of the url saved to the
67 /tmp directory. If there is no basename, then the
68 filepath will be /tmp/\$product-\$branch-file.
69 -B buildcommands optional. one or more of clean checkout build
70 -T buildtype optional. one of opt debug
71 -x executablepath optional. directory tree containing executable with same
72 name as product. If the build is downloaded and executable
73 path is not specified, it will be defaulted to
74 /tmp/\$product-\$branch.
75 For cvs builds it will be defaulted to the appropriate
77 ${BUILDDIR}/\$branch/mozilla/\$product-\$buildtype/
78 -N profilename optional. profilename. profilename is required if
79 profiledirectory or extensiondir are specified.
80 -D profiledirectory optional. If profiledirectory is specified, a new profile
81 will be created in the directory.
82 -L profiletemplate optional. If a new profile is created, profiletemplate is
83 the path to an existing profile which will be copied over
85 -U userpreferences optional. If a new profile is created, userpreferences is
86 the path to a user.js file to be copied into the new
88 If userpreferences is not specified when a new profile is
89 created, it is defaulted to
90 ${TEST_DIR}/prefs/test-user.js
91 -E extensiondir optional. path to directory tree containing extensions to
93 -d datafiles optional. one or more filenames of files containing
94 environment variable definitions to be included.
96 note that the environment variables should have the same
97 names as in the "variable" column.
103 unset product branch url filepath credentials buildcommands buildtype executablepath profilename profiledirectory profiletemplate userpreferences extenstiondir datafiles
105 while getopts $options optname
;
108 p
) product
="$OPTARG";;
109 b
) branch
="$OPTARG";;
112 f
) filepath
="$OPTARG";;
113 c
) credentials
="$OPTARG";;
115 B
) buildcommands
="$OPTARG";;
116 T
) buildtype
="$OPTARG";;
118 x
) executablepath
="$OPTARG";;
120 N
) profilename
="$OPTARG";;
121 D
) profiledirectory
="$OPTARG";;
122 L
) profiletemplate
="$OPTARG";;
123 U
) userpreferences
="$OPTARG";;
125 E
) extensiondir
="$OPTARG";;
127 d
) datafiles
="$OPTARG";;
131 # include environment variables
134 TEST_PRODUCT
=$product
136 TEST_BUILDCOMMANDS
=$buildcommands
137 TEST_BUILDTYPE
=$buildtype
138 TEST_EXECUTABLEPATH
=$executablepath
139 TEST_PROFILENAME
=$profilename
140 TEST_PROFILETEMPLATE
=$profiletemplate
141 TEST_USERPREFERENCES
=$userpreferences
142 TEST_EXTENSIONDIR
=$extensiondir
143 TEST_DATAFILES
=$datafiles
148 if [[ -z "$product" ||
-z "$branch" ]]; then
149 echo "product and branch are required"
153 if [[ ( -n "$url" ||
-n "$filepath" ) && ( -n "$buildcommands" ) ]]; then
154 echo "you can not both download and build cvs builds at the same time"
158 if [[ -n "$buildcommands" && -n "$executablepath" ]]; then
159 echo "You can not specify the executable path and build cvs builds at the same time"
163 if [[ (-n "$profiledirectory" ||
-n "$extensiondir" ) && -z "$profilename" ]]; then
164 echo "You must specify a profilename if you specify a profiledirectory or extensiondir"
168 # if the url is specified but not the filepath
169 # generate a default path where to save the
171 if [[ -n "$url" && -z "$filepath" ]]; then
172 filepath
=`basename $url`
173 if [[ -z "$filepath" ]]; then
174 filepath
="$product-$branch-file"
176 filepath
="/tmp/$filepath"
179 if [[ -n "$url" ]]; then
180 download.sh
-u "$url" -c "$credentials" -f "$filepath" -t "$TEST_DOWNLOAD_TIMEOUT"
183 # install the build at the specified filepath
184 if [[ -n "$filepath" ]]; then
185 if [[ -z "$executablepath" ]]; then
186 executablepath
="/tmp/$product-$branch"
188 install-build.sh
-p $product -b $branch -x $executablepath -f $filepath
191 if [[ -n "$buildcommands" ]]; then
193 if [[ -z "$buildtype" ]]; then
194 echo "You must specify a buildtype if you are building from cvs"
196 elif [[ "$buildtype" != "opt" && "$buildtype" != "debug" ]]; then
197 echo "buildtype must be one of opt debug"
203 if [[ "$product" == "firefox" ]]; then
205 elif [[ "$product" == "thunderbird" ]]; then
207 elif [[ "$product" == "fennec" ]]; then
210 if [[ "$buildtype" == "debug" ]]; then
213 executablepath
="${BUILDDIR}/$branch/mozilla/$product-$buildtype/dist/$App$AppType.app/Contents/MacOS"
216 executablepath
="${BUILDDIR}/$branch/mozilla/$product/$buildtype/dist/bin"
219 if echo "$buildcommands" |
grep -iq clean
; then
220 clean.sh
-p $product -b $branch -t $buildtype
223 if echo "$buildcommands" |
grep -iq checkout
; then
224 checkout.sh
-p $product -b $branch -t $buildtype
227 if echo "$buildcommands" |
grep -iq build
; then
228 build.sh
-p $product -b $branch -t $buildtype
233 if [[ -n "$profiledirectory" ]]; then
235 if [[ -z "$userpreferences" ]]; then
236 userpreferences
=${TEST_DIR}/prefs
/test-user.js
240 if [[ -n "$profiletemplate" ]]; then
241 optargs
="$optargs -L $profiletemplate"
243 if [[ -n "$userpreferences" ]]; then
244 optargs
="$optargs -U $userpreferences"
247 create-profile.sh
-p $product -b $branch \
248 -x $executablepath -D $profiledirectory -N $profilename \
252 if [[ -n "$extensiondir" ]]; then
254 install-extensions.sh
-p $product -b $branch \
255 -x $executablepath -N $profilename -E $extensiondir
257 check-spider.sh
-p $product -b $branch \
258 -x $executablepath -N $profilename