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
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
44 TEST_DIR, the location of the Sisyphus framework,
45 is required to be set prior to calling this script.
50 if [[ ! -e $TEST_DIR/bin
/library.sh
]]; then
51 echo "TEST_DIR=$TEST_DIR"
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"
62 source $TEST_DIR/bin
/library.sh
64 TEST_JSDIR
=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
69 usage: process-logs.sh.sh -l testlogfiles -A arch -K kernel
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.
80 while getopts "l:" optname
;
83 l
) testlogfiles
=$OPTARG;;
87 if [[ -z "$testlogfiles" ]]; then
91 for testlogfile
in `ls $testlogfiles`; do
93 debug
"testlogfile=$testlogfile"
97 worktestlogfile
=$testlogfile
100 worktestlogfile
=`mktemp $testlogfile.XXXXXX`
101 bunzip2
-c $testlogfile > $worktestlogfile
104 worktestlogfile
=`mktemp $testlogfile.XXXXXX`
105 gunzip
-c $testlogfile > $worktestlogfile
108 echo "unknown log type: $f"
113 case "$testlogfile" in
114 *,js
,*) testtype
=shell
;;
115 *,firefox
,*) testtype
=browser
;;
116 *) error
"unknown testtype in logfile $testlogfile" $LINENO;;
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;
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
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
151 case "$testlogfile" in
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
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|'`
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 \
200 -r "$TEST_JSDIR/failures.txt" \
201 -l "$worktestlogfile" \
204 if [[ "$testlogfile" != "$worktestlogfile" ]]; then
206 unset worktestlogfile