Automated checkin: version bump remove "pre" from version number for firefox 4.0b4...
[mozilla-central.git] / testing / sisyphus / bin / tester.sh
blob4f5448bdce1bb4ecfec855f1a84af0fc2c9cc60a
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) 2006.
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_LOG=/dev/null
45 # options processing
47 options="p:b:e:T:t:v"
48 function usage()
50 cat<<EOF
51 usage:
52 $SCRIPT -t testscript [-v ] datalist1 [datalist2 [datalist3 [datalist4]]]
54 variable description
55 =============== ===========================================================
56 -t testscript required. quoted test script with required arguments.
57 -v optional. verbose - copies log file output to stdout.
59 executes the testscript using the input data files in
60 $TEST_DIR/data constructed from each combination of the input parameters:
62 {item1},{item2},{item3},{item4}
64 EOF
65 exit 1
68 unset testscript testargs
70 # remove script name from args
71 shiftargs=1
73 while getopts $options optname ;
74 do
75 case $optname in
76 t)
77 let shiftargs=$shiftargs+1
78 testscript="$OPTARG"
79 if echo $testscript | grep -iq ' ' ; then
80 testargs=`echo $testscript | sed 's|^\([^ ]*\)[ ]*\(.*\)|\2|'`
81 testscript=`echo $testscript | sed 's|^\([^ ]*\)[ ]*.*|\1|'`
84 v) verbose=1
85 let shiftargs=$shiftargs+1
87 esac
88 done
90 if [[ -z "$testscript" ]]; then
91 usage
94 shift $shiftargs
96 datalist=`combo.sh "$@"`
98 TEST_SUITE=`dirname $testscript | sed "s|$TEST_DIR/||" | sed "s|/|_|g"`
100 for data in $datalist; do
101 TEST_DATE=`date -u +%Y-%m-%d-%H-%M-%S``date +%z`
102 TEST_LOG="${TEST_DIR}/results/${TEST_DATE},$data,$OSID,${TEST_MACHINE},$TEST_SUITE.log"
104 if [[ "$OSID" == "nt" ]]; then
105 # If on Windows, set up the Windbg/CDB debug log file
106 # name to point to our log.
107 export _NT_DEBUG_LOG_FILE="`cygpath -w $TEST_LOG`"
110 # tell caller what the log files are
111 echo "log: $TEST_LOG "
113 if [[ "$verbose" == "1" ]]; then
114 test-setup.sh -d $TEST_DIR/data/$data.data 2>&1 | tee -a $TEST_LOG
115 $testscript $testargs -d $TEST_DIR/data/$data.data 2>&1 | tee -a $TEST_LOG
116 else
117 test-setup.sh -d $TEST_DIR/data/$data.data >> $TEST_LOG 2>&1
118 $testscript $testargs -d $TEST_DIR/data/$data.data >> $TEST_LOG 2>&1
121 if [[ "$XPCOM_DEBUG_BREAK" == "stack" ]]; then
122 case $OSID in
125 linux)
126 if findprogram fix-linux-stack.pl; then
127 fix-linux-stack.pl < $TEST_LOG > $TEST_LOG.tmp
128 mv $TEST_LOG.tmp $TEST_LOG
129 else
130 error "XPCOM_DEBUG_BREAK=stack specified but fix-linux-stack.pl is not available"
133 darwin)
134 if findprogram fix-macosx-stack.pl; then
135 fix-macosx-stack.pl < $TEST_LOG > $TEST_LOG.tmp
136 mv $TEST_LOG.tmp $TEST_LOG
137 else
138 error "XPCOM_DEBUG_BREAK=stack specified but fix-macosx-stack.pl is not available"
141 esac
144 done