| OLD | NEW |
| 1 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- | 1 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- |
| 2 # ***** BEGIN LICENSE BLOCK ***** | 2 # ***** BEGIN LICENSE BLOCK ***** |
| 3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 # | 4 # |
| 5 # The contents of this file are subject to the Mozilla Public License Version | 5 # The contents of this file are subject to the Mozilla Public License Version |
| 6 # 1.1 (the "License"); you may not use this file except in compliance with | 6 # 1.1 (the "License"); you may not use this file except in compliance with |
| 7 # the License. You may obtain a copy of the License at | 7 # the License. You may obtain a copy of the License at |
| 8 # http://www.mozilla.org/MPL/ | 8 # http://www.mozilla.org/MPL/ |
| 9 # | 9 # |
| 10 # Software distributed under the License is distributed on an "AS IS" basis, | 10 # Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 # ***** END LICENSE BLOCK ***** | 36 # ***** END LICENSE BLOCK ***** |
| 37 | 37 |
| 38 package Patterns; | 38 package Patterns; |
| 39 | 39 |
| 40 sub getuniversekey | 40 sub getuniversekey |
| 41 { | 41 { |
| 42 my ($machinerecord, $excludeduniversefield) = @_; | 42 my ($machinerecord, $excludeduniversefield) = @_; |
| 43 my $i; | 43 my $i; |
| 44 my $key = ''; | 44 my $key = ''; |
| 45 | 45 |
| 46 dbg("getuniversekey: \$machinerecord=" . recordtostring($machinerecord) . ",
\$excludeduniversefield=$excludeduniversefield"); | 46 if ($DEBUG) { |
| 47 dbg("getuniversekey: \$machinerecord=" . recordtostring($machinerecord)
. ", \$excludeduniversefield=$excludeduniversefield"); |
| 48 } |
| 47 | 49 |
| 48 for ($i = 0; $i < @universefields; $i++) | 50 for ($i = 0; $i < @universefields; $i++) |
| 49 { | 51 { |
| 50 dbg("getuniversekey: \$universefields[$i]=$universefields[$i]"); | 52 if ($DEBUG) { |
| 53 dbg("getuniversekey: \$universefields[$i]=$universefields[$i]"); |
| 54 } |
| 51 | 55 |
| 52 if ($universefields[$i] ne $excludeduniversefield) | 56 if ($universefields[$i] ne $excludeduniversefield) |
| 53 { | 57 { |
| 54 $key .= $machinerecord->{$universefields[$i]} | 58 $key .= $machinerecord->{$universefields[$i]} |
| 55 } | 59 } |
| 56 } | 60 } |
| 57 | 61 |
| 58 dbg("getuniversekey=$key"); | 62 if ($DEBUG) { |
| 63 dbg("getuniversekey=$key"); |
| 64 } |
| 59 | 65 |
| 60 return $key; | 66 return $key; |
| 61 } | 67 } |
| 62 | 68 |
| 63 sub getuniverse | 69 sub getuniverse |
| 64 { | 70 { |
| 65 my ($universekey, $excludeduniversefield) = @_; | 71 my ($universekey, $excludeduniversefield) = @_; |
| 66 my $i; | 72 my $i; |
| 67 my $value; | 73 my $value; |
| 68 my $testrun; | 74 my $testrun; |
| 69 my @universe = (); | 75 my @universe = (); |
| 70 my %universehash = (); | 76 my %universehash = (); |
| 71 | 77 |
| 72 dbg("getuniverse: \$universekey=$universekey, \$excludeduniversefield=$exclu
deduniversefield"); | 78 if ($DEBUG) { |
| 79 dbg("getuniverse: \$universekey=$universekey, \$excludeduniversefield=$e
xcludeduniversefield"); |
| 80 } |
| 73 | 81 |
| 74 for ($i = 0; $i < @testruns; $i++) | 82 for ($i = 0; $i < @testruns; $i++) |
| 75 { | 83 { |
| 76 $testrun = $testruns[$i]; | 84 $testrun = $testruns[$i]; |
| 77 dbg("getuniverse: \$testruns[$i]=" . recordtostring($testrun)); | 85 if ($DEBUG) { |
| 86 dbg("getuniverse: \$testruns[$i]=" . recordtostring($testrun)); |
| 87 } |
| 78 $testrununiversekey = getuniversekey($testrun, $excludeduniversefield); | 88 $testrununiversekey = getuniversekey($testrun, $excludeduniversefield); |
| 79 dbg("getuniverse: \$testrununiversekey=$testrununiversekey"); | 89 if ($DEBUG) { |
| 90 dbg("getuniverse: \$testrununiversekey=$testrununiversekey"); |
| 91 } |
| 80 if ($testrununiversekey =~ /$universekey/) | 92 if ($testrununiversekey =~ /$universekey/) |
| 81 { | 93 { |
| 82 dbg("getuniverse: matched \$testrununiversekey=$testrununiversekey t
o \$universekey=$universekey"); | 94 if ($DEBUG) { |
| 95 dbg("getuniverse: matched \$testrununiversekey=$testrununiversek
ey to \$universekey=$universekey"); |
| 96 } |
| 83 $value = $testrun->{$excludeduniversefield}; | 97 $value = $testrun->{$excludeduniversefield}; |
| 84 | 98 |
| 85 dbg("getuniverse: \$testrun->{$excludeduniversefield}=$value"); | 99 if ($DEBUG) { |
| 100 dbg("getuniverse: \$testrun->{$excludeduniversefield}=$value"); |
| 101 } |
| 86 | 102 |
| 87 if (! $universehash{$value} ) | 103 if (! $universehash{$value} ) |
| 88 { | 104 { |
| 89 dbg("getuniverse: pushing $value"); | 105 if ($DEBUG) { |
| 106 dbg("getuniverse: pushing $value"); |
| 107 } |
| 90 push @universe, ($value); | 108 push @universe, ($value); |
| 91 $universehash{$value} = 1; | 109 $universehash{$value} = 1; |
| 92 } | 110 } |
| 93 } | 111 } |
| 94 } | 112 } |
| 95 @universe = sort @universe; | 113 @universe = sort @universe; |
| 96 dbg("getuniverse=" . join(',', @universe)); | 114 if ($DEBUG) { |
| 115 dbg("getuniverse=" . join(',', @universe)); |
| 116 } |
| 97 return @universe; | 117 return @universe; |
| 98 } | 118 } |
| 99 | 119 |
| 100 sub recordtostring | 120 sub recordtostring |
| 101 { | 121 { |
| 102 my ($record) = @_; | 122 my ($record) = @_; |
| 103 my $j; | 123 my $j; |
| 104 my $line = ''; | 124 my $line = ''; |
| 105 my $field; | 125 my $field; |
| 106 | 126 |
| 107 for ($j = 0; $j < @recordfields - 1; $j++) | 127 for ($j = 0; $j < @recordfields - 1; $j++) |
| 108 { | 128 { |
| 109 $field = $recordfields[$j]; | 129 $field = $recordfields[$j]; |
| 110 dbg("recordtostring: \$field=$field, \$record->{$field}=$record->{$field
}"); | 130 if ($DEBUG) { |
| 131 dbg("recordtostring: \$field=$field, \$record->{$field}=$record->{$f
ield}"); |
| 132 } |
| 111 $line .= "$field=$record->{$field}, "; | 133 $line .= "$field=$record->{$field}, "; |
| 112 } | 134 } |
| 113 $field = $recordfields[$#recordfields]; | 135 $field = $recordfields[$#recordfields]; |
| 114 dbg("recordtodtring: \$field=$field, \$record->{$field}= $record->{$field}")
; | 136 if ($DEBUG) { |
| 137 dbg("recordtodtring: \$field=$field, \$record->{$field}= $record->{$fiel
d}"); |
| 138 } |
| 115 $line .= "$field=$record->{$field}"; | 139 $line .= "$field=$record->{$field}"; |
| 116 | 140 |
| 117 return $line; | 141 return $line; |
| 118 } | 142 } |
| 119 | 143 |
| 120 sub dumprecords | 144 sub dumprecords |
| 121 { | 145 { |
| 122 my $record; | 146 my $record; |
| 123 my $line; | 147 my $line; |
| 124 my $prevline = ''; | 148 my $prevline = ''; |
| 125 my $i; | 149 my $i; |
| 126 | 150 |
| 127 dbg("dumping records"); | 151 if ($DEBUG) { |
| 152 dbg("dumping records"); |
| 153 } |
| 128 | 154 |
| 129 # @records = sort sortrecords @records; | 155 # @records = sort sortrecords @records; |
| 130 | 156 |
| 131 for ($i = 0; $i < @records; $i++) | 157 for ($i = 0; $i < @records; $i++) |
| 132 { | 158 { |
| 133 $record = $records[$i]; | 159 $record = $records[$i]; |
| 134 $line = recordtostring($record); | 160 $line = recordtostring($record); |
| 135 if ($line eq $prevline) | 161 if ($line eq $prevline) |
| 136 { | 162 { |
| 137 dbg("DUPLICATE $line") if ($DEBUG); | 163 dbg("DUPLICATE $line") if ($DEBUG); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 197 } |
| 172 | 198 |
| 173 BEGIN | 199 BEGIN |
| 174 { | 200 { |
| 175 dbg("begin"); | 201 dbg("begin"); |
| 176 | 202 |
| 177 my $test_dir = $ENV{TEST_DIR} || "/work/mozilla/mozilla.com/test.mozilla.com
/www"; | 203 my $test_dir = $ENV{TEST_DIR} || "/work/mozilla/mozilla.com/test.mozilla.com
/www"; |
| 178 | 204 |
| 179 $DEBUG = $ENV{DEBUG}; | 205 $DEBUG = $ENV{DEBUG}; |
| 180 | 206 |
| 181 @recordfields = ('TEST_ID', 'TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE',
'TEST_TYPE', 'TEST_OS', 'TEST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TES
T_CPUSPEED', 'TEST_TIMEZONE', 'TEST_RESULT', 'TEST_EXITSTATUS', 'TEST_DESCRIPTIO
N'); | 207 @recordfields = ('TEST_ID', 'TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE',
'TEST_TYPE', 'TEST_OS', 'TEST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TES
T_TIMEZONE', 'TEST_OPTIONS', 'TEST_RESULT', 'TEST_EXITSTATUS', 'TEST_DESCRIPTION
'); |
| 182 @sortkeyfields = ('TEST_ID', 'TEST_RESULT', 'TEST_EXITSTATUS', 'TEST_DESCRI
PTION', 'TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE', 'TEST_TYPE', 'TEST_OS', 'T
EST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TEST_CPUSPEED', 'TEST_TIMEZON
E', ); | 208 @sortkeyfields = ('TEST_ID', 'TEST_RESULT', 'TEST_EXITSTATUS', 'TEST_DESCRI
PTION', 'TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE', 'TEST_TYPE', 'TEST_OS', 'T
EST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TEST_TIMEZONE', 'TEST_OPTIONS
'); |
| 183 @universefields = ('TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE', 'TEST_TYPE'
, 'TEST_OS', 'TEST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TEST_CPUSPEED'
, 'TEST_TIMEZONE'); | 209 @universefields = ('TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE', 'TEST_TYPE'
, 'TEST_OS', 'TEST_KERNEL', 'TEST_PROCESSORTYPE', 'TEST_MEMORY', 'TEST_TIMEZONE'
, 'TEST_OPTIONS'); |
| 184 | 210 |
| 185 @records = (); | 211 @records = (); |
| 186 | 212 |
| 187 @testruns = (); | 213 @testruns = (); |
| 188 | 214 |
| 189 my $UNIVERSE = $ENV{TEST_UNIVERSE} || "$test_dir/tests/mozilla.org/js/univer
se.data"; | 215 my $UNIVERSE = $ENV{TEST_UNIVERSE} || "$test_dir/tests/mozilla.org/js/univer
se.data"; |
| 190 | 216 |
| 191 dbg "UNIVERSE=$UNIVERSE"; | 217 dbg "UNIVERSE=$UNIVERSE"; |
| 192 | 218 |
| 193 open TESTRUNS, "<$UNIVERSE" or die "$?"; | 219 open TESTRUNS, "<$UNIVERSE" or die "$?"; |
| 194 | 220 |
| 195 while (<TESTRUNS>) { | 221 while (<TESTRUNS>) { |
| 196 | 222 |
| 197 chomp; | 223 chomp; |
| 198 | 224 |
| 199 dbg("BEGIN: \$_=$_\n"); | 225 dbg("BEGIN: \$_=$_\n"); |
| 200 | 226 |
| 201 my $record = {}; | 227 my $record = {}; |
| 202 | 228 |
| 203 my ($test_os, $test_kernel, $test_processortype, $test_memory, $test_cpu
speed, $test_timezone, $test_branch, $test_repo, $test_buildtype, $test_type) =
$_ =~ | 229 my ($test_os, $test_kernel, $test_processortype, $test_memory, $test_tim
ezone, $test_jsoptions, $test_branch, $test_repo, $test_buildtype, $test_type) =
$_ =~ |
| 204 /^TEST_OS=([^,]*), TEST_KERNEL=([^,]*), TEST_PROCESSORTYPE=([^,]*),
TEST_MEMORY=([^,]*), TEST_CPUSPEED=([^,]*), TEST_TIMEZONE=([^,]*), TEST_BRANCH=(
[^,]*), TEST_REPO=([^,]*), TEST_BUILDTYPE=([^,]*), TEST_TYPE=([^,]*)/; | 230 /^TEST_OS=([^,]*), TEST_KERNEL=([^,]*), TEST_PROCESSORTYPE=([^,]*),
TEST_MEMORY=([^,]*), TEST_TIMEZONE=([^,]*), TEST_OPTIONS=([^,]*), TEST_BRANCH=([
^,]*), TEST_REPO=([^,]*), TEST_BUILDTYPE=([^,]*), TEST_TYPE=([^,]*)/; |
| 205 | 231 |
| 206 $record->{TEST_ID} = 'dummy'; | 232 $record->{TEST_ID} = 'dummy'; |
| 207 $record->{TEST_RESULT} = 'dummy'; | 233 $record->{TEST_RESULT} = 'dummy'; |
| 208 $record->{TEST_EXITSTATUS} = 'dummy'; | 234 $record->{TEST_EXITSTATUS} = 'dummy'; |
| 209 $record->{TEST_DESCRIPTION} = 'dummy'; | 235 $record->{TEST_DESCRIPTION} = 'dummy'; |
| 210 | 236 |
| 211 $record->{TEST_BRANCH} = $test_branch; | 237 $record->{TEST_BRANCH} = $test_branch; |
| 212 $record->{TEST_REPO} = $test_repo; | 238 $record->{TEST_REPO} = $test_repo; |
| 213 $record->{TEST_BUILDTYPE} = $test_buildtype; | 239 $record->{TEST_BUILDTYPE} = $test_buildtype; |
| 214 $record->{TEST_TYPE} = $test_type; | 240 $record->{TEST_TYPE} = $test_type; |
| 215 $record->{TEST_OS} = $test_os; | 241 $record->{TEST_OS} = $test_os; |
| 216 $record->{TEST_KERNEL} = $test_kernel; | 242 $record->{TEST_KERNEL} = $test_kernel; |
| 217 $record->{TEST_PROCESSORTYPE} = $test_processortype; | 243 $record->{TEST_PROCESSORTYPE} = $test_processortype; |
| 218 $record->{TEST_MEMORY} = $test_memory; | 244 $record->{TEST_MEMORY} = $test_memory; |
| 219 $record->{TEST_CPUSPEED} = $test_cpuspeed; | |
| 220 $record->{TEST_TIMEZONE} = $test_timezone; | 245 $record->{TEST_TIMEZONE} = $test_timezone; |
| 246 $record->{TEST_OPTIONS} = $test_jsoptions; |
| 221 | 247 |
| 222 dbg("BEGIN: testrun: " . recordtostring($record)); | 248 dbg("BEGIN: testrun: " . recordtostring($record)); |
| 223 | 249 |
| 224 push @testruns, ($record); | 250 push @testruns, ($record); |
| 225 } | 251 } |
| 226 | 252 |
| 227 close TESTRUNS; | 253 close TESTRUNS; |
| 228 | 254 |
| 229 } | 255 } |
| 230 | 256 |
| 231 1; | 257 1; |
| OLD | NEW |