2007-10-01 12:10:41 -07:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# -*- 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 strict;
|
|
|
|
use Getopt::Mixed "nextOption";
|
|
|
|
|
|
|
|
# predeclarations
|
|
|
|
sub debug;
|
|
|
|
sub usage;
|
|
|
|
sub parse_options;
|
2008-09-05 03:02:23 -07:00
|
|
|
sub escape_string;
|
2007-10-01 12:10:41 -07:00
|
|
|
sub escape_pattern;
|
|
|
|
sub unescape_pattern;
|
|
|
|
|
|
|
|
# option arguments
|
|
|
|
|
2008-07-23 22:04:56 -07:00
|
|
|
my $option_desc = "b=s branch>b T=s buildtype>T R=s repo>R t=s testtype>t o=s os>o K=s kernel>K A=s arch>A M=s memory>M S=s speed>S z=s timezone>z l=s rawlogfile>l f=s failurelogfile>f r=s patterns>r O=s outputprefix>O D debug>D";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
my $testid;
|
2007-10-01 12:10:41 -07:00
|
|
|
my $branch;
|
2008-07-23 22:04:56 -07:00
|
|
|
my $repo;
|
2007-10-01 12:10:41 -07:00
|
|
|
my $buildtype;
|
|
|
|
my $testtype;
|
|
|
|
my $rawlogfile;
|
|
|
|
my $failurelogfile;
|
|
|
|
my $os;
|
|
|
|
my $patterns;
|
|
|
|
my $timezone;
|
|
|
|
my $outputprefix;
|
|
|
|
my $arch;
|
|
|
|
my $kernel;
|
2008-06-25 15:14:01 -07:00
|
|
|
my $memory;
|
|
|
|
my $cpuspeed;
|
2007-10-01 12:10:41 -07:00
|
|
|
my $debug = $ENV{DEBUG};
|
|
|
|
|
|
|
|
# pattern variables
|
|
|
|
|
|
|
|
my $knownfailurebranchpattern;
|
|
|
|
my $failurebranchpattern;
|
|
|
|
my $knownfailureospattern;
|
|
|
|
my $failureospattern;
|
2008-07-23 22:04:56 -07:00
|
|
|
my $knownfailurerepopattern;
|
|
|
|
my $failurerepopattern;
|
2007-10-01 12:10:41 -07:00
|
|
|
my $knownfailurebuildtypepattern;
|
|
|
|
my $failurebuildtypepattern;
|
|
|
|
my $knownfailuretesttypepattern;
|
|
|
|
my $failuretesttypepattern;
|
|
|
|
my $knownfailuretimezonepattern;
|
|
|
|
my $failuretimezonepattern;
|
|
|
|
my $knownfailurearchpattern;
|
|
|
|
my $failurearchpattern;
|
|
|
|
my $knownfailurekernelpattern;
|
|
|
|
my $failurekernelpattern;
|
2008-06-25 15:14:01 -07:00
|
|
|
my $knownfailurememorypattern;
|
|
|
|
my $failurememorypattern;
|
|
|
|
my $knownfailurecpuspeedpattern;
|
|
|
|
my $failurecpuspeedpattern;
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
my @patterns;
|
|
|
|
my $pattern;
|
|
|
|
my @failures;
|
|
|
|
my @fixes;
|
|
|
|
my @excludedtests;
|
|
|
|
my $excludedtest;
|
2008-02-06 12:05:33 -08:00
|
|
|
my $excludedfile;
|
|
|
|
my %includedtests = {};
|
|
|
|
my $includedfile;
|
2007-10-01 12:10:41 -07:00
|
|
|
my @results;
|
|
|
|
|
|
|
|
my $regchars = '\[\^\-\]\|\{\}\?\*\+\.\<\>\$\(\)';
|
|
|
|
|
|
|
|
|
|
|
|
&parse_options;
|
|
|
|
|
|
|
|
my $jsdir = $ENV{TEST_JSDIR};
|
|
|
|
|
|
|
|
if (!defined($jsdir)) {
|
|
|
|
$jsdir = "/work/mozilla/mozilla.com/test.mozilla.com/www/tests/mozilla.org/js";
|
|
|
|
}
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
my @excludedfiles = ("excluded-$branch-$testtype-$buildtype.tests");
|
|
|
|
my @includedfiles = ("included-$branch-$testtype-$buildtype.tests");
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
# create working patterns file consisting of matches to users selection
|
|
|
|
# and which has the test description patterns escaped
|
|
|
|
|
|
|
|
# remove the excluded tests from the possible fixes log
|
|
|
|
|
|
|
|
|
|
|
|
foreach $excludedfile ( @excludedfiles ) {
|
|
|
|
open EXCLUDED, "<$jsdir/$excludedfile" or die "Unable to open excluded file $jsdir/$excludedfile: $!\n";
|
|
|
|
while (<EXCLUDED>) {
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
next if ($_ =~ /^\#/);
|
|
|
|
|
2008-01-09 11:30:38 -08:00
|
|
|
s/\s+$//;
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
push @excludedtests, ($_);
|
|
|
|
}
|
|
|
|
close EXCLUDED;
|
|
|
|
}
|
|
|
|
|
|
|
|
@excludedtests = sort @excludedtests;
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
foreach $includedfile ( @includedfiles ) {
|
|
|
|
open INCLUDED, "<$jsdir/$includedfile" or die "Unable to open included file $jsdir/$includedfile: $!\n";
|
|
|
|
while (<INCLUDED>) {
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
next if ($_ =~ /^\#/);
|
|
|
|
|
|
|
|
s/\s+$//;
|
|
|
|
|
|
|
|
$includedtests{$_} = 1;
|
|
|
|
}
|
|
|
|
close INCLUDED;
|
|
|
|
}
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
debug "loading patterns $patterns";
|
2008-07-23 22:04:56 -07:00
|
|
|
debug "pattern filter: ^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_REPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KERNEL=$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_MEMORY=$knownfailurememorypattern, TEST_CPUSPEED=$knownfailurecpuspeedpattern, TEST_TIMEZONE=$knownfailuretimezonepattern,";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
open PATTERNS, "<$patterns" or die "Unable to open known failure patterns file $patterns: $!\n";
|
|
|
|
while (<PATTERNS>) {
|
|
|
|
chomp;
|
|
|
|
|
2008-01-09 11:30:38 -08:00
|
|
|
s/\s+$//;
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
($testid) = $_ =~ /^TEST_ID=([^,]*),/;
|
|
|
|
|
|
|
|
if (!$includedtests{$testid})
|
|
|
|
{
|
|
|
|
debug "test $testid was not included during this run";
|
|
|
|
}
|
2008-07-23 22:04:56 -07:00
|
|
|
elsif ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_REPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KERNEL=$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_MEMORY=$knownfailurememorypattern, TEST_CPUSPEED=$knownfailurecpuspeedpattern, TEST_TIMEZONE=$knownfailuretimezonepattern,/) {
|
2008-03-23 14:42:44 -07:00
|
|
|
debug "adding pattern : $_";
|
2007-10-01 12:10:41 -07:00
|
|
|
push @patterns, (escape_pattern($_));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
debug "skipping pattern: $_";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
close PATTERNS;
|
|
|
|
|
|
|
|
# create a working copy of the current failures which match the users selection
|
|
|
|
|
2008-07-23 22:04:56 -07:00
|
|
|
debug "failure filter: ^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, TEST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_CPUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST_RESULT=FAIL[^,]*,/";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
if (defined($rawlogfile)) {
|
|
|
|
|
|
|
|
$failurelogfile = "$outputprefix-results-failures.log";
|
|
|
|
my $alllog = "$outputprefix-results-all.log";
|
|
|
|
|
|
|
|
debug "writing failures $failurelogfile";
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
open INPUTLOG, "$jsdir/post-process-logs.pl $rawlogfile |" or die "Unable to open $rawlogfile $!\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
open ALLLOG, ">$alllog" or die "Unable to open $alllog $!\n";
|
|
|
|
open FAILURELOG, ">$failurelogfile" or die "Unable to open $failurelogfile $!\n";
|
|
|
|
|
|
|
|
while (<INPUTLOG>) {
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
print ALLLOG "$_\n";
|
|
|
|
|
2008-07-23 22:04:56 -07:00
|
|
|
if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, TEST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_CPUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST_RESULT=FAIL[^,]*,/) {
|
2007-10-01 12:10:41 -07:00
|
|
|
debug "failure: $_";
|
|
|
|
push @failures, ($_);
|
|
|
|
print FAILURELOG "$_\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close INPUTLOG;
|
2008-02-06 12:05:33 -08:00
|
|
|
my $inputrc = $?;
|
2007-10-01 12:10:41 -07:00
|
|
|
close ALLLOG;
|
|
|
|
close FAILURELOG;
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
die "FATAL ERROR in post-process-logs.pl" if $inputrc != 0;
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
else
|
|
|
|
{
|
2007-10-01 12:10:41 -07:00
|
|
|
debug "loading failures $failurelogfile";
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
my $failurelogfilemode;
|
|
|
|
|
|
|
|
if ($failurelogfile =~ /\.bz2$/)
|
|
|
|
{
|
|
|
|
$failurelogfilemode = "bzcat $failurelogfile|";
|
|
|
|
}
|
|
|
|
elsif ($failurelogfile =~ /\.gz$/)
|
|
|
|
{
|
|
|
|
$failurelogfilemode = "zcat $failurelogfile|";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$failurelogfilemode = "<$failurelogfile";
|
|
|
|
}
|
|
|
|
|
|
|
|
open FAILURES, "$failurelogfilemode" or die "Unable to open current failure log $failurelogfile: $!\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
while (<FAILURES>) {
|
|
|
|
chomp;
|
|
|
|
|
2008-07-23 22:04:56 -07:00
|
|
|
if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, TEST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_CPUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST_RESULT=FAIL[^,]*,/) {
|
2007-10-01 12:10:41 -07:00
|
|
|
debug "failure: $_";
|
|
|
|
push @failures, ($_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close FAILURES;
|
|
|
|
}
|
|
|
|
|
|
|
|
debug "finding fixed bugs";
|
|
|
|
|
|
|
|
unlink "$outputprefix-results-possible-fixes.log";
|
|
|
|
|
|
|
|
foreach $pattern (@patterns) {
|
|
|
|
# look for known failure patterns that don't have matches in the
|
|
|
|
# the current failures selected by the user.
|
|
|
|
|
2008-08-13 11:23:43 -07:00
|
|
|
debug "searching for matches to $pattern\n";
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
@results = grep m@^$pattern@, @failures;
|
|
|
|
|
2008-08-13 11:23:43 -07:00
|
|
|
if ($debug) {
|
|
|
|
my $failure;
|
|
|
|
foreach $failure (@failures) {
|
|
|
|
if ($failure =~ $pattern) {
|
|
|
|
debug "MATCH: $pattern - $failure\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
debug "NOMATCH: $pattern - $failure\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-10-01 12:10:41 -07:00
|
|
|
if ($#results == -1) {
|
2008-08-13 11:23:43 -07:00
|
|
|
debug "fix: '$pattern'";
|
2007-10-01 12:10:41 -07:00
|
|
|
push @fixes, ($pattern)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $excludedtest ( @excludedtests ) {
|
2008-02-06 12:05:33 -08:00
|
|
|
# remove any potential fixes which are due to the test being excluded
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
if ($debug) {
|
|
|
|
@results = grep m@$excludedtest@, @fixes;
|
|
|
|
if ($#results > -1) {
|
|
|
|
print "excluding: " . (join ', ', @results) . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@results = grep !m@$excludedtest@, @fixes;
|
|
|
|
|
|
|
|
@fixes = @results;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $fix;
|
|
|
|
open OUTPUT, ">$outputprefix-results-possible-fixes.log" or die "Unable to open $outputprefix-results-possible-fixes.log: $!";
|
|
|
|
foreach $fix (@fixes) {
|
|
|
|
print OUTPUT unescape_pattern($fix) . "\n";
|
|
|
|
if ($debug) {
|
|
|
|
debug "fix: $fix";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close OUTPUT;
|
|
|
|
|
2007-10-23 09:52:36 -07:00
|
|
|
print STDOUT "log: $outputprefix-results-possible-fixes.log\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
debug "finding regressions";
|
|
|
|
|
|
|
|
my $pass = 0;
|
|
|
|
my $changed = ($#patterns != -1);
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
debug "changed=$changed, \$#patterns=$#patterns, \$#failures=$#failures";
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
while ($changed) {
|
|
|
|
|
|
|
|
$pass = $pass + 1;
|
|
|
|
|
|
|
|
$changed = 0;
|
|
|
|
|
|
|
|
debug "pass $pass";
|
|
|
|
|
|
|
|
foreach $pattern (@patterns) {
|
|
|
|
|
|
|
|
debug "Pattern: $pattern";
|
|
|
|
|
|
|
|
my @nomatches = grep !m@^$pattern@, @failures;
|
|
|
|
my @matches = grep m@^$pattern@, @failures;
|
|
|
|
|
|
|
|
if ($debug) {
|
|
|
|
my $temp = join ', ', @nomatches;
|
|
|
|
debug "nomatches: $#nomatches $temp";
|
|
|
|
$temp = join ', ', @matches;
|
|
|
|
debug "matches: $#matches $temp";
|
|
|
|
}
|
|
|
|
|
|
|
|
@failures = @nomatches;
|
|
|
|
|
|
|
|
if ($#matches > -1) {
|
|
|
|
$changed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
debug "*****************************************";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
debug "\$#excludedtests=$#excludedtests, \$#failures=$#failures";
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
foreach $excludedtest ( @excludedtests ) {
|
|
|
|
|
|
|
|
if ($debug) {
|
|
|
|
@results = grep m@$excludedtest@, @failures;
|
|
|
|
if ($#results > -1) {
|
|
|
|
print "excluding: " . (join ', ', @results) . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@results = grep !m@$excludedtest@, @failures;
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
debug "\$#results=$#results, \$excludedtest=$excludedtest, \$#failures=$#failures";
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
@failures = @results;
|
|
|
|
}
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
debug "possible regressions: \$#failures=$#failures";
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
open OUTPUT, ">$outputprefix-results-possible-regressions.log" or die "Unable to open $outputprefix-results-possible-regressions.log: $!";
|
|
|
|
|
|
|
|
my $failure;
|
|
|
|
foreach $failure (@failures) {
|
|
|
|
print OUTPUT "$failure\n";
|
|
|
|
if ($debug) {
|
|
|
|
debug "regression: $failure";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close OUTPUT;
|
|
|
|
|
2007-10-23 09:52:36 -07:00
|
|
|
print STDOUT "log: $outputprefix-results-possible-regressions.log\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
sub debug {
|
|
|
|
if ($debug) {
|
|
|
|
my $msg = shift;
|
2008-02-06 12:05:33 -08:00
|
|
|
print STDERR "DEBUG: $msg\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub usage {
|
|
|
|
|
|
|
|
my $msg = shift;
|
|
|
|
|
|
|
|
print STDERR <<EOF;
|
|
|
|
|
|
|
|
usage: $msg
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
known-failures.pl [-b|--branch] branch
|
|
|
|
[-T|--buildtype] buildtype
|
|
|
|
[-t|--testtype] testtype
|
|
|
|
[-o|--os] os
|
|
|
|
[-K|--kernel] kernel
|
|
|
|
[-A|--arch] arch
|
|
|
|
[-M|--memory] memory
|
|
|
|
[-S|--speed] speed
|
|
|
|
[-z|--timezone] timezone
|
|
|
|
[-r|--patterns] patterns
|
2007-10-01 12:10:41 -07:00
|
|
|
([-f|--failurelogfile] failurelogfile|[-l|--logfile] rawlogfile])
|
|
|
|
[-O|--outputprefix] outputprefix
|
2008-06-25 15:14:01 -07:00
|
|
|
[-D]
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
variable description
|
|
|
|
=============== ============================================================
|
2008-02-06 12:05:33 -08:00
|
|
|
-b branch branch 1.8.0, 1.8.1, 1.9.0, all
|
2008-07-23 22:04:56 -07:00
|
|
|
-R repository CVS for 1.8.0, 1.8.1, 1.9.0 branches,
|
|
|
|
mercurial repository name for 1.9.1 branches
|
|
|
|
(\`basename http://hg.mozilla.org/repository\`)
|
2007-10-01 12:10:41 -07:00
|
|
|
-T buildtype build type opt, debug, all
|
|
|
|
-t testtype test type browser, shell, all
|
2008-06-25 15:14:01 -07:00
|
|
|
-o os operating system nt, darwin, linux, all
|
|
|
|
-K kernel kernel, all or a specific pattern
|
|
|
|
-A arch architecture, all or a specific pattern
|
|
|
|
-M memory memory in Gigabytes, all or a specific pattern
|
|
|
|
-S speed speed, all or specific pattern
|
|
|
|
-z timezone -0400, -0700, etc. default to user\'s zone
|
2007-10-01 12:10:41 -07:00
|
|
|
-l rawlogfile raw logfile
|
|
|
|
-f failurelogfile failure logfile
|
|
|
|
-r patterns known failure patterns
|
|
|
|
-O outputprefix output files will be generated with this prefix
|
|
|
|
-D turn on debugging output
|
|
|
|
EOF
|
|
|
|
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub parse_options {
|
|
|
|
my ($option, $value);
|
|
|
|
|
|
|
|
Getopt::Mixed::init ($option_desc);
|
|
|
|
$Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER;
|
|
|
|
|
|
|
|
while (($option, $value) = nextOption()) {
|
|
|
|
|
|
|
|
if ($option eq "b") {
|
|
|
|
$branch = $value;
|
|
|
|
}
|
2008-07-23 22:04:56 -07:00
|
|
|
elsif ($option eq "R") {
|
|
|
|
$repo = $value;
|
|
|
|
}
|
2007-10-01 12:10:41 -07:00
|
|
|
elsif ($option eq "T") {
|
|
|
|
$buildtype = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "t") {
|
|
|
|
$testtype = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "o") {
|
|
|
|
$os = $value;
|
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($option eq "K") {
|
|
|
|
$kernel = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "A") {
|
|
|
|
$arch = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "M") {
|
|
|
|
$memory = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "S") {
|
|
|
|
$cpuspeed = $value;
|
|
|
|
if ($cpuspeed < 4)
|
|
|
|
{
|
|
|
|
$cpuspeed = 'slow';
|
|
|
|
}
|
|
|
|
elsif ($cpuspeed < 9)
|
|
|
|
{
|
|
|
|
$cpuspeed = 'medium';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cpuspeed = 'fast';
|
|
|
|
}
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
elsif ($option eq "z") {
|
|
|
|
$timezone = $value;
|
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($option eq "r") {
|
|
|
|
$patterns = $value;
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($option eq "l") {
|
|
|
|
$rawlogfile = $value;
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($option eq "f") {
|
|
|
|
$failurelogfile = $value;
|
|
|
|
}
|
|
|
|
elsif ($option eq "O") {
|
|
|
|
$outputprefix = $value;
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
elsif ($option eq "D") {
|
|
|
|
$debug = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($debug) {
|
2008-06-25 15:14:01 -07:00
|
|
|
print "branch=$branch, buildtype=$buildtype, testtype=$testtype, os=$os, kernel=$kernel, arch=$arch, memory=$memory, cpuspeed=$cpuspeed, timezone=$timezone, patterns=$patterns, rawlogfile=$rawlogfile failurelogfile=$failurelogfile, outputprefix=$outputprefix\n";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
Getopt::Mixed::cleanup();
|
|
|
|
|
|
|
|
if ( !defined($branch) ) {
|
|
|
|
usage "missing branch";
|
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if (!defined($buildtype)) {
|
|
|
|
usage "missing buildtype";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if (!defined($testtype)) {
|
|
|
|
usage "missing testtype";
|
|
|
|
}
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
if (!defined($os)) {
|
|
|
|
usage "missing os";
|
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if (!defined($memory)) {
|
|
|
|
$memory = 'all';
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if (!defined($cpuspeed)) {
|
|
|
|
$cpuspeed = 'all';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!defined($timezone)) {
|
|
|
|
usage "missing timezone";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!defined($patterns)) {
|
|
|
|
usage "missing patterns";
|
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if (!defined($rawlogfile) && !defined($failurelogfile)) {
|
|
|
|
usage "missing logfile";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!defined($outputprefix)) {
|
|
|
|
usage "missing outputprefix";
|
|
|
|
}
|
|
|
|
|
2008-02-06 12:05:33 -08:00
|
|
|
if ($branch eq "1.8.0") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurebranchpattern = "(1\\.8\\.0|\\.\\*)";
|
2008-02-06 12:05:33 -08:00
|
|
|
$failurebranchpattern = "1\\.8\\.0";
|
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($branch eq "1.8.1") {
|
|
|
|
$knownfailurebranchpattern = "(1\\.8\\.1|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failurebranchpattern = "1\\.8\\.1";
|
|
|
|
}
|
|
|
|
elsif ($branch eq "1.9.0") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurebranchpattern = "(1\\.9\\.0|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failurebranchpattern = "1\\.9\\.0";
|
|
|
|
}
|
2008-06-25 15:14:01 -07:00
|
|
|
elsif ($branch eq "1.9.1") {
|
|
|
|
$knownfailurebranchpattern = "(1\\.9\\.1|\\.\\*)";
|
|
|
|
$failurebranchpattern = "1\\.9\\.1";
|
|
|
|
}
|
2007-10-01 12:10:41 -07:00
|
|
|
elsif ($branch eq "all") {
|
|
|
|
$knownfailurebranchpattern = "[^,]*";
|
|
|
|
$failurebranchpattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
2008-07-23 22:04:56 -07:00
|
|
|
if ($repo eq "all" || $repo eq ".*") {
|
|
|
|
$knownfailurerepopattern = "[^,]*";
|
|
|
|
$failurerepopattern = "[^,]*";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$knownfailurerepopattern = "($repo|\\.\\*)";
|
|
|
|
$failurerepopattern = "$repo";
|
|
|
|
}
|
|
|
|
|
2007-10-01 12:10:41 -07:00
|
|
|
if ($buildtype eq "opt") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurebuildtypepattern = "(opt|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failurebuildtypepattern = "opt";
|
|
|
|
}
|
|
|
|
elsif ($buildtype eq "debug") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurebuildtypepattern = "(debug|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failurebuildtypepattern = "debug";
|
|
|
|
}
|
|
|
|
elsif ($buildtype eq "all") {
|
|
|
|
$knownfailurebuildtypepattern = "[^,]*";
|
|
|
|
$failurebuildtypepattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($testtype eq "shell") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailuretesttypepattern = "(shell|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failuretesttypepattern = "shell";
|
|
|
|
}
|
|
|
|
elsif ($testtype eq "browser") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailuretesttypepattern = "(browser|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failuretesttypepattern = "browser";
|
|
|
|
}
|
|
|
|
elsif ($testtype eq "all") {
|
|
|
|
$knownfailuretesttypepattern = "[^,]*";
|
|
|
|
$failuretesttypepattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if ($os eq "nt") {
|
|
|
|
$knownfailureospattern = "(nt|\\.\\*)";
|
|
|
|
$failureospattern = "nt";
|
|
|
|
}
|
|
|
|
elsif ($os eq "darwin") {
|
|
|
|
$knownfailureospattern = "(darwin|\\.\\*)";
|
|
|
|
$failureospattern = "darwin";
|
|
|
|
}
|
|
|
|
elsif ($os eq "linux") {
|
|
|
|
$knownfailureospattern = "(linux|\\.\\*)";
|
|
|
|
$failureospattern = "linux";
|
|
|
|
}
|
|
|
|
elsif ($os eq "all") {
|
|
|
|
$knownfailureospattern = "[^,]*";
|
|
|
|
$failureospattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($kernel ne "all") {
|
|
|
|
$knownfailurekernelpattern = "(" . $kernel . "|\\.\\*)";
|
|
|
|
$failurekernelpattern = "$kernel";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
else {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurekernelpattern = "[^,]*";
|
|
|
|
$failurekernelpattern = "[^,]*";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($arch ne "all") {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurearchpattern = "(" . $arch . "|\\.\\*)";
|
2007-10-01 12:10:41 -07:00
|
|
|
$failurearchpattern = "$arch";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$knownfailurearchpattern = "[^,]*";
|
|
|
|
$failurearchpattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
2008-06-25 15:14:01 -07:00
|
|
|
if ($memory ne "all") {
|
|
|
|
$knownfailurememorypattern = "(" . $memory . "|\\.\\*)";
|
|
|
|
$failurememorypattern = "$memory";
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
else {
|
2008-06-25 15:14:01 -07:00
|
|
|
$knownfailurememorypattern = "[^,]*";
|
|
|
|
$failurememorypattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($cpuspeed ne "all") {
|
|
|
|
$knownfailurecpuspeedpattern = "(" . $cpuspeed . "|\\.\\*)";
|
|
|
|
$failurecpuspeedpattern = "$cpuspeed";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$knownfailurecpuspeedpattern = "[^,]*";
|
|
|
|
$failurecpuspeedpattern = "[^,]*";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($timezone eq "all") {
|
|
|
|
$knownfailuretimezonepattern = "[^,]*";
|
|
|
|
$failuretimezonepattern = "[^,]*";
|
|
|
|
}
|
|
|
|
else {
|
2008-09-05 03:02:23 -07:00
|
|
|
$knownfailuretimezonepattern = "(" . escape_string($timezone) . "|\\.\\*)";
|
|
|
|
$failuretimezonepattern = escape_string("$timezone");
|
2007-10-01 12:10:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
sub escape_string {
|
|
|
|
my $s = shift;
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
# replace unescaped regular expression characters in the
|
2008-09-05 03:02:23 -07:00
|
|
|
# string so they are not interpreted as regexp chars
|
2007-10-01 12:10:41 -07:00
|
|
|
# when matching descriptions. leave the escaped regexp chars
|
2008-09-05 03:02:23 -07:00
|
|
|
# `regexp` alone so they can be unescaped later and used in
|
2007-10-01 12:10:41 -07:00
|
|
|
# pattern matching.
|
|
|
|
|
|
|
|
# see perldoc perlre
|
|
|
|
|
2008-09-05 03:02:23 -07:00
|
|
|
$s =~ s/\\/\\\\/g;
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
# escape non word chars that aren't surrounded by ``
|
2008-09-05 03:02:23 -07:00
|
|
|
$s =~ s/(?<!`)([$regchars])(?!`)/\\$1/g;
|
|
|
|
$s =~ s/(?<!`)([$regchars])(?=`)/\\$1/g;
|
|
|
|
$s =~ s/(?<=`)([$regchars])(?!`)/\\$1/g;
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
# unquote the regchars
|
2008-09-05 03:02:23 -07:00
|
|
|
$s =~ s/\`([^\`])\`/$1/g;
|
|
|
|
|
|
|
|
debug "escape_string : $s";
|
|
|
|
|
|
|
|
return "$s";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sub escape_pattern {
|
|
|
|
|
|
|
|
my $line = shift;
|
|
|
|
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/;
|
|
|
|
|
|
|
|
# debug "escape_pattern: before: $leading$trailing";
|
|
|
|
|
|
|
|
$trailing = escape_string($trailing);
|
2007-10-01 12:10:41 -07:00
|
|
|
|
2008-03-23 14:42:44 -07:00
|
|
|
debug "escape_pattern : $leading$trailing";
|
2007-10-01 12:10:41 -07:00
|
|
|
|
|
|
|
return "$leading$trailing";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sub unescape_pattern {
|
|
|
|
my $line = shift;
|
|
|
|
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/;
|
|
|
|
|
|
|
|
# quote the unescaped non word chars
|
|
|
|
$trailing =~ s/(?<!\\)([$regchars])/`$1`/g;
|
|
|
|
|
|
|
|
# unescape the escaped non word chars
|
|
|
|
$trailing =~ s/\\([$regchars])/$1/g;
|
|
|
|
|
|
|
|
$trailing =~ s/\\\\/\\/g;
|
|
|
|
|
|
|
|
debug "unescape_pattern: after: $leading$trailing";
|
|
|
|
|
|
|
|
return "$leading$trailing";
|
|
|
|
}
|
|
|
|
|
|
|
|
####
|
|
|
|
|
|
|
|
|
|
|
|
1;
|