3 # Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 # its contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Script to check status of W3C DOM tests that are part of the WebKit tests.
34 use lib $FindBin::Bin;
39 my $verbose = $ARGV[0] && $ARGV[0] eq "-v";
41 my $workingDir = getcwd();
42 my $testDirectory = "$workingDir/LayoutTests";
44 my @suites = ( {"name" => "DOM Level 1 Core (html)", "directory" => "dom/html/level1/core"},
45 {"name" => "DOM Level 2 Core (html)", "directory" => "dom/html/level2/core"},
46 {"name" => "DOM Level 2 Events (html)", "directory" => "dom/html/level2/events"},
47 {"name" => "DOM Level 2 HTML (html)", "directory" => "dom/html/level2/html"},
48 {"name" => "DOM Level 1 Core (xhtml)", "directory" => "dom/xhtml/level1/core"},
49 {"name" => "DOM Level 2 Core (xhtml)", "directory" => "dom/xhtml/level2/core"},
50 {"name" => "DOM Level 2 Events (xhtml)", "directory" => "dom/xhtml/level2/events"},
51 {"name" => "DOM Level 2 HTML (xhtml)", "directory" => "dom/xhtml/level2/html"},
52 {"name" => "DOM Level 3 Core (xhtml)", "directory" => "dom/xhtml/level3/core"},
53 {"name" => "DOM Level 3 XPath (svg)", "directory" => "dom/svg/level3/xpath"});
56 my $totalSuccesses = 0;
57 my $totalDisabled = 0;
60 foreach my $suite (@suites) {
63 my $directory = $suite{"directory"};
64 my $name = $suite{"name"};
65 my @results = `find "${testDirectory}/${directory}" -name "*-expected.txt"`;
66 my @disabled = `find "${testDirectory}/${directory}" -name "*-disabled"`;
71 foreach my $result (@results) {
74 open RESULT, "<$result";
83 push @failures, $result;
87 my $disabledCount = (scalar @disabled);
88 my $failureCount = (scalar @failures);
90 $count += $disabledCount;
92 my $successCount = $count - $failureCount - $disabledCount;
93 my $percentage = (sprintf "%.1f", ($successCount * 100.0 / $count));
95 if ($percentage == 100) {
96 print "${name}: all ${count} tests succeeded";
98 print "${name}: ${successCount} out of ${count} tests succeeded (${percentage}%)";
100 print " ($disabledCount disabled)" if $disabledCount;
105 print " Disabled:\n";
107 foreach my $failure (sort @disabled) {
109 $failure =~ s|-disabled||;
110 print " ${directory}/${failure}";
116 foreach my $failure (sort @failures) {
117 $directory =~ m|^dom/(\w+)|;
120 $failure =~ s|-expected\.txt|.${extension}|;
121 print " ${directory}/${failure}";
128 $totalCount += $count;
129 $totalSuccesses += $successCount;
130 $totalDisabled += $disabledCount;
131 $totalFailed += $failureCount;
135 my $totalPercentage = (sprintf "%.1f", ($totalSuccesses * 100.0 / $totalCount));
136 my $totalDisabledPercentage = (sprintf "%.1f", ($totalDisabled * 100.0 / $totalCount));
137 my $totalFailedPercentage = (sprintf "%.1f", ($totalFailed * 100.0 / $totalCount));
139 print "Total: ${totalSuccesses} out of ${totalCount} tests succeeded (${totalPercentage}%)\n";
140 print " ${totalDisabled} tests disabled (${totalDisabledPercentage}%)\n";
141 print " ${totalFailed} tests failed (${totalFailedPercentage}%)\n";