Bug 458113. Fix syntax error that broke OS/2 build. r+wuno
[wine-gecko.git] / js / tests / process-logs.sh
bloba5abc13b47fb24545a7eb0ad97c6b045974c946d
1 #!/bin/bash -e
2 # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
4 # ***** BEGIN LICENSE BLOCK *****
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 # The contents of this file are subject to the Mozilla Public License Version
8 # 1.1 (the "License"); you may not use this file except in compliance with
9 # the License. You may obtain a copy of the License at
10 # http://www.mozilla.org/MPL/
12 # Software distributed under the License is distributed on an "AS IS" basis,
13 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 # for the specific language governing rights and limitations under the
15 # License.
17 # The Original Code is Mozilla JavaScript Testing Utilities
19 # The Initial Developer of the Original Code is
20 # Mozilla Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 2007
22 # the Initial Developer. All Rights Reserved.
24 # Contributor(s): Bob Clary <bclary@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 if [[ -z "$TEST_DIR" ]]; then
41 cat <<EOF
42 `basename $0`: error
44 TEST_DIR, the location of the Sisyphus framework,
45 is required to be set prior to calling this script.
46 EOF
47 exit 2
50 if [[ ! -e $TEST_DIR/bin/library.sh ]]; then
51 echo "TEST_DIR=$TEST_DIR"
52 echo ""
53 echo "This script requires the Sisyphus testing framework. Please "
54 echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus"
55 echo "and set the environment variable TEST_DIR to the directory where it"
56 echo "located."
57 echo ""
59 exit 2
62 source $TEST_DIR/bin/library.sh
64 TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
66 usage()
68 cat <<EOF
69 usage: process-logs.sh.sh -l testlogfiles -A arch -K kernel
71 variable description
72 =============== ============================================================
73 testlogfiles The test log to be processed. If testlogfiles is a file
74 pattern it must be single quoted to prevent the shell from
75 expanding it before it is passed to the script.
76 EOF
77 exit 2
80 while getopts "l:" optname;
82 case $optname in
83 l) testlogfiles=$OPTARG;;
84 esac
85 done
87 if [[ -z "$testlogfiles" ]]; then
88 usage
91 for testlogfile in `ls $testlogfiles`; do
93 debug "testlogfile=$testlogfile"
95 case $testlogfile in
96 *.log)
97 worktestlogfile=$testlogfile
99 *.log.bz2)
100 worktestlogfile=`mktemp $testlogfile.XXXXXX`
101 bunzip2 -c $testlogfile > $worktestlogfile
103 *.log.gz)
104 worktestlogfile=`mktemp $testlogfile.XXXXXX`
105 gunzip -c $testlogfile > $worktestlogfile
108 echo "unknown log type: $f"
109 exit 2
111 esac
113 case "$testlogfile" in
114 *,js,*) testtype=shell;;
115 *,firefox,*) testtype=browser;;
116 *) error "unknown testtype in logfile $testlogfile" $LINENO;;
117 esac
119 debug "testtype=$testtype"
121 case "$testlogfile" in
122 *,nightly,*) buildtype=nightly;;
123 *,opt,*) buildtype=opt;;
124 *,debug,*) buildtype=debug;;
125 *) error "unknown buildtype in logfile $testlogfile" $LINENO;
126 esac
128 debug "buildtype=$buildtype"
130 case "$testlogfile" in
131 *,1.8.0*) branch=1.8.0;;
132 *,1.8.1*) branch=1.8.1;;
133 *,1.9.0*) branch=1.9.0;;
134 *,1.9.1*) branch=1.9.1;;
136 branch=`grep -m 1 '^environment: TEST_BRANCH=' $worktestlogfile | sed 's|.*TEST_BRANCH=\(.*\)|\1|'`
137 if [[ -z "$branch" ]]; then
138 error "unknown branch in logfile $testlogfile" $LINENO
141 esac
143 debug "branch=$branch"
145 repo=`grep -m 1 '^environment: TEST_MOZILLA_HG=' $worktestlogfile | sed 's|.*TEST_MOZILLA_HG=http://hg.mozilla.org/\(.*\)|\1|'`
146 if [[ -z "$repo" ]]; then
147 repo=CVS
149 debug "repo=$repo"
151 case "$testlogfile" in
152 *,nt,*) OSID=nt;;
153 *,linux,*) OSID=linux;;
154 *,darwin,*) OSID=darwin;;
156 OSID=`grep -m 1 '^environment: OSID=' $worktestlogfile | sed 's|.*OSID=\(.*\)|\1|'`
157 if [[ -z "$OSID" ]]; then
158 error "unknown OS in logfile $testlogfile" $LINENO
161 esac
163 debug "OSID=$OSID"
165 kernel=`grep -m 1 '^environment: TEST_KERNEL=' $worktestlogfile | sed 's|.*TEST_KERNEL=\(.*\)|\1|'`
166 if [[ "$OSID" == "linux" ]]; then
167 kernel=`echo $kernel | sed 's|\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*|\1.\2.\3|'`
169 debug "kernel=$kernel"
171 arch=`grep -m 1 '^environment: TEST_PROCESSORTYPE=' $worktestlogfile | sed 's|.*TEST_PROCESSORTYPE=\(.*\)|\1|'`
172 debug "arch=$arch"
174 memory=`grep -m 1 '^environment: TEST_MEMORY=' $worktestlogfile | sed 's|.*TEST_MEMORY=\(.*\)|\1|'`
175 speed=`grep -m 1 '^environment: TEST_CPUSPEED=' $worktestlogfile | sed 's|.*TEST_CPUSPEED=\(.*\)|\1|'`
177 timezone=`basename $testlogfile | sed 's|^[-0-9]*\([-+]\)\([0-9]\{4,4\}\),.*|\1\2|'`
179 debug "timezone=$timezone"
181 outputprefix=$testlogfile
183 includetests="included-$branch-$testtype-$buildtype.tests"
184 excludetests="excluded-$branch-$testtype-$buildtype.tests"
186 grep '^include: ' $worktestlogfile | sed 's|include: ||' > $TEST_DIR/tests/mozilla.org/js/$includetests
187 grep '^exclude: ' $worktestlogfile | sed 's|exclude: ||' > $TEST_DIR/tests/mozilla.org/js/$excludetests
189 $TEST_DIR/tests/mozilla.org/js/known-failures.pl \
190 -b "$branch" \
191 -T "$buildtype" \
192 -R "$repo" \
193 -t "$testtype" \
194 -o "$OSID" \
195 -K "$kernel" \
196 -A "$arch" \
197 -M "$memory" \
198 -S "$speed" \
199 -z "$timezone" \
200 -r "$TEST_JSDIR/failures.txt" \
201 -l "$worktestlogfile" \
202 -O "$outputprefix"
204 if [[ "$testlogfile" != "$worktestlogfile" ]]; then
205 rm $worktestlogfile
206 unset worktestlogfile
208 done