OLD | NEW |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- | 2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- |
3 | 3 |
4 # ***** BEGIN LICENSE BLOCK ***** | 4 # ***** BEGIN LICENSE BLOCK ***** |
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 # | 6 # |
7 # The contents of this file are subject to the Mozilla Public License Version | 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 | 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 | 9 # the License. You may obtain a copy of the License at |
10 # http://www.mozilla.org/MPL/ | 10 # http://www.mozilla.org/MPL/ |
(...skipping 26 matching lines...) Expand all Loading... |
37 # | 37 # |
38 # ***** END LICENSE BLOCK ***** | 38 # ***** END LICENSE BLOCK ***** |
39 | 39 |
40 use strict; | 40 use strict; |
41 use Getopt::Mixed "nextOption"; | 41 use Getopt::Mixed "nextOption"; |
42 | 42 |
43 # predeclarations | 43 # predeclarations |
44 sub debug; | 44 sub debug; |
45 sub usage; | 45 sub usage; |
46 sub parse_options; | 46 sub parse_options; |
| 47 sub escape_string; |
47 sub escape_pattern; | 48 sub escape_pattern; |
48 sub unescape_pattern; | 49 sub unescape_pattern; |
49 | 50 |
50 # option arguments | 51 # option arguments |
51 | 52 |
52 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 rawlogfil
e>l f=s failurelogfile>f r=s patterns>r O=s outputprefix>O D debug>D"; | 53 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 z=s timezone>z J=s jsoptions>J l=s rawlo
gfile>l f=s failurelogfile>f r=s patterns>r O=s outputprefix>O D debug>D"; |
53 | 54 |
54 my $testid; | 55 my $testid; |
55 my $branch; | 56 my $branch; |
56 my $repo; | 57 my $repo; |
57 my $buildtype; | 58 my $buildtype; |
58 my $testtype; | 59 my $testtype; |
59 my $rawlogfile; | 60 my $rawlogfile; |
60 my $failurelogfile; | 61 my $failurelogfile; |
61 my $os; | 62 my $os; |
62 my $patterns; | 63 my $patterns; |
63 my $timezone; | 64 my $timezone; |
| 65 my $jsoptions; |
64 my $outputprefix; | 66 my $outputprefix; |
65 my $arch; | 67 my $arch; |
66 my $kernel; | 68 my $kernel; |
67 my $memory; | 69 my $memory; |
68 my $cpuspeed; | |
69 my $debug = $ENV{DEBUG}; | 70 my $debug = $ENV{DEBUG}; |
70 | 71 |
71 # pattern variables | 72 # pattern variables |
72 | 73 |
73 my $knownfailurebranchpattern; | 74 my $knownfailurebranchpattern; |
74 my $failurebranchpattern; | 75 my $failurebranchpattern; |
75 my $knownfailureospattern; | 76 my $knownfailureospattern; |
76 my $failureospattern; | 77 my $failureospattern; |
77 my $knownfailurerepopattern; | 78 my $knownfailurerepopattern; |
78 my $failurerepopattern; | 79 my $failurerepopattern; |
79 my $knownfailurebuildtypepattern; | 80 my $knownfailurebuildtypepattern; |
80 my $failurebuildtypepattern; | 81 my $failurebuildtypepattern; |
81 my $knownfailuretesttypepattern; | 82 my $knownfailuretesttypepattern; |
82 my $failuretesttypepattern; | 83 my $failuretesttypepattern; |
83 my $knownfailuretimezonepattern; | 84 my $knownfailuretimezonepattern; |
84 my $failuretimezonepattern; | 85 my $failuretimezonepattern; |
| 86 my $knownfailurejsoptionspattern; |
| 87 my $failurejsoptionspattern; |
85 my $knownfailurearchpattern; | 88 my $knownfailurearchpattern; |
86 my $failurearchpattern; | 89 my $failurearchpattern; |
87 my $knownfailurekernelpattern; | 90 my $knownfailurekernelpattern; |
88 my $failurekernelpattern; | 91 my $failurekernelpattern; |
89 my $knownfailurememorypattern; | 92 my $knownfailurememorypattern; |
90 my $failurememorypattern; | 93 my $failurememorypattern; |
91 my $knownfailurecpuspeedpattern; | |
92 my $failurecpuspeedpattern; | |
93 | 94 |
94 my @patterns; | 95 my @patterns; |
95 my $pattern; | 96 my $pattern; |
96 my @failures; | 97 my @failures; |
97 my @fixes; | 98 my @fixes; |
98 my @excludedtests; | 99 my @excludedtests; |
99 my $excludedtest; | 100 my $excludedtest; |
100 my $excludedfile; | 101 my $excludedfile; |
101 my %includedtests = {}; | 102 my %includedtests = {}; |
102 my $includedfile; | 103 my $includedfile; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 next if ($_ =~ /^\#/); | 147 next if ($_ =~ /^\#/); |
147 | 148 |
148 s/\s+$//; | 149 s/\s+$//; |
149 | 150 |
150 $includedtests{$_} = 1; | 151 $includedtests{$_} = 1; |
151 } | 152 } |
152 close INCLUDED; | 153 close INCLUDED; |
153 } | 154 } |
154 | 155 |
155 debug "loading patterns $patterns"; | 156 debug "loading patterns $patterns"; |
156 debug "pattern filter: ^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, T
EST_REPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern,
TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KE
RNEL=$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TE
ST_MEMORY=$knownfailurememorypattern, TEST_CPUSPEED=$knownfailurecpuspeedpattern
, TEST_TIMEZONE=$knownfailuretimezonepattern,"; | 157 debug "pattern filter: ^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, T
EST_REPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern,
TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KE
RNEL=$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TE
ST_MEMORY=$knownfailurememorypattern, TEST_TIMEZONE=$knownfailuretimezonepattern
, TEST_OPTIONS=$knownfailurejsoptionspattern,"; |
157 | 158 |
158 open PATTERNS, "<$patterns" or die "Unable to open known failure patterns file $
patterns: $!\n"; | 159 open PATTERNS, "<$patterns" or die "Unable to open known failure patterns file $
patterns: $!\n"; |
159 while (<PATTERNS>) { | 160 while (<PATTERNS>) { |
160 chomp; | 161 chomp; |
161 | 162 |
162 s/\s+$//; | 163 s/\s+$//; |
163 | 164 |
164 ($testid) = $_ =~ /^TEST_ID=([^,]*),/; | 165 ($testid) = $_ =~ /^TEST_ID=([^,]*),/; |
165 | 166 |
166 if (!$includedtests{$testid}) | 167 if (!$includedtests{$testid}) |
167 { | 168 { |
168 debug "test $testid was not included during this run"; | 169 debug "test $testid was not included during this run"; |
169 } | 170 } |
170 elsif ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_R
EPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST
_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KERNEL=
$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_ME
MORY=$knownfailurememorypattern, TEST_CPUSPEED=$knownfailurecpuspeedpattern, TES
T_TIMEZONE=$knownfailuretimezonepattern,/) { | 171 elsif ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_R
EPO=$knownfailurerepopattern, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST
_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_KERNEL=
$knownfailurekernelpattern, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_ME
MORY=$knownfailurememorypattern, TEST_TIMEZONE=$knownfailuretimezonepattern, TES
T_OPTIONS=$knownfailurejsoptionspattern,/) { |
171 debug "adding pattern : $_"; | 172 debug "adding pattern : $_"; |
172 push @patterns, (escape_pattern($_)); | 173 push @patterns, (escape_pattern($_)); |
173 } | 174 } |
174 else { | 175 else { |
175 debug "skipping pattern: $_"; | 176 debug "skipping pattern: $_"; |
176 } | 177 } |
177 | 178 |
178 } | 179 } |
179 close PATTERNS; | 180 close PATTERNS; |
180 | 181 |
181 # create a working copy of the current failures which match the users selection | 182 # create a working copy of the current failures which match the users selection |
182 | 183 |
183 debug "failure filter: ^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_R
EPO=$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$fai
luretesttypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpatter
n, TEST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TE
ST_CPUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST
_RESULT=FAIL[^,]*,/"; | 184 debug "failure filter: ^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_R
EPO=$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$fai
luretesttypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpatter
n, TEST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TE
ST_TIMEZONE=$failuretimezonepattern, TEST_OPTIONS=$failurejsoptionspattern, TEST
_RESULT=FAIL[^,]*,/"; |
184 | 185 |
185 if (defined($rawlogfile)) { | 186 if (defined($rawlogfile)) { |
186 | 187 |
187 $failurelogfile = "$outputprefix-results-failures.log"; | 188 $failurelogfile = "$outputprefix-results-failures.log"; |
188 my $alllog = "$outputprefix-results-all.log"; | 189 my $alllog = "$outputprefix-results-all.log"; |
189 | 190 |
190 debug "writing failures $failurelogfile"; | 191 debug "writing failures $failurelogfile"; |
191 | 192 |
192 open INPUTLOG, "$jsdir/post-process-logs.pl $rawlogfile |" or die "Unable to
open $rawlogfile $!\n"; | 193 open INPUTLOG, "$jsdir/post-process-logs.pl $rawlogfile |" or die "Unable to
open $rawlogfile $!\n"; |
193 open ALLLOG, ">$alllog" or die "Unable to open $alllog $!\n"; | 194 open ALLLOG, ">$alllog" or die "Unable to open $alllog $!\n"; |
194 open FAILURELOG, ">$failurelogfile" or die "Unable to open $failurelogfile $
!\n"; | 195 open FAILURELOG, ">$failurelogfile" or die "Unable to open $failurelogfile $
!\n"; |
195 | 196 |
196 while (<INPUTLOG>) { | 197 while (<INPUTLOG>) { |
197 chomp; | 198 chomp; |
198 | 199 |
199 print ALLLOG "$_\n"; | 200 print ALLLOG "$_\n"; |
200 | 201 |
201 if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=
$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failure
testtypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, T
EST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_C
PUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST_RES
ULT=FAIL[^,]*,/) { | 202 if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=
$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failure
testtypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, T
EST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_T
IMEZONE=$failuretimezonepattern, TEST_OPTIONS=$failurejsoptionspattern, TEST_RES
ULT=FAIL[^,]*,/) { |
202 debug "failure: $_"; | 203 debug "failure: $_"; |
203 push @failures, ($_); | 204 push @failures, ($_); |
204 print FAILURELOG "$_\n"; | 205 print FAILURELOG "$_\n"; |
205 } | 206 } |
206 } | 207 } |
207 close INPUTLOG; | 208 close INPUTLOG; |
208 my $inputrc = $?; | 209 my $inputrc = $?; |
209 close ALLLOG; | 210 close ALLLOG; |
210 close FAILURELOG; | 211 close FAILURELOG; |
211 | 212 |
(...skipping 15 matching lines...) Expand all Loading... |
227 } | 228 } |
228 else | 229 else |
229 { | 230 { |
230 $failurelogfilemode = "<$failurelogfile"; | 231 $failurelogfilemode = "<$failurelogfile"; |
231 } | 232 } |
232 | 233 |
233 open FAILURES, "$failurelogfilemode" or die "Unable to open current failure
log $failurelogfile: $!\n"; | 234 open FAILURES, "$failurelogfilemode" or die "Unable to open current failure
log $failurelogfile: $!\n"; |
234 while (<FAILURES>) { | 235 while (<FAILURES>) { |
235 chomp; | 236 chomp; |
236 | 237 |
237 if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=
$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failure
testtypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, T
EST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_C
PUSPEED=$failurecpuspeedpattern, TEST_TIMEZONE=$failuretimezonepattern, TEST_RES
ULT=FAIL[^,]*,/) { | 238 if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_REPO=
$failurerepopattern, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failure
testtypepattern, TEST_OS=$failureospattern, TEST_KERNEL=$failurekernelpattern, T
EST_PROCESSORTYPE=$failurearchpattern, TEST_MEMORY=$failurememorypattern, TEST_T
IMEZONE=$failuretimezonepattern, TEST_OPTIONS=$failurejsoptionspattern, TEST_RES
ULT=FAIL[^,]*,/) { |
238 debug "failure: $_"; | 239 debug "failure: $_"; |
239 push @failures, ($_); | 240 push @failures, ($_); |
240 } | 241 } |
241 } | 242 } |
242 close FAILURES; | 243 close FAILURES; |
243 } | 244 } |
244 | 245 |
245 debug "finding fixed bugs"; | 246 debug "finding fixed bugs"; |
246 | 247 |
247 unlink "$outputprefix-results-possible-fixes.log"; | 248 unlink "$outputprefix-results-possible-fixes.log"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 297 } |
297 close OUTPUT; | 298 close OUTPUT; |
298 | 299 |
299 print STDOUT "log: $outputprefix-results-possible-fixes.log\n"; | 300 print STDOUT "log: $outputprefix-results-possible-fixes.log\n"; |
300 | 301 |
301 debug "finding regressions"; | 302 debug "finding regressions"; |
302 | 303 |
303 my $pass = 0; | 304 my $pass = 0; |
304 my $changed = ($#patterns != -1); | 305 my $changed = ($#patterns != -1); |
305 | 306 |
| 307 debug "changed=$changed, \$#patterns=$#patterns, \$#failures=$#failures"; |
| 308 |
306 while ($changed) { | 309 while ($changed) { |
307 | 310 |
308 $pass = $pass + 1; | 311 $pass = $pass + 1; |
309 | 312 |
310 $changed = 0; | 313 $changed = 0; |
311 | 314 |
312 debug "pass $pass"; | 315 debug "pass $pass"; |
313 | 316 |
314 foreach $pattern (@patterns) { | 317 foreach $pattern (@patterns) { |
315 | 318 |
(...skipping 13 matching lines...) Expand all Loading... |
329 | 332 |
330 if ($#matches > -1) { | 333 if ($#matches > -1) { |
331 $changed = 1; | 334 $changed = 1; |
332 } | 335 } |
333 | 336 |
334 debug "*****************************************"; | 337 debug "*****************************************"; |
335 } | 338 } |
336 | 339 |
337 } | 340 } |
338 | 341 |
| 342 debug "\$#excludedtests=$#excludedtests, \$#failures=$#failures"; |
| 343 |
339 foreach $excludedtest ( @excludedtests ) { | 344 foreach $excludedtest ( @excludedtests ) { |
340 | 345 |
341 if ($debug) { | 346 if ($debug) { |
342 @results = grep m@$excludedtest@, @failures; | 347 @results = grep m@$excludedtest@, @failures; |
343 if ($#results > -1) { | 348 if ($#results > -1) { |
344 print "excluding: " . (join ', ', @results) . "\n"; | 349 print "excluding: " . (join ', ', @results) . "\n"; |
345 } | 350 } |
346 } | 351 } |
347 | 352 |
348 @results = grep !m@$excludedtest@, @failures; | 353 @results = grep !m@$excludedtest@, @failures; |
349 | 354 |
| 355 debug "\$#results=$#results, \$excludedtest=$excludedtest, \$#failures=$#fai
lures"; |
| 356 |
350 @failures = @results; | 357 @failures = @results; |
351 } | 358 } |
352 | 359 |
| 360 debug "possible regressions: \$#failures=$#failures"; |
| 361 |
353 open OUTPUT, ">$outputprefix-results-possible-regressions.log" or die "Unable to
open $outputprefix-results-possible-regressions.log: $!"; | 362 open OUTPUT, ">$outputprefix-results-possible-regressions.log" or die "Unable to
open $outputprefix-results-possible-regressions.log: $!"; |
354 | 363 |
355 my $failure; | 364 my $failure; |
356 foreach $failure (@failures) { | 365 foreach $failure (@failures) { |
357 print OUTPUT "$failure\n"; | 366 print OUTPUT "$failure\n"; |
358 if ($debug) { | 367 if ($debug) { |
359 debug "regression: $failure"; | 368 debug "regression: $failure"; |
360 } | 369 } |
361 } | 370 } |
362 close OUTPUT; | 371 close OUTPUT; |
(...skipping 16 matching lines...) Expand all Loading... |
379 | 388 |
380 usage: $msg | 389 usage: $msg |
381 | 390 |
382 known-failures.pl [-b|--branch] branch | 391 known-failures.pl [-b|--branch] branch |
383 [-T|--buildtype] buildtype | 392 [-T|--buildtype] buildtype |
384 [-t|--testtype] testtype | 393 [-t|--testtype] testtype |
385 [-o|--os] os | 394 [-o|--os] os |
386 [-K|--kernel] kernel | 395 [-K|--kernel] kernel |
387 [-A|--arch] arch | 396 [-A|--arch] arch |
388 [-M|--memory] memory | 397 [-M|--memory] memory |
389 [-S|--speed] speed | |
390 [-z|--timezone] timezone | 398 [-z|--timezone] timezone |
| 399 [-J|--jsoptions] jsoptions |
391 [-r|--patterns] patterns | 400 [-r|--patterns] patterns |
392 ([-f|--failurelogfile] failurelogfile|[-l|--logfile] rawlogfil
e]) | 401 ([-f|--failurelogfile] failurelogfile|[-l|--logfile] rawlogfil
e]) |
393 [-O|--outputprefix] outputprefix | 402 [-O|--outputprefix] outputprefix |
394 [-D] | 403 [-D] |
395 | 404 |
396 variable description | 405 variable description |
397 =============== ========================================================
==== | 406 =============== ========================================================
==== |
398 -b branch branch 1.8.0, 1.8.1, 1.9.0, all | 407 -b branch branch 1.8.0, 1.8.1, 1.9.0, all |
399 -R repository CVS for 1.8.0, 1.8.1, 1.9.0 branches, | 408 -R repository CVS for 1.8.0, 1.8.1, 1.9.0 branches, |
400 mercurial repository name for 1.9.1 branches | 409 mercurial repository name for 1.9.1 and later branches |
401 (\`basename http://hg.mozilla.org/repository\`) | 410 (\`basename http://hg.mozilla.org/repository\`) |
402 -T buildtype build type opt, debug, all | 411 -T buildtype build type opt, debug, all |
403 -t testtype test type browser, shell, all | 412 -t testtype test type browser, shell, all |
404 -o os operating system nt, darwin, linux, all | 413 -o os operating system nt, darwin, linux, all |
405 -K kernel kernel, all or a specific pattern | 414 -K kernel kernel, all or a specific pattern |
406 -A arch architecture, all or a specific pattern | 415 -A arch architecture, all or a specific pattern |
407 -M memory memory in Gigabytes, all or a specific pattern | 416 -M memory memory in Gigabytes, all or a specific pattern |
408 -S speed speed, all or specific pattern | |
409 -z timezone -0400, -0700, etc. default to user\'s zone | 417 -z timezone -0400, -0700, etc. default to user\'s zone |
| 418 -J jsoptions JavaScript options |
410 -l rawlogfile raw logfile | 419 -l rawlogfile raw logfile |
411 -f failurelogfile failure logfile | 420 -f failurelogfile failure logfile |
412 -r patterns known failure patterns | 421 -r patterns known failure patterns |
413 -O outputprefix output files will be generated with this prefix | 422 -O outputprefix output files will be generated with this prefix |
414 -D turn on debugging output | 423 -D turn on debugging output |
415 EOF | 424 EOF |
416 | 425 |
417 exit(2); | 426 exit(2); |
418 } | 427 } |
419 | 428 |
(...skipping 22 matching lines...) Expand all Loading... |
442 } | 451 } |
443 elsif ($option eq "K") { | 452 elsif ($option eq "K") { |
444 $kernel = $value; | 453 $kernel = $value; |
445 } | 454 } |
446 elsif ($option eq "A") { | 455 elsif ($option eq "A") { |
447 $arch = $value; | 456 $arch = $value; |
448 } | 457 } |
449 elsif ($option eq "M") { | 458 elsif ($option eq "M") { |
450 $memory = $value; | 459 $memory = $value; |
451 } | 460 } |
452 elsif ($option eq "S") { | |
453 $cpuspeed = $value; | |
454 if ($cpuspeed < 4) | |
455 { | |
456 $cpuspeed = 'slow'; | |
457 } | |
458 elsif ($cpuspeed < 9) | |
459 { | |
460 $cpuspeed = 'medium'; | |
461 } | |
462 else | |
463 { | |
464 $cpuspeed = 'fast'; | |
465 } | |
466 } | |
467 elsif ($option eq "z") { | 461 elsif ($option eq "z") { |
468 $timezone = $value; | 462 $timezone = $value; |
469 } | 463 } |
| 464 elsif ($option eq "J") { |
| 465 my (@s, $j); |
| 466 |
| 467 if (! $value) { |
| 468 $jsoptions = 'none'; |
| 469 } |
| 470 else { |
| 471 $value =~ s/(-\w) (\w)/$1$2/g; |
| 472 @s = sort split / /, $value; |
| 473 $j = join(" ", @s); |
| 474 $j =~ s/(-\w)(\w)/$1 $2/g; |
| 475 $jsoptions = $j; |
| 476 } |
| 477 } |
470 elsif ($option eq "r") { | 478 elsif ($option eq "r") { |
471 $patterns = $value; | 479 $patterns = $value; |
472 } | 480 } |
473 elsif ($option eq "l") { | 481 elsif ($option eq "l") { |
474 $rawlogfile = $value; | 482 $rawlogfile = $value; |
475 } | 483 } |
476 elsif ($option eq "f") { | 484 elsif ($option eq "f") { |
477 $failurelogfile = $value; | 485 $failurelogfile = $value; |
478 } | 486 } |
479 elsif ($option eq "O") { | 487 elsif ($option eq "O") { |
480 $outputprefix = $value; | 488 $outputprefix = $value; |
481 } | 489 } |
482 elsif ($option eq "D") { | 490 elsif ($option eq "D") { |
483 $debug = 1; | 491 $debug = 1; |
484 } | 492 } |
485 | 493 |
486 } | 494 } |
487 | 495 |
488 if ($debug) { | 496 if ($debug) { |
489 print "branch=$branch, buildtype=$buildtype, testtype=$testtype, os=$os,
kernel=$kernel, arch=$arch, memory=$memory, cpuspeed=$cpuspeed, timezone=$timez
one, patterns=$patterns, rawlogfile=$rawlogfile failurelogfile=$failurelogfile,
outputprefix=$outputprefix\n"; | 497 print "branch=$branch, buildtype=$buildtype, testtype=$testtype, os=$os,
kernel=$kernel, arch=$arch, memory=$memory, timezone=$timezone, jsoptions=$jsop
tions, patterns=$patterns, rawlogfile=$rawlogfile failurelogfile=$failurelogfile
, outputprefix=$outputprefix\n"; |
490 } | 498 } |
491 Getopt::Mixed::cleanup(); | 499 Getopt::Mixed::cleanup(); |
492 | 500 |
493 if ( !defined($branch) ) { | 501 if ( !defined($branch) ) { |
494 usage "missing branch"; | 502 usage "missing branch"; |
495 } | 503 } |
496 | 504 |
497 if (!defined($buildtype)) { | 505 if (!defined($buildtype)) { |
498 usage "missing buildtype"; | 506 usage "missing buildtype"; |
499 } | 507 } |
500 | 508 |
501 if (!defined($testtype)) { | 509 if (!defined($testtype)) { |
502 usage "missing testtype"; | 510 usage "missing testtype"; |
503 } | 511 } |
504 | 512 |
505 if (!defined($os)) { | 513 if (!defined($os)) { |
506 usage "missing os"; | 514 usage "missing os"; |
507 } | 515 } |
508 | 516 |
509 if (!defined($memory)) { | 517 if (!defined($memory)) { |
510 $memory = 'all'; | 518 $memory = 'all'; |
511 } | 519 } |
512 | 520 |
513 if (!defined($cpuspeed)) { | |
514 $cpuspeed = 'all'; | |
515 } | |
516 | |
517 if (!defined($timezone)) { | 521 if (!defined($timezone)) { |
518 usage "missing timezone"; | 522 usage "missing timezone"; |
519 } | 523 } |
520 | 524 |
| 525 if (!defined($jsoptions)) { |
| 526 $jsoptions = 'none'; |
| 527 } |
| 528 |
521 if (!defined($patterns)) { | 529 if (!defined($patterns)) { |
522 usage "missing patterns"; | 530 usage "missing patterns"; |
523 } | 531 } |
524 | 532 |
525 if (!defined($rawlogfile) && !defined($failurelogfile)) { | 533 if (!defined($rawlogfile) && !defined($failurelogfile)) { |
526 usage "missing logfile"; | 534 usage "missing logfile"; |
527 } | 535 } |
528 | 536 |
529 if (!defined($outputprefix)) { | 537 if (!defined($outputprefix)) { |
530 usage "missing outputprefix"; | 538 usage "missing outputprefix"; |
531 } | 539 } |
532 | 540 |
533 if ($branch eq "1.8.0") { | 541 if ($branch eq "all") { |
534 $knownfailurebranchpattern = "(1\\.8\\.0|\\.\\*)"; | |
535 $failurebranchpattern = "1\\.8\\.0"; | |
536 } | |
537 elsif ($branch eq "1.8.1") { | |
538 $knownfailurebranchpattern = "(1\\.8\\.1|\\.\\*)"; | |
539 $failurebranchpattern = "1\\.8\\.1"; | |
540 } | |
541 elsif ($branch eq "1.9.0") { | |
542 $knownfailurebranchpattern = "(1\\.9\\.0|\\.\\*)"; | |
543 $failurebranchpattern = "1\\.9\\.0"; | |
544 } | |
545 elsif ($branch eq "1.9.1") { | |
546 $knownfailurebranchpattern = "(1\\.9\\.1|\\.\\*)"; | |
547 $failurebranchpattern = "1\\.9\\.1"; | |
548 } | |
549 elsif ($branch eq "all") { | |
550 $knownfailurebranchpattern = "[^,]*"; | 542 $knownfailurebranchpattern = "[^,]*"; |
551 $failurebranchpattern = "[^,]*"; | 543 $failurebranchpattern = "[^,]*"; |
552 } | 544 } |
| 545 else { |
| 546 $knownfailurebranchpattern = "($branch|.*)"; |
| 547 $knownfailurebranchpattern =~ s/\./\\./g; |
| 548 |
| 549 $failurebranchpattern = "$branch"; |
| 550 $failurebranchpattern =~ s/\./\\./g; |
| 551 } |
553 | 552 |
554 if ($repo eq "all" || $repo eq ".*") { | 553 if ($repo eq "all" || $repo eq ".*") { |
555 $knownfailurerepopattern = "[^,]*"; | 554 $knownfailurerepopattern = "[^,]*"; |
556 $failurerepopattern = "[^,]*"; | 555 $failurerepopattern = "[^,]*"; |
557 } | 556 } |
558 else { | 557 else { |
559 $knownfailurerepopattern = "($repo|\\.\\*)"; | 558 $knownfailurerepopattern = "($repo|\\.\\*)"; |
560 $failurerepopattern = "$repo"; | 559 $failurerepopattern = "$repo"; |
561 } | 560 } |
562 | 561 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 622 |
624 if ($memory ne "all") { | 623 if ($memory ne "all") { |
625 $knownfailurememorypattern = "(" . $memory . "|\\.\\*)"; | 624 $knownfailurememorypattern = "(" . $memory . "|\\.\\*)"; |
626 $failurememorypattern = "$memory"; | 625 $failurememorypattern = "$memory"; |
627 } | 626 } |
628 else { | 627 else { |
629 $knownfailurememorypattern = "[^,]*"; | 628 $knownfailurememorypattern = "[^,]*"; |
630 $failurememorypattern = "[^,]*"; | 629 $failurememorypattern = "[^,]*"; |
631 } | 630 } |
632 | 631 |
633 if ($cpuspeed ne "all") { | |
634 $knownfailurecpuspeedpattern = "(" . $cpuspeed . "|\\.\\*)"; | |
635 $failurecpuspeedpattern = "$cpuspeed"; | |
636 } | |
637 else { | |
638 $knownfailurecpuspeedpattern = "[^,]*"; | |
639 $failurecpuspeedpattern = "[^,]*"; | |
640 } | |
641 | |
642 if ($timezone eq "all") { | 632 if ($timezone eq "all") { |
643 $knownfailuretimezonepattern = "[^,]*"; | 633 $knownfailuretimezonepattern = "[^,]*"; |
644 $failuretimezonepattern = "[^,]*"; | 634 $failuretimezonepattern = "[^,]*"; |
645 } | 635 } |
646 else { | 636 else { |
647 $knownfailuretimezonepattern = "(" . $timezone . "|\\.\\*)"; | 637 $knownfailuretimezonepattern = "(" . escape_string($timezone) . "|\\.\\*
)"; |
648 $failuretimezonepattern = "$timezone"; | 638 $failuretimezonepattern = escape_string("$timezone"); |
649 } | 639 } |
650 | 640 |
| 641 if ($jsoptions eq "all") { |
| 642 $knownfailurejsoptionspattern = "[^,]*"; |
| 643 $failurejsoptionspattern = "[^,]*"; |
| 644 } |
| 645 else { |
| 646 $knownfailurejsoptionspattern = "(" . escape_string($jsoptions) . "|\\.\
\*)"; |
| 647 $failurejsoptionspattern = escape_string("$jsoptions"); |
| 648 } |
| 649 |
| 650 } |
| 651 |
| 652 sub escape_string { |
| 653 my $s = shift; |
| 654 |
| 655 # replace unescaped regular expression characters in the |
| 656 # string so they are not interpreted as regexp chars |
| 657 # when matching descriptions. leave the escaped regexp chars |
| 658 # `regexp` alone so they can be unescaped later and used in |
| 659 # pattern matching. |
| 660 |
| 661 # see perldoc perlre |
| 662 |
| 663 $s =~ s/\\/\\\\/g; |
| 664 |
| 665 # escape non word chars that aren't surrounded by `` |
| 666 $s =~ s/(?<!`)([$regchars])(?!`)/\\$1/g; |
| 667 $s =~ s/(?<!`)([$regchars])(?=`)/\\$1/g; |
| 668 $s =~ s/(?<=`)([$regchars])(?!`)/\\$1/g; |
| 669 |
| 670 # unquote the regchars |
| 671 $s =~ s/\`([^\`])\`/$1/g; |
| 672 |
| 673 debug "escape_string : $s"; |
| 674 |
| 675 return "$s"; |
651 | 676 |
652 } | 677 } |
653 | 678 |
654 sub escape_pattern { | 679 sub escape_pattern { |
655 | 680 |
656 my $line = shift; | 681 my $line = shift; |
657 | 682 |
658 chomp; | 683 chomp; |
659 | 684 |
660 my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/; | 685 my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/; |
661 | 686 |
662 # debug "escape_pattern: before: $leading$trailing"; | 687 # debug "escape_pattern: before: $leading$trailing"; |
663 | 688 |
664 # replace unescaped regular expression characters in the | 689 $trailing = escape_string($trailing); |
665 # description so they are not interpreted as regexp chars | |
666 # when matching descriptions. leave the escaped regexp chars | |
667 # `regexp alone so they can be unescaped later and used in | |
668 # pattern matching. | |
669 | |
670 # see perldoc perlre | |
671 | |
672 $trailing =~ s/\\/\\\\/g; | |
673 | |
674 # escape non word chars that aren't surrounded by `` | |
675 $trailing =~ s/(?<!`)([$regchars])(?!`)/\\$1/g; | |
676 $trailing =~ s/(?<!`)([$regchars])(?=`)/\\$1/g; | |
677 $trailing =~ s/(?<=`)([$regchars])(?!`)/\\$1/g; | |
678 # $trailing =~ s/(?<!`)(\W)(?!`)/\\$1/g; | |
679 | |
680 # unquote the regchars | |
681 $trailing =~ s/\`([^\`])\`/$1/g; | |
682 | 690 |
683 debug "escape_pattern : $leading$trailing"; | 691 debug "escape_pattern : $leading$trailing"; |
684 | 692 |
685 return "$leading$trailing"; | 693 return "$leading$trailing"; |
686 | 694 |
687 } | 695 } |
688 | 696 |
689 sub unescape_pattern { | 697 sub unescape_pattern { |
690 my $line = shift; | 698 my $line = shift; |
691 | 699 |
(...skipping 11 matching lines...) Expand all Loading... |
703 | 711 |
704 debug "unescape_pattern: after: $leading$trailing"; | 712 debug "unescape_pattern: after: $leading$trailing"; |
705 | 713 |
706 return "$leading$trailing"; | 714 return "$leading$trailing"; |
707 } | 715 } |
708 | 716 |
709 #### | 717 #### |
710 | 718 |
711 | 719 |
712 1; | 720 1; |
OLD | NEW |