| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
| 2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- | 2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*- |
| 3 # ***** BEGIN LICENSE BLOCK ***** | 3 # ***** BEGIN LICENSE BLOCK ***** |
| 4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 5 # | 5 # |
| 6 # The contents of this file are subject to the Mozilla Public License Version | 6 # The contents of this file are subject to the Mozilla Public License Version |
| 7 # 1.1 (the "License"); you may not use this file except in compliance with | 7 # 1.1 (the "License"); you may not use this file except in compliance with |
| 8 # the License. You may obtain a copy of the License at | 8 # the License. You may obtain a copy of the License at |
| 9 # http://www.mozilla.org/MPL/ | 9 # http://www.mozilla.org/MPL/ |
| 10 # | 10 # |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 my $i; | 68 my $i; |
| 69 my $j; | 69 my $j; |
| 70 my $v; | 70 my $v; |
| 71 | 71 |
| 72 while (<ARGV>) { | 72 while (<ARGV>) { |
| 73 | 73 |
| 74 chomp; | 74 chomp; |
| 75 | 75 |
| 76 $recordcurr = {}; | 76 $recordcurr = {}; |
| 77 | 77 |
| 78 my ($test_id, $test_branch, $test_repo, $test_buildtype, $test_type, $te
st_os, $test_kernel, $test_processortype, $test_memory, $test_cpuspeed, $test_ti
mezone, $test_result, $test_exitstatus, $test_description) = $_ =~ | 78 my ($test_id, $test_branch, $test_repo, $test_buildtype, $test_type, $te
st_os, $test_kernel, $test_processortype, $test_memory, $test_timezone, $test_op
tions, $test_result, $test_exitstatus, $test_description) = $_ =~ |
| 79 /TEST_ID=([^,]*), TEST_BRANCH=([^,]*), TEST_REPO=([^,]*), TEST_BUILD
TYPE=([^,]*), TEST_TYPE=([^,]*), TEST_OS=([^,]*), TEST_KERNEL=([^,]*), TEST_PROC
ESSORTYPE=([^,]*), TEST_MEMORY=([^,]*), TEST_CPUSPEED=([^,]*), TEST_TIMEZONE=([^
,]*), TEST_RESULT=([^,]*), TEST_EXITSTATUS=([^,]*), TEST_DESCRIPTION=(.*)/; | 79 /TEST_ID=([^,]*), TEST_BRANCH=([^,]*), TEST_REPO=([^,]*), TEST_BUILD
TYPE=([^,]*), TEST_TYPE=([^,]*), TEST_OS=([^,]*), TEST_KERNEL=([^,]*), TEST_PROC
ESSORTYPE=([^,]*), TEST_MEMORY=([^,]*), TEST_TIMEZONE=([^,]*), TEST_OPTIONS=([^,
]*), TEST_RESULT=([^,]*), TEST_EXITSTATUS=([^,]*), TEST_DESCRIPTION=(.*)/; |
| 80 | 80 |
| 81 $recordcurr->{TEST_ID} = $test_id; | 81 $recordcurr->{TEST_ID} = $test_id; |
| 82 $recordcurr->{TEST_BRANCH} = $test_branch; | 82 $recordcurr->{TEST_BRANCH} = $test_branch; |
| 83 $recordcurr->{TEST_REPO} = $test_repo; | 83 $recordcurr->{TEST_REPO} = $test_repo; |
| 84 $recordcurr->{TEST_BUILDTYPE} = $test_buildtype; | 84 $recordcurr->{TEST_BUILDTYPE} = $test_buildtype; |
| 85 $recordcurr->{TEST_TYPE} = $test_type; | 85 $recordcurr->{TEST_TYPE} = $test_type; |
| 86 $recordcurr->{TEST_OS} = $test_os; | 86 $recordcurr->{TEST_OS} = $test_os; |
| 87 $recordcurr->{TEST_KERNEL} = $test_kernel; | 87 $recordcurr->{TEST_KERNEL} = $test_kernel; |
| 88 $recordcurr->{TEST_PROCESSORTYPE} = $test_processortype; | 88 $recordcurr->{TEST_PROCESSORTYPE} = $test_processortype; |
| 89 $recordcurr->{TEST_MEMORY} = $test_memory; | 89 $recordcurr->{TEST_MEMORY} = $test_memory; |
| 90 $recordcurr->{TEST_CPUSPEED} = $test_cpuspeed; | |
| 91 $recordcurr->{TEST_TIMEZONE} = $test_timezone; | 90 $recordcurr->{TEST_TIMEZONE} = $test_timezone; |
| 91 $recordcurr->{TEST_OPTIONS} = $test_options; |
| 92 $recordcurr->{TEST_RESULT} = $test_result; | 92 $recordcurr->{TEST_RESULT} = $test_result; |
| 93 $recordcurr->{TEST_EXITSTATUS} = $test_exitstatus; | 93 $recordcurr->{TEST_EXITSTATUS} = $test_exitstatus; |
| 94 $recordcurr->{TEST_DESCRIPTION} = $test_description; | 94 $recordcurr->{TEST_DESCRIPTION} = $test_description; |
| 95 | 95 |
| 96 push @records, ($recordcurr); | 96 push @records, ($recordcurr); |
| 97 } | 97 } |
| 98 | 98 |
| 99 for ($j = $#universefields; $j >= 0; $j--) | 99 for ($j = $#universefields; $j >= 0; $j--) |
| 100 { | 100 { |
| 101 $universefield = $universefields[$j]; | 101 $universefield = $universefields[$j]; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 123 dbg("processfile: \$keycurr=$keycurr"); | 123 dbg("processfile: \$keycurr=$keycurr"); |
| 124 | 124 |
| 125 if ($keycurr ne $keyprev) | 125 if ($keycurr ne $keyprev) |
| 126 { | 126 { |
| 127 # key changed, must output previous record | 127 # key changed, must output previous record |
| 128 dbg("processfile: new key"); | 128 dbg("processfile: new key"); |
| 129 $universefielduniversekey = getuniversekey($recordprev, $univers
efield); | 129 $universefielduniversekey = getuniversekey($recordprev, $univers
efield); |
| 130 @universefielduniverse = getuniverse($universefielduniversekey,
$universefield); | 130 @universefielduniverse = getuniverse($universefielduniversekey,
$universefield); |
| 131 dbg("processfile: \@values: ". join(',', @values)); | 131 dbg("processfile: \@values: ". join(',', @values)); |
| 132 dbg("processfile: \$universefielduniversekey=$universefieldunive
rsekey, \@universefielduniverse=" . join(',', @universefielduniverse)); | 132 dbg("processfile: \$universefielduniversekey=$universefieldunive
rsekey, \@universefielduniverse=" . join(',', @universefielduniverse)); |
| 133 @values = ('.*') if (arraysequal(\@values, \@universefielduniver
se)); | 133 @values = ('.*') if (arraysequal($universefield, \@values, \@uni
versefielduniverse)); |
| 134 dbg("processfile: \@values=" . join(',', @values)); | 134 dbg("processfile: \@values=" . join(',', @values)); |
| 135 | 135 |
| 136 for ($v = 0; $v < @values; $v++) | 136 for ($v = 0; $v < @values; $v++) |
| 137 { | 137 { |
| 138 dbg("processfile: stuffing $values[$v]"); | 138 dbg("processfile: stuffing $values[$v]"); |
| 139 $recordtemp = copyreference($recordprev); | 139 $recordtemp = copyreference($recordprev); |
| 140 $recordtemp->{$universefield} = $values[$v]; | 140 $recordtemp->{$universefield} = $values[$v]; |
| 141 dbg("processfile: stuffed $recordtemp->{$universefield}"); | 141 dbg("processfile: stuffed $recordtemp->{$universefield}"); |
| 142 dbg("processfile: recordprev: " . recordtostring($recordprev
)); | 142 dbg("processfile: recordprev: " . recordtostring($recordprev
)); |
| 143 dbg("processfile: output: " . recordtostring($recordtemp)); | 143 dbg("processfile: output: " . recordtostring($recordtemp)); |
| 144 push @output, ($recordtemp); | 144 push @output, ($recordtemp); |
| 145 } | 145 } |
| 146 @values = (); | 146 @values = (); |
| 147 } | 147 } |
| 148 dbg("processfile: collecting \$recordcurr->{$universefield}=$recordc
urr->{$universefield}"); | 148 dbg("processfile: collecting \$recordcurr->{$universefield}=$recordc
urr->{$universefield}"); |
| 149 push @values, ($recordcurr->{$universefield}); | 149 push @values, ($recordcurr->{$universefield}); |
| 150 $keyprev = $keycurr; | 150 $keyprev = $keycurr; |
| 151 $recordprev = $recordcurr; | 151 $recordprev = $recordcurr; |
| 152 } | 152 } |
| 153 dbg("processfile: finish processing records for \$universefields[$j]=$un
iversefield"); | 153 dbg("processfile: finish processing records for \$universefields[$j]=$un
iversefield"); |
| 154 if (@values) | 154 if (@values) |
| 155 { | 155 { |
| 156 dbg("processfile: last record for \$universefields[$j]=$universefiel
d has pending values"); | 156 dbg("processfile: last record for \$universefields[$j]=$universefiel
d has pending values"); |
| 157 $universefielduniversekey = getuniversekey($recordprev, $universefie
ld); | 157 $universefielduniversekey = getuniversekey($recordprev, $universefie
ld); |
| 158 @universefielduniverse = getuniverse($universefielduniversekey, $uni
versefield); | 158 @universefielduniverse = getuniverse($universefielduniversekey, $uni
versefield); |
| 159 dbg("processfile: \@values: ". join(',', @values)); | 159 dbg("processfile: \@values: ". join(',', @values)); |
| 160 dbg("processfile: \$universefielduniversekey=$universefielduniversek
ey, \@universefielduniverse=" . join(',', @universefielduniverse)); | 160 dbg("processfile: \$universefielduniversekey=$universefielduniversek
ey, \@universefielduniverse=" . join(',', @universefielduniverse)); |
| 161 @values = ('.*') if (arraysequal(\@values, \@universefielduniverse))
; | 161 @values = ('.*') if (arraysequal($universefield, \@values, \@univers
efielduniverse)); |
| 162 dbg("processfile: \@values=" . join(',', @values)); | 162 dbg("processfile: \@values=" . join(',', @values)); |
| 163 | 163 |
| 164 for ($v = 0; $v < @values; $v++) | 164 for ($v = 0; $v < @values; $v++) |
| 165 { | 165 { |
| 166 dbg("processfile: stuffing $values[$v]"); | 166 dbg("processfile: stuffing $values[$v]"); |
| 167 $recordtemp = copyreference($recordprev); | 167 $recordtemp = copyreference($recordprev); |
| 168 $recordtemp->{$universefield} = $values[$v]; | 168 $recordtemp->{$universefield} = $values[$v]; |
| 169 dbg("processfile: stuffed $recordprev->{$universefield}"); | 169 dbg("processfile: stuffed $recordprev->{$universefield}"); |
| 170 dbg("processfile: recordprev: " . recordtostring($recordprev)); | 170 dbg("processfile: recordprev: " . recordtostring($recordprev)); |
| 171 dbg("processfile: output: " . recordtostring($recordtemp)); | 171 dbg("processfile: output: " . recordtostring($recordtemp)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 195 if ($sortkeyfields[$i] ne $universefield) | 195 if ($sortkeyfields[$i] ne $universefield) |
| 196 { | 196 { |
| 197 $key .= $record->{$sortkeyfields[$i]} | 197 $key .= $record->{$sortkeyfields[$i]} |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 return $key; | 200 return $key; |
| 201 } | 201 } |
| 202 | 202 |
| 203 sub arraysequal | 203 sub arraysequal |
| 204 { | 204 { |
| 205 my ($larrayref, $rarrayref) = @_; | 205 my ($universefield, $larrayref, $rarrayref) = @_; |
| 206 my $i; | 206 my $i; |
| 207 | 207 |
| 208 dbg("arraysequal: checking if " . (join ',', @{$larrayref}) . " is equal to
" . (join ',', @{$rarrayref})); | 208 dbg("arraysequal: checking $universefield if " . (join ',', @{$larrayref}) .
" is equal to " . (join ',', @{$rarrayref})); |
| 209 |
| 210 # fail if lengths not equal |
| 209 return 0 if (@{$larrayref} != @{$rarrayref}); | 211 return 0 if (@{$larrayref} != @{$rarrayref}); |
| 210 | 212 |
| 213 # if the universe field is 'important', fail if lengths are 1, |
| 214 # so that important field singletons are not replaced by wildcards. |
| 215 my @importantfields = ('TEST_BRANCH', 'TEST_REPO', 'TEST_BUILDTYPE', 'TEST_T
YPE', 'TEST_OS'); |
| 216 my @matches = grep /$universefield/, @importantfields; |
| 217 |
| 218 return 0 if ( @matches && @{$larrayref} == 1); |
| 219 |
| 211 for ($i = 0; $i < @{$larrayref}; $i++) | 220 for ($i = 0; $i < @{$larrayref}; $i++) |
| 212 { | 221 { |
| 213 return 0 if ($rarrayref->[$i] ne $larrayref->[$i]); | 222 return 0 if ($rarrayref->[$i] ne $larrayref->[$i]); |
| 214 } | 223 } |
| 215 dbg("arraysequal: equal"); | 224 dbg("arraysequal: equal"); |
| 216 return 1; | 225 return 1; |
| 217 } | 226 } |
| 218 | 227 |
| OLD | NEW |