2 # -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
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
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is Mozilla JavaScript Testing Utilities
18 # The Initial Developer of the Original Code is
19 # Mozilla Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 2008
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s): Bob Clary <bclary@bclary.com>
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 # usage: pattern-expander.pl knownfailures > knownfailures.expanded
41 # pattern-expander.pl reads the specified knownfailures file and
42 # writes to stdout an expanded set of failures where the wildcards
43 # ".*" are replaced with the set of possible values specified in the
46 use lib $ENV{TEST_DIR} . "/tests/mozilla.org/js";
64 my ($test_id, $test_branch, $test_repo, $test_buildtype, $test_type, $test_os, $test_kernel, $test_processortype, $test_memory, $test_timezone, $test_options, $test_result, $test_exitstatus, $test_description) = $_ =~
65 /TEST_ID=([^,]*), TEST_BRANCH=([^,]*), TEST_REPO=([^,]*), TEST_BUILDTYPE=([^,]*), TEST_TYPE=([^,]*), TEST_OS=([^,]*), TEST_KERNEL=([^,]*), TEST_PROCESSORTYPE=([^,]*), TEST_MEMORY=([^,]*), TEST_TIMEZONE=([^,]*), TEST_OPTIONS=([^,]*), TEST_RESULT=([^,]*), TEST_EXITSTATUS=([^,]*), TEST_DESCRIPTION=(.*)/;
67 $record->{TEST_ID} = $test_id;
68 $record->{TEST_BRANCH} = $test_branch;
69 $record->{TEST_REPO} = $test_repo;
70 $record->{TEST_BUILDTYPE} = $test_buildtype;
71 $record->{TEST_TYPE} = $test_type;
72 $record->{TEST_OS} = $test_os;
73 $record->{TEST_KERNEL} = $test_kernel;
74 $record->{TEST_PROCESSORTYPE} = $test_processortype;
75 $record->{TEST_MEMORY} = $test_memory;
76 $record->{TEST_TIMEZONE} = $test_timezone;
77 $record->{TEST_OPTIONS} = $test_options;
78 $record->{TEST_RESULT} = $test_result;
79 $record->{TEST_EXITSTATUS} = $test_exitstatus;
80 $record->{TEST_DESCRIPTION} = $test_description;
83 dbg("processfile: \$_=$_");
92 $item1 = copyreference($record);
94 dbg("processfile: check copyreference");
95 dbg("processfile: \$record=" . recordtostring($record));
96 dbg("processfile: \$item1=" . recordtostring($item1));
98 push @list1, ($item1);
100 for ($iuniversefield = 0; $iuniversefield < @universefields; $iuniversefield++)
102 $universefield = $universefields[$iuniversefield];
105 dbg("processfile: \$universefields[$iuniversefield]=$universefield, \$record->{$universefield}=$record->{$universefield}");
108 for ($j = 0; $j < @list1; $j++)
112 dbg("processfile: item1 \$list1[$j]=" . recordtostring($item1));
114 # create a reference to a copy of the hash referenced by $item1
115 if ($item1->{$universefield} ne '.*')
118 dbg("processfile: literal value");
120 $item2 = copyreference($item1);
122 dbg("processfile: check copyreference");
123 dbg("processfile: \$item1=" . recordtostring($item1));
124 dbg("processfile: \$item2=" . recordtostring($item2));
125 dbg("processfile: pushing existing record to list 2: " . recordtostring($item2));
127 push @list2, ($item2);
132 dbg("processfile: wildcard value");
134 $keyfielduniversekey = getuniversekey($item1, $universefield);
135 @keyfielduniverse = getuniverse($keyfielduniversekey, $universefield);
138 dbg("processfile: \$keyfielduniversekey=$keyfielduniversekey, \@keyfielduniverse=" . join(',', @keyfielduniverse));
141 for ($i = 0; $i < @keyfielduniverse; $i++)
143 $item2 = copyreference($item1);
145 dbg("processfile: check copyreference");
146 dbg("processfile: \$item1=" . recordtostring($item1));
147 dbg("processfile: \$item2=" . recordtostring($item2));
149 $item2->{$universefield} = $keyfielduniverse[$i];
151 dbg("processfile: pushing new record to list 2 " . recordtostring($item2));
153 push @list2, ($item2);
157 for ($i = 0; $i < @list1; $i++)
159 dbg("processfile: \$list1[$i]=" . recordtostring($list1[$i]));
161 for ($i = 0; $i < @list2; $i++)
163 dbg("processfile: \$list2[$i]=" . recordtostring($list2[$i]));
171 for ($j = 0; $j < @list1; $j++)
174 push @records, ($item1);
177 @records = sort sortrecords @records;