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) 2005.
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
42 TEST_STARTUP_TRIES
=${TEST_STARTUP_TRIES:-3}
47 options
="p:b:x:N:E:d:"
52 $SCRIPT -p product -b branch -x executablepath -N profilename -E extensions
56 =============== ============================================================
57 -p product required. firefox, thunderbird or fennec
58 -b branch required. 1.8.0|1.8.1|1.9.0|1.9.1
59 -x executablepath required. directory-tree containing executable named
61 -N profilename required. profile name
62 -E extensions required. path to directory containing xpis to be installed
63 -d datafiles optional. one or more filenames of files containing
64 environment variable definitions to be included.
66 note that the environment variables should have the same names as in the
73 unset product branch executablepath profilename extensions datafiles
75 while getopts $options optname
;
80 x
) executablepath
=$OPTARG;;
81 N
) profilename
=$OPTARG;;
82 E
) extensions
=$OPTARG;;
83 d
) datafiles
=$OPTARG;;
87 # include environment variables
90 if [[ -z "$product" ||
-z "$branch" || \
91 -z "$executablepath" ||
-z "$profilename" ||
-z "$extensions" ]]; then
95 if [[ "$product" != "firefox" && "$product" != "thunderbird" && "$product" != "fennec" ]]; then
96 error
"product \"$product\" must be one of firefox, thunderbird or fennec" $LINENO
99 if [[ "$branch" != "1.8.0" && "$branch" != "1.8.1" && "$branch" != "1.9.0" && "$branch" != "1.9.1" ]];
101 error
"branch \"$branch\" must be one of 1.8.0, 1.8.1, 1.9.0 1.9.1" $LINENO
104 executable
=`get_executable $product $branch $executablepath`
106 if echo $profilename |
egrep -qiv '[a-z0-9_]'; then
107 error
"profile name must consist of letters, digits or _" $LINENO
110 for extension
in $extensions/all
/*.xpi
; do
111 if [[ $extension == "$extensions/all/*.xpi" ]]; then
114 if [[ "$OSID" == "nt" ]]; then
115 extensionos
=`cygpath -a -w $extension`
117 extensionos
="$extension"
120 echo installing
$extension
122 while ! $TEST_DIR/bin
/timed_run.py
${TEST_STARTUP_TIMEOUT} "Install extension $extension: try $tries" \
124 $executable -P $profilename -install-global-extension "$extensionos"; do
126 if [[ "$tries" -gt $TEST_STARTUP_TRIES ]]; then
127 error
"Failed to install extension $extension. Exiting..." $LINENO
131 # there is no reliable method of determining if the install worked
132 # from the output or from the exit code.
135 for extension
in $extensions/$OSID/*; do
136 if [[ $extension == "$extensions/$OSID/*" ]]; then
139 if [[ "$OSID" == "nt" ]]; then
140 extensionos
=`cygpath -a -w $extension`
142 extensionos
="$extension"
145 echo installing
$extension
147 while ! $TEST_DIR/bin
/timed_run.py
${TEST_STARTUP_TIMEOUT} "Install extension $extension: try $tries" \
148 $executable -P $profilename -install-global-extension "$extensionos"; do
150 if [[ "$tries" -gt $TEST_STARTUP_TRIES ]]; then
151 error
"Failed to install extension $extension. Exiting..." $LINENO
157 # restart twice to make extension manager happy
159 if ! $TEST_DIR/bin
/timed_run.py
${TEST_STARTUP_TIMEOUT} "install extensions - first restart" \
160 $executable -P $profilename "http://${TEST_HTTP}/bin/install-extensions-1.html"; then
161 echo "Ignoring 1st failure to load the install-extensions page"
164 if ! $TEST_DIR/bin
/timed_run.py
${TEST_STARTUP_TIMEOUT} "install extensions - second restart" \
165 $executable -P $profilename "http://${TEST_HTTP}/bin/install-extensions-2.html"; then
166 error
"Fatal 2nd failure to load the install-extensions page" $LINENO