Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / testing / sisyphus / bin / install-extensions.sh
blob3d016d7289c71b09517c63a36e77e1f864280827
1 #!/bin/bash -e
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
14 # License.
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.
23 # Contributor(s):
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}
45 # options processing
47 options="p:b:x:N:E:d:"
48 function usage()
50 cat <<EOF
51 usage:
52 $SCRIPT -p product -b branch -x executablepath -N profilename -E extensions
53 [-d datafiles]
55 variable description
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
60 'product'
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
67 "variable" column.
69 EOF
70 exit 1
73 unset product branch executablepath profilename extensions datafiles
75 while getopts $options optname ;
76 do
77 case $optname in
78 p) product=$OPTARG;;
79 b) branch=$OPTARG;;
80 x) executablepath=$OPTARG;;
81 N) profilename=$OPTARG;;
82 E) extensions=$OPTARG;;
83 d) datafiles=$OPTARG;;
84 esac
85 done
87 # include environment variables
88 loaddata $datafiles
90 if [[ -z "$product" || -z "$branch" || \
91 -z "$executablepath" || -z "$profilename" || -z "$extensions" ]]; then
92 usage
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" ]];
100 then
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
112 break
114 if [[ "$OSID" == "nt" ]]; then
115 extensionos=`cygpath -a -w $extension`
116 else
117 extensionos="$extension"
120 echo installing $extension
121 let tries=1
122 while ! $TEST_DIR/bin/timed_run.py ${TEST_STARTUP_TIMEOUT} "Install extension $extension: try $tries" \
123 $EXECUTABLE_DRIVER \
124 $executable -P $profilename -install-global-extension "$extensionos"; do
125 let tries=tries+1
126 if [[ "$tries" -gt $TEST_STARTUP_TRIES ]]; then
127 error "Failed to install extension $extension. Exiting..." $LINENO
129 sleep 30
130 done
131 # there is no reliable method of determining if the install worked
132 # from the output or from the exit code.
133 done
135 for extension in $extensions/$OSID/*; do
136 if [[ $extension == "$extensions/$OSID/*" ]]; then
137 break
139 if [[ "$OSID" == "nt" ]]; then
140 extensionos=`cygpath -a -w $extension`
141 else
142 extensionos="$extension"
145 echo installing $extension
146 let tries=1
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
149 let tries=tries+1
150 if [[ "$tries" -gt $TEST_STARTUP_TRIES ]]; then
151 error "Failed to install extension $extension. Exiting..." $LINENO
153 sleep 30
154 done
155 done
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