3 if [[ -z "$TEST_DIR" ]]; then
7 TEST_DIR, the location of the Sisyphus framework,
8 is required to be set prior to calling this script.
13 source $TEST_DIR/bin
/library.sh
15 TEST_DOWNLOAD_PAGE_TIMEOUT
=${TEST_DOWNLOAD_PAGE_TIMEOUT:-60}
16 TEST_DOWNLOAD_BUILD_TIMEOUT
=${TEST_DOWNLOAD_BUILD_TIMEOUT:-900}
21 options
="u:t:p:b:x:c:N:d:"
26 $SCRIPT -u allurl -t test -p product -b branch -N profilename -x executablepath
27 -c credentials [-d datafiles]
30 =============== ============================================================
31 -u allurl required. location to find download "all" page.
32 -t test required. all for download page. ftp for ftp directory
33 -p product required. firefox|thunderbird
34 -b branch required. 1.8.0|1.8.1|1.9.0
35 -x executablepath required. directory-tree containing executable 'product'
36 -c credentials optional. user:password if required for authentication
37 -N profilename required. profile name
38 -d datafiles optional. one or more filenames of files containing
39 environment variable definitions to be included.
41 note that the environment variables should have the same
42 names as in the "variable" column.
49 profilename =$profilename
50 executablepath =$executablepath
51 credentials =$credentials
58 unset allurl
test product branch profilename executablepath credentials datafiles
60 while getopts $options optname
;
67 N
) profilename
=$OPTARG;;
68 x
) executablepath
=$OPTARG;;
69 c
) credentials
="-c $OPTARG";;
70 d
) datafiles
=$OPTARG;;
74 # include environment variables
75 if [[ -n "$datafiles" ]]; then
76 for datafile
in $datafiles; do
81 if [[ -z "$allurl" ||
-z "$test" || \
82 -z "$product" ||
-z "$branch" ||
-z "$profilename" || \
83 -z "$executablepath" ]]; then
87 executable
=`get_executable $product $branch $executablepath`
89 urlfile
=`mktemp /tmp/URLS.XXXX`
91 if [[ "$test" == "all" ]]; then
92 $TEST_DIR/bin
/timed_run.py
$TEST_DOWNLOAD_PAGE_TIMEOUT "test download" \
94 "$executable" -P "$profilename" -spider -start -quit \
95 -uri "$allurl" -timeout=$TEST_DOWNLOAD_PAGE_TIMEOUT \
96 -hook "http://$TEST_HTTP/tests/mozilla.org/download-page/collect-urls-userhook.js" | \
97 grep 'href: ' |
sed 's/^href: //' > $urlfile
98 elif [[ "$test" == "ftp" ]]; then
99 $TEST_DIR/bin
/timed_run.py
$TEST_DOWNLOAD_PAGE_TIMEOUT "test download" \
101 "$executable" -P "$profilename" -spider -start -quit \
102 -uri "$allurl" -timeout=$TEST_DOWNLOAD_PAGE_TIMEOUT \
103 -hook "http://$TEST_HTTP/tests/mozilla.org/download-page/userhook-ftp.js" | \
104 grep 'href: ' |
sed 's/^href: //' > $urlfile
107 cat $urlfile |
while read url
; do
109 echo "Processing $url"
111 if [[ "$test" == "all" ]]; then
112 downloadproduct
=`echo $url | sed 's|.*product=\([^\-]*\).*|\1|'`
113 downloadversion
=`echo $url | sed 's|.*product=[^\-]*-\([0-9.]*\).*|\1|'`
114 elif [[ "$test" == "ftp" ]]; then
115 downloadproduct
=`echo $url | sed 's|.*/\([a-zA-Z]*\)-[^/]*|\1|'`
116 downloadversion
=`echo $url | sed 's|\(.*\)/\([^/]*\)|\2|' | sed 's|[a-zA-Z]*-\([0-9.]*\)\..*|\1|'`
119 echo "downloadproduct=$downloadproduct"
120 echo "downloadversion=$downloadversion"
122 case "$downloadversion" in
124 downloadbranch
="1.8.0"
127 downloadbranch
="1.8.1"
130 downloadbranch
="1.9.0"
133 echo "unknown download branch: $downloadbranch"
138 filepath
=`mktemp /tmp/DOWNLOAD.XXXXXX`
140 downloadexecutablepath
="/tmp/download-$downloadproduct-$downloadbranch"
141 downloadprofilepath
="/tmp/download-$downloadproduct-$downloadbranch-profile"
142 downloadprofilename
="download-$downloadproduct-$downloadbranch-profile"
144 if ! download.sh
-u "$url" -f $filepath $credentials; then
148 if ! install-build.sh
-p "$downloadproduct" -b "$downloadbranch" \
149 -x $downloadexecutablepath \
156 if [[ "$downloadproduct" == "thunderbird" ]]; then
157 template
="-L $TEST_DIR/profiles/imap"
162 if ! create-profile.sh
-p "$downloadproduct" -b "$downloadbranch" \
163 -x $downloadexecutablepath \
164 -D $downloadprofilepath \
165 -N $downloadprofilename \
166 -U $TEST_DIR/prefs
/mail-user.js \
171 if ! install-extensions.sh
-p "$downloadproduct" -b "$downloadbranch" \
172 -x $downloadexecutablepath \
173 -N $downloadprofilename \
174 -E $TEST_DIR/xpi
; then
178 if ! check-spider.sh
-p "$downloadproduct" -b "$downloadbranch" \
179 -x $downloadexecutablepath \
180 -N $downloadprofilename; then
184 downloadexecutable
=`get_executable $downloadproduct $downloadbranch $downloadexecutablepath`
186 $TEST_DIR/bin
/timed_run.py
$TEST_DOWNLOAD_BUILD_TIMEOUT "..." \
188 "$downloadexecutable" \
189 -spider -P $downloadprofilename \
190 -uri "http://$TEST_HTTP/bin/buildinfo.html" \
191 -hook "http://$TEST_HTTP/tests/mozilla.org/download-page/userhook.js" \
194 if ! uninstall-build.sh
-p "$downloadproduct" -b "$downloadbranch" \
195 -x $downloadexecutablepath; then