2007-10-01 12:10:41 -07:00
#!/usr/bin/perl -w
# -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
use Getopt::Mixed "nextOption" ;
use File::Temp qw/ tempfile tempdir / ;
use File::Basename ;
sub dbg ;
sub outresults ;
sub outputrecord ;
local $ file ;
local $ temp ;
2008-02-06 12:05:33 -08:00
my $ debug = $ ENV { DEBUG } ;
2008-04-03 09:22:29 -07:00
my $ test_dir = $ ENV { TEST_DIR } ;
die "FATAL ERROR: environment variable TEST_DIR must be set to the Sisyphus root directory" unless ( $ test_dir ) ;
2007-10-01 12:10:41 -07:00
2008-03-23 14:42:44 -07:00
# required for mac os x 10.5 to prevent sort from
# complaining about illegal byte sequences
$ ENV { LC_ALL } = 'C' ;
2007-10-01 12:10:41 -07:00
( undef , $ temp ) = tempfile ( ) ;
open TEMP , ">$temp" or
2008-02-06 12:05:33 -08:00
die "FATAL ERROR: Unable to open temporary file $temp for writing: $!\n" ;
2008-03-23 14:42:44 -07:00
local ( $ test_id ,
$ tmp_test_id ,
2008-06-25 15:14:01 -07:00
$ tmp_test_exit_status ,
2008-03-23 14:42:44 -07:00
% test_id ,
% test_reported ,
2008-02-06 12:05:33 -08:00
$ test_result ,
$ test_type ,
$ tmp_test_type ,
$ test_description ,
@ messages ,
$ test_processortype ,
$ test_kernel ,
$ test_suite ,
2008-06-25 15:14:01 -07:00
$ test_exit_status ,
@ expected_exit_code_list ,
$ expected_exit_code ,
$ exit_code ,
2008-03-23 14:42:44 -07:00
$ state ) ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
local $ test_memory = 0 ;
local $ test_cpuspeed = 0 ;
local % test_reported = ( ) ;
2008-07-23 22:04:56 -07:00
local $ test_repo = 'CVS' ;
2007-10-01 12:10:41 -07:00
while ( $ file = shift @ ARGV )
{
@ messages = ( ) ;
dbg "file: $file" ;
my $ filename = basename $ file ;
dbg "filename: $file" ;
local ( $ test_date , $ test_product , $ test_branchid , $ test_buildtype ,
2008-02-06 12:05:33 -08:00
$ test_os ,
$ test_machine , $ test_global_target ) = split /,/ , $ filename ;
2007-10-01 12:10:41 -07:00
$ test_branchid =~ s/[^0-9.]//g ;
$ test_global_target =~ s/.log$// ;
local ( $ test_timezone ) = $ test_date ;
$ test_timezone =~ s/.*([-+]\d{4,4})/$1/ ;
2008-06-25 15:14:01 -07:00
my $ filemode ;
if ( $ file =~ /\.bz2$/ )
{
$ filemode = "bzcat $file|" ;
}
elsif ( $ file =~ /\.gz$/ )
{
$ filemode = "zcat $file|" ;
}
else
{
$ filemode = "<$file" ;
}
open FILE , "$filemode" or die "FATAL ERROR: unable to open $file for reading: $!\n" ;
2008-02-06 12:05:33 -08:00
dbg "process header with environment variables used in test" ;
while ( <FILE> )
{
2008-03-23 14:42:44 -07:00
$ state = 'failure' ;
2008-02-06 12:05:33 -08:00
chomp ;
# remove carriage returns, bels and other annoyances.
$ _ =~ s/[\r]$// ;
$ _ =~ s/[\r]/CR/g ;
$ _ =~ s/[\x01-\x08]//g ;
$ _ =~ s/\s+$// ;
2008-06-25 15:14:01 -07:00
if ( $ debug )
{
dbg "\nINPUT: $_" ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
last if ( $ _ =~ /^arguments:/ ) ;
2008-02-06 12:05:33 -08:00
2008-07-23 22:04:56 -07:00
if ( ( $ envval ) = $ _ =~ /^environment: TEST_MOZILLA_HG=http:\/\/hg.mozilla.org\/(.*)/ )
{
$ test_repo = $ envval ;
}
elsif ( ( $ envvar , $ envval ) = $ _ =~ /^environment: (TEST_[A-Z0-9_]*)=(.*)/ )
2008-02-06 12:05:33 -08:00
{
dbg "envvar=$envvar, envval=$envval" ;
2008-06-25 15:14:01 -07:00
if ( $ envvar =~ /TEST_KERNEL/ )
{
$ envval =~ s/([0-9]+)\.([0-9]+)\.([0-9]+).*/$1.$2.$3/ ;
dbg "found TEST_KERNEL" ;
}
2008-02-06 12:05:33 -08:00
$ envvar =~ tr /A-Z/ a - z / ;
$$ envvar = $ envval ;
dbg $ envvar . "=" . $$ envvar ;
}
elsif ( ( $ envval ) = $ _ =~ /^environment: OSID=(.*)/ )
{
$ test_os = $ envval ;
}
}
2007-10-01 12:10:41 -07:00
2008-06-25 15:14:01 -07:00
if ( $ test_cpuspeed < 4 )
{
$ test_cpuspeed = 'slow' ;
}
elsif ( $ test_cpuspeed < 9 )
{
$ test_cpuspeed = 'medium' ;
}
else
{
$ test_cpuspeed = 'fast' ;
}
2007-10-01 12:10:41 -07:00
if ( $ test_product eq "js" )
{
2008-06-25 15:14:01 -07:00
$ test_type = "shell" ;
}
elsif ( $ test_product eq "firefox" || $ test_product eq "thunderbird" )
{
$ test_buildtype = "nightly" unless $ test_buildtype ;
$ test_type = "browser" ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
# Expected sequence if all output written to the log.
#
# Input
# -----------------------------
# JavaScriptTest: Begin Run
# JavaScriptTest: Begin Test t;
# jstest: t
# t:.*EXIT STATUS:
# JavaScriptTest: End Test t
# JavaScriptTest: End Run
# EOF
#
% test_id = ( ) ;
@ messages = ( ) ;
$ test_exit_status = '' ;
$ state = 'idle' ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
while ( <FILE> )
{
chomp ;
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
if ( $ debug )
{
dbg "\nINPUT: '$_'" ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ _ =~ s/[\r]$// ;
$ _ =~ s/[\r]/CR/g ;
$ _ =~ s/[\x01-\x08]//g ;
$ _ =~ s/\s+$// ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( /^JavaScriptTest: Begin Run/ )
{
dbg "Begin Run" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'idle' )
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
$ state = 'beginrun' ;
2008-02-06 12:05:33 -08:00
}
else
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, expected: idle, log: $file" ;
$ state = 'beginrun' ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
}
elsif ( ( $ tmp_test_id ) = $ _ =~ /^JavaScriptTest: Begin Test ([^ ]*)/ )
{
dbg "Begin Test: $tmp_test_id" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'beginrun' || $ state eq 'endtest' )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
$ state = 'runningtest' ;
}
else
{
warn "WARNING: state: $state, expected: beginrun, endtest, log: $file" ;
$ state = 'runningtest' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
@ messages = ( ) ;
@ expected_exit_code_list = ( ) ;
$ expected_exit_code = ( ) ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_id = '' ;
$ test_result = '' ;
$ test_exit_status = 'NORMAL' ; # default to normal, so subtests will have a NORMAL status
$ test_description = '' ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
push @ expected_exit_code_list , ( 3 ) if ( $ tmp_test_id =~ /-n.js$/ ) ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
elsif ( ( $ expected_exit_code ) = $ _ =~ /WE EXPECT EXIT CODE ([0-9]*)/ )
{
dbg "Expected Exit Code: $expected_exit_code" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
push @ expected_exit_code_list , ( $ expected_exit_code ) ;
}
elsif ( ( $ tmp_test_id ) = $ _ =~ /^jstest: (.*?) *bug:/ )
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
dbg "jstest: $tmp_test_id" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
# if ($test_id{$state} && $tmp_test_id ne $test_id{$state})
# {
# warn "WARNING: state: $state, expected runningtest, reportingtest. mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file";
# }
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'runningtest' )
{
$ state = 'reportingtest' ;
}
elsif ( $ state eq 'reportingtest' )
2008-02-12 04:06:14 -08:00
{
2008-06-25 15:14:01 -07:00
$ state = 'reportingtest' ;
}
else
{
warn "WARNING: test_id: $test_id{$state}, state: $state, expected: runningtest, reportingtest, log: $file" ;
$ state = 'reportingtest' ;
2008-02-12 04:06:14 -08:00
}
2008-06-25 15:14:01 -07:00
( $ test_result ) = $ _ =~ /result: (.*?) *type:/ ;
( $ tmp_test_type ) = $ _ =~ /type: (.*?) *description:/ ;
die "FATAL ERROR: test_id: $test_id{$state}, jstest test type mismatch: start test_type: $test_type, current test_type: $tmp_test_type, test state: $state, log: $file"
if ( $ test_type ne $ tmp_test_type ) ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
( $ test_description ) = $ _ =~ /description: (.*)/ ;
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
if ( ! $ test_description )
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
$ test_description = "" ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
$ test_description . = '; messages: ' . ( join '; ' , @ messages ) . ';' ;
outputrecord $ tmp_test_id , $ test_description , $ test_result ;
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( $ state ne 'idle' && ( ( $ tmp_test_id ) = $ _ =~ /^([^:]*):.* EXIT STATUS: NORMAL/ ) )
{
$ test_exit_status = 'NORMAL' ;
dbg "Exit Status Normal: $tmp_test_id, $test_exit_status" ;
if ( $ test_id { $ state } && $ tmp_test_id ne $ test_id { $ state } )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file" ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
if ( $ state eq 'reportingtest' || $ state eq 'runningtest' )
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
$ state = 'exitedtest' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
else
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, expected: reportingtest, runningtest, log: $file" ;
$ state = 'exitedtest' ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
if ( ! $ test_reported { $ tmp_test_id } )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
dbg "No test results reported: $tmp_test_id" ;
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
$ test_result = 'FAILED' ;
$ test_description = 'No test results reported; messages: ' . ( join '; ' , @ messages ) . ';' ;
outputrecord $ tmp_test_id , $ test_description , $ test_result ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( $ state ne 'idle' && ( ( $ tmp_test_id ) = $ _ =~ /^([^:]*):.* EXIT STATUS: TIMED OUT/ ) )
{
$ test_exit_status = 'TIMED OUT' ;
dbg "Exit Status Timed Out: $tmp_test_id, $test_exit_status" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ test_id { $ state } && $ tmp_test_id ne $ test_id { $ state } )
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file" ;
}
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'reportingtest' || $ state eq 'runningtest' )
{
$ state = 'exitedtest' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
else
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
dbg "state: $state, expected: reportingtest, runningtest" ;
$ state = 'exitedtest' ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_result = 'FAILED' ;
$ test_description . = '; messages: ' . ( join '; ' , @ messages ) . ';' ;
outputrecord $ tmp_test_id , $ test_description , $ test_result ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( $ state ne 'idle' && ( ( $ tmp_test_id , $ tmp_test_exit_status ) = $ _ =~ /^([^:]*):.* EXIT STATUS: (CRASHED signal [0-9]+ [A-Z]+) \([0-9.]+ seconds\)/ ) )
{
$ test_exit_status = $ tmp_test_exit_status ;
dbg "Exit Status Crashed: $tmp_test_id, $test_exit_status" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ test_id { $ state } && $ tmp_test_id ne $ test_id { $ state } )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file" ;
}
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'reportingtest' || $ state eq 'runningtest' )
{
$ state = 'exitedtest' ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
else
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
dbg "state: $state, expected: reportingtest, runningtest" ;
$ state = 'exitedtest' ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_result = 'FAILED' ;
$ test_description . = '; messages: ' . ( join '; ' , @ messages ) . ';' ;
outputrecord $ tmp_test_id , $ test_description , $ test_result ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( $ state ne 'idle' && ( ( $ tmp_test_id , $ tmp_test_exit_status ) = $ _ =~ /^([^:]*):.* EXIT STATUS: (ABNORMAL [0-9]+) \([0-9.]+ seconds\)/ ) )
{
$ test_exit_status = $ tmp_test_exit_status ;
dbg "Exit Status Abnormal: $tmp_test_id, $test_exit_status" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ test_id { $ state } && $ tmp_test_id ne $ test_id { $ state } )
{
warn "WARNING: state: $state, mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file" ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'reportingtest' || $ state eq 'runningtest' )
{
$ state = 'exitedtest' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
else
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
dbg "state: $state, expected: reportingtest, runningtest" ;
$ state = 'exitedtest' ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
( $ exit_code ) = $ test_exit_status =~ /ABNORMAL ([0-9]+)/ ;
2008-02-12 04:06:14 -08:00
2008-06-25 15:14:01 -07:00
if ( grep /$exit_code/ , @ expected_exit_code_list )
{
$ test_result = 'PASSED' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
else
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
$ test_result = 'FAILED' ;
}
2008-02-12 04:06:14 -08:00
2008-06-25 15:14:01 -07:00
$ test_description . = '; messages: ' . ( join '; ' , @ messages ) . ';' ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
dbg "Exit Code: $exit_code, Test Result: $test_result, Expected Exit Codes: " . ( join '; ' , @ expected_exit_code_list ) ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
outputrecord $ tmp_test_id , $ test_description , $ test_result ;
2008-03-23 14:42:44 -07:00
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( ( $ tmp_test_id ) = $ _ =~ /^JavaScriptTest: End Test ([^ ]*)/ )
{
dbg "End Test: $tmp_test_id" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ test_id { $ state } && $ tmp_test_id ne $ test_id { $ state } )
{
warn "WARNING: state: $state, mismatched test_id: expected: $tmp_test_id, actual: $test_id{$state}, log: $file" ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
if ( $ state eq 'exitedtest' || $ state eq 'runningtest' || $ state eq 'reportingtest' )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
$ state = 'endtest' ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
else
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, expected: runningtest, reportingtest, exitedtest, log: $file" ;
$ state = 'endtest' ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
$ test_id { $ state } = $ tmp_test_id ;
}
elsif ( /^JavaScriptTest: End Run/ )
{
dbg "End Run" ;
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ state eq 'endtest' )
{
$ state = 'endrun' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
else
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
warn "WARNING: state: $state, expected: endtest, log: $file" ;
$ state = 'endrun' ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
}
elsif ( $ _ &&
! /^\s+$/ &&
! /^(STATUS:| *PASSED!| *FAILED!)/ &&
! /^JavaScriptTest:/ &&
! /^[*][*][*]/ &&
! /^[-+]{2,2}(WEBSHELL|DOMWINDOW)/ &&
! /^Spider:/ &&
! /real.*user.*sys.*$/ &&
! /user.*system.*elapsed/ )
{
if ( 'runningtest, reportingtest' =~ /$state/ )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
if ( /error: can.t allocate region/ || /set a breakpoint in malloc_error_break/ ||
/set a breakpoint in szone_error to debug/ || /malloc:.*mmap/ || /vm_allocate/ ||
2008-07-02 05:36:07 -07:00
/terminate called after throwing an instance of .*bad_alloc/ )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
dbg "Adding message: $_ converted to /$test_id{$state}:0: out of memory" ;
push @ messages , ( '/' . $ test_id { $ state } . ':0: out of memory' ) ;
2008-03-23 14:42:44 -07:00
}
2008-06-25 15:14:01 -07:00
elsif ( /\.js, line [0-9]+: out of memory/ )
2008-03-23 14:42:44 -07:00
{
2008-06-25 15:14:01 -07:00
s/\.js, line ([0-9]+): out of memory/\.js:$1:/ ;
dbg "Adding message: $_ converted to /$test_id{$state}:0: out of memory" ;
push @ messages , ( '/' . $ test_id { $ state } . ':0: out of memory' ) ;
2008-02-06 12:05:33 -08:00
}
else
{
2008-06-25 15:14:01 -07:00
dbg "Adding message: $_" ;
push @ messages , ( $ _ ) ;
2008-03-23 14:42:44 -07:00
}
}
2008-06-25 15:14:01 -07:00
}
elsif ( $ debug )
{
dbg "Skipping: $_" ;
}
2008-02-06 12:05:33 -08:00
2008-06-25 15:14:01 -07:00
if ( $ debug )
{
if ( $ test_id { $ state } )
{
dbg "test_id{$state}=$test_id{$state}, " . ( join '; ' , @ messages ) ;
2008-02-06 12:05:33 -08:00
}
2008-06-25 15:14:01 -07:00
else
2008-02-06 12:05:33 -08:00
{
2008-06-25 15:14:01 -07:00
dbg "state=$state, " . ( join '; ' , @ messages ) ;
2008-02-06 12:05:33 -08:00
}
}
2007-10-01 12:10:41 -07:00
}
2008-06-25 15:14:01 -07:00
if ( $ state eq 'endrun' )
{
$ state = 'success' ;
}
2008-03-23 14:42:44 -07:00
die "FATAL ERROR: Test run terminated prematurely. state: $state, log: $file" if ( $ state ne 'success' ) ;
2007-10-01 12:10:41 -07:00
2008-06-25 15:14:01 -07:00
}
close FILE ;
2007-10-01 12:10:41 -07:00
close TEMP ;
2008-06-25 15:14:01 -07:00
undef $ test_branchid ;
undef $ test_date ;
undef $ test_buildtype ;
undef $ test_machine ;
undef $ test_product ;
undef $ test_suite ;
2007-10-01 12:10:41 -07:00
outresults ;
unlink $ temp ;
sub dbg {
2008-02-06 12:05:33 -08:00
if ( $ debug )
2007-10-01 12:10:41 -07:00
{
2008-02-06 12:05:33 -08:00
my $ msg = shift ;
print STDERR "DEBUG: $msg\n" ;
2007-10-01 12:10:41 -07:00
}
}
sub outresults
{
2008-06-25 15:14:01 -07:00
dbg "sorting temp file $temp" ;
2007-10-01 12:10:41 -07:00
system ( "sort < $temp | uniq" ) ;
2008-06-25 15:14:01 -07:00
dbg "finished sorting" ;
2007-10-01 12:10:41 -07:00
}
sub outputrecord
{
2008-03-23 14:42:44 -07:00
my ( $ test_id , $ test_description , $ test_result ) = @ _ ;
2007-10-01 12:10:41 -07:00
# cut off the extra jstest: summaries as they duplicate the other
# output and follow it.
$ test_description =~ s/jstest:.*// ;
2008-06-25 15:14:01 -07:00
# if (length($test_description) > 6000)
# {
# $test_description = substr($test_description, 0, 6000);
# }
#
2007-10-01 12:10:41 -07:00
my $ output =
2008-06-25 15:14:01 -07:00
"TEST_ID=$test_id, " .
"TEST_BRANCH=$test_branchid, " .
2008-07-23 22:04:56 -07:00
"TEST_REPO=$test_repo, " .
2008-06-25 15:14:01 -07:00
"TEST_BUILDTYPE=$test_buildtype, " .
"TEST_TYPE=$test_type, " .
"TEST_OS=$test_os, " .
"TEST_KERNEL=$test_kernel, " .
"TEST_PROCESSORTYPE=$test_processortype, " .
"TEST_MEMORY=$test_memory, " .
"TEST_CPUSPEED=$test_cpuspeed, " .
"TEST_TIMEZONE=$test_timezone, " .
"TEST_RESULT=$test_result, " .
"TEST_EXITSTATUS=$test_exit_status, " .
"TEST_DESCRIPTION=$test_description, " .
"TEST_MACHINE=$test_machine, " .
"TEST_DATE=$test_date" .
"\n" ;
2007-10-01 12:10:41 -07:00
2008-02-06 12:05:33 -08:00
if ( $ debug )
2007-10-01 12:10:41 -07:00
{
2008-02-06 12:05:33 -08:00
dbg "RECORD: $output" ;
2007-10-01 12:10:41 -07:00
}
print TEMP $ output ;
2008-03-23 14:42:44 -07:00
$ test_reported { $ test_id } = 1 ;
@ messages = ( ) ;
2007-10-01 12:10:41 -07:00
}