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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 sub processfile | 54 sub processfile |
55 { | 55 { |
56 my ($i, $j); | 56 my ($i, $j); |
57 | 57 |
58 while (<ARGV>) { | 58 while (<ARGV>) { |
59 | 59 |
60 chomp; | 60 chomp; |
61 | 61 |
62 $record = {}; | 62 $record = {}; |
63 | 63 |
64 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) = $_ =~ | 64 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) = $_ =~ |
65 /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=(.*)/; | 65 /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=(.*)/; |
66 | 66 |
67 $record->{TEST_ID} = $test_id; | 67 $record->{TEST_ID} = $test_id; |
68 $record->{TEST_BRANCH} = $test_branch; | 68 $record->{TEST_BRANCH} = $test_branch; |
69 $record->{TEST_REPO} = $test_repo; | 69 $record->{TEST_REPO} = $test_repo; |
70 $record->{TEST_BUILDTYPE} = $test_buildtype; | 70 $record->{TEST_BUILDTYPE} = $test_buildtype; |
71 $record->{TEST_TYPE} = $test_type; | 71 $record->{TEST_TYPE} = $test_type; |
72 $record->{TEST_OS} = $test_os; | 72 $record->{TEST_OS} = $test_os; |
73 $record->{TEST_KERNEL} = $test_kernel; | 73 $record->{TEST_KERNEL} = $test_kernel; |
74 $record->{TEST_PROCESSORTYPE} = $test_processortype; | 74 $record->{TEST_PROCESSORTYPE} = $test_processortype; |
75 $record->{TEST_MEMORY} = $test_memory; | 75 $record->{TEST_MEMORY} = $test_memory; |
76 $record->{TEST_CPUSPEED} = $test_cpuspeed; | |
77 $record->{TEST_TIMEZONE} = $test_timezone; | 76 $record->{TEST_TIMEZONE} = $test_timezone; |
| 77 $record->{TEST_OPTIONS} = $test_options; |
78 $record->{TEST_RESULT} = $test_result; | 78 $record->{TEST_RESULT} = $test_result; |
79 $record->{TEST_EXITSTATUS} = $test_exitstatus; | 79 $record->{TEST_EXITSTATUS} = $test_exitstatus; |
80 $record->{TEST_DESCRIPTION} = $test_description; | 80 $record->{TEST_DESCRIPTION} = $test_description; |
81 | 81 |
82 dbg("processfile: \$_=$_"); | 82 if ($DEBUG) { |
| 83 dbg("processfile: \$_=$_"); |
| 84 } |
83 | 85 |
84 my @list1 = (); | 86 my @list1 = (); |
85 my @list2 = (); | 87 my @list2 = (); |
86 | 88 |
87 my $iuniversefield; | 89 my $iuniversefield; |
88 my $universefield; | 90 my $universefield; |
89 | 91 |
90 $item1 = copyreference($record); | 92 $item1 = copyreference($record); |
91 dbg("processfile: check copyreference"); | 93 if ($DEBUG) { |
92 dbg("processfile: \$record=" . recordtostring($record)); | 94 dbg("processfile: check copyreference"); |
93 dbg("processfile: \$item1=" . recordtostring($item1)); | 95 dbg("processfile: \$record=" . recordtostring($record)); |
94 | 96 dbg("processfile: \$item1=" . recordtostring($item1)); |
| 97 } |
95 push @list1, ($item1); | 98 push @list1, ($item1); |
96 | 99 |
97 for ($iuniversefield = 0; $iuniversefield < @universefields; $iuniversef
ield++) | 100 for ($iuniversefield = 0; $iuniversefield < @universefields; $iuniversef
ield++) |
98 { | 101 { |
99 $universefield = $universefields[$iuniversefield]; | 102 $universefield = $universefields[$iuniversefield]; |
100 | 103 |
101 dbg("processfile: \$universefields[$iuniversefield]=$universefield,
\$record->{$universefield}=$record->{$universefield}"); | 104 if ($DEBUG) { |
| 105 dbg("processfile: \$universefields[$iuniversefield]=$universefie
ld, \$record->{$universefield}=$record->{$universefield}"); |
| 106 } |
102 | 107 |
103 for ($j = 0; $j < @list1; $j++) | 108 for ($j = 0; $j < @list1; $j++) |
104 { | 109 { |
105 $item1 = $list1[$j]; | 110 $item1 = $list1[$j]; |
106 dbg("processfile: item1 \$list1[$j]=" . recordtostring($item1)); | 111 if ($DEBUG) { |
| 112 dbg("processfile: item1 \$list1[$j]=" . recordtostring($item
1)); |
| 113 } |
107 # create a reference to a copy of the hash referenced by $item1 | 114 # create a reference to a copy of the hash referenced by $item1 |
108 if ($item1->{$universefield} ne '.*') | 115 if ($item1->{$universefield} ne '.*') |
109 { | 116 { |
110 dbg("processfile: literal value"); | 117 if ($DEBUG) { |
| 118 dbg("processfile: literal value"); |
| 119 } |
111 $item2 = copyreference($item1); | 120 $item2 = copyreference($item1); |
112 dbg("processfile: check copyreference"); | 121 if ($DEBUG) { |
113 dbg("processfile: \$item1=" . recordtostring($item1)); | 122 dbg("processfile: check copyreference"); |
114 dbg("processfile: \$item2=" . recordtostring($item2)); | 123 dbg("processfile: \$item1=" . recordtostring($item1)); |
115 dbg("processfile: pushing existing record to list 2: " . rec
ordtostring($item2)); | 124 dbg("processfile: \$item2=" . recordtostring($item2)); |
| 125 dbg("processfile: pushing existing record to list 2: " .
recordtostring($item2)); |
| 126 } |
116 push @list2, ($item2); | 127 push @list2, ($item2); |
117 } | 128 } |
118 else | 129 else |
119 { | 130 { |
120 dbg("processfile: wildcard value"); | 131 if ($DEBUG) { |
| 132 dbg("processfile: wildcard value"); |
| 133 } |
121 $keyfielduniversekey = getuniversekey($item1, $universefield
); | 134 $keyfielduniversekey = getuniversekey($item1, $universefield
); |
122 @keyfielduniverse = getuniverse($keyfielduniversekey, $unive
rsefield); | 135 @keyfielduniverse = getuniverse($keyfielduniversekey, $unive
rsefield); |
123 | 136 |
124 dbg("processfile: \$keyfielduniversekey=$keyfielduniversekey
, \@keyfielduniverse=" . join(',', @keyfielduniverse)); | 137 if ($DEBUG) { |
| 138 dbg("processfile: \$keyfielduniversekey=$keyfieldunivers
ekey, \@keyfielduniverse=" . join(',', @keyfielduniverse)); |
| 139 } |
125 | 140 |
126 for ($i = 0; $i < @keyfielduniverse; $i++) | 141 for ($i = 0; $i < @keyfielduniverse; $i++) |
127 { | 142 { |
128 $item2 = copyreference($item1); | 143 $item2 = copyreference($item1); |
129 dbg("processfile: check copyreference"); | 144 if ($DEBUG) { |
130 dbg("processfile: \$item1=" . recordtostring($item1)); | 145 dbg("processfile: check copyreference"); |
131 dbg("processfile: \$item2=" . recordtostring($item2)); | 146 dbg("processfile: \$item1=" . recordtostring($item1)
); |
| 147 dbg("processfile: \$item2=" . recordtostring($item2)
); |
| 148 } |
132 $item2->{$universefield} = $keyfielduniverse[$i]; | 149 $item2->{$universefield} = $keyfielduniverse[$i]; |
133 dbg("processfile: pushing new record to list 2 " . recor
dtostring($item2)); | 150 if ($DEBUG) { |
| 151 dbg("processfile: pushing new record to list 2 " . r
ecordtostring($item2)); |
| 152 } |
134 push @list2, ($item2); | 153 push @list2, ($item2); |
135 } | 154 } |
136 } | 155 } |
137 for ($i = 0; $i < @list1; $i++) | 156 if ($DEBUG) { |
138 { | 157 for ($i = 0; $i < @list1; $i++) |
139 dbg("processfile: \$list1[$i]=" . recordtostring($list1[$i])
); | 158 { |
140 } | 159 dbg("processfile: \$list1[$i]=" . recordtostring($list1[
$i])); |
141 for ($i = 0; $i < @list2; $i++) | 160 } |
142 { | 161 for ($i = 0; $i < @list2; $i++) |
143 dbg("processfile: \$list2[$i]=" . recordtostring($list2[$i])
); | 162 { |
| 163 dbg("processfile: \$list2[$i]=" . recordtostring($list2[
$i])); |
| 164 } |
144 } | 165 } |
145 } | 166 } |
146 | 167 |
147 @list1 = @list2; | 168 @list1 = @list2; |
148 @list2 = (); | 169 @list2 = (); |
149 } | 170 } |
150 for ($j = 0; $j < @list1; $j++) | 171 for ($j = 0; $j < @list1; $j++) |
151 { | 172 { |
152 $item1 = $list1[$j]; | 173 $item1 = $list1[$j]; |
153 push @records, ($item1); | 174 push @records, ($item1); |
154 } | 175 } |
155 } | 176 } |
156 @records = sort sortrecords @records; | 177 @records = sort sortrecords @records; |
157 | 178 |
158 dumprecords(); | 179 dumprecords(); |
159 } | 180 } |
160 | 181 |
OLD | NEW |