check-dom-results 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/usr/bin/perl -w
  2. # Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. #
  8. # 1. Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in the
  12. # documentation and/or other materials provided with the distribution.
  13. # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  14. # its contributors may be used to endorse or promote products derived
  15. # from this software without specific prior written permission.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  18. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  21. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. # Script to check status of W3C DOM tests that are part of the WebKit tests.
  28. use strict;
  29. use FindBin;
  30. use Cwd;
  31. use lib $FindBin::Bin;
  32. use webkitdirs;
  33. chdirWebKit();
  34. my $verbose = $ARGV[0] && $ARGV[0] eq "-v";
  35. my $workingDir = getcwd();
  36. my $testDirectory = "$workingDir/LayoutTests";
  37. my @suites = ( {"name" => "DOM Level 1 Core (html)", "directory" => "dom/html/level1/core"},
  38. {"name" => "DOM Level 2 Core (html)", "directory" => "dom/html/level2/core"},
  39. {"name" => "DOM Level 2 Events (html)", "directory" => "dom/html/level2/events"},
  40. {"name" => "DOM Level 2 HTML (html)", "directory" => "dom/html/level2/html"},
  41. {"name" => "DOM Level 1 Core (xhtml)", "directory" => "dom/xhtml/level1/core"},
  42. {"name" => "DOM Level 2 Core (xhtml)", "directory" => "dom/xhtml/level2/core"},
  43. {"name" => "DOM Level 2 Events (xhtml)", "directory" => "dom/xhtml/level2/events"},
  44. {"name" => "DOM Level 2 HTML (xhtml)", "directory" => "dom/xhtml/level2/html"},
  45. {"name" => "DOM Level 3 Core (xhtml)", "directory" => "dom/xhtml/level3/core"},
  46. {"name" => "DOM Level 3 XPath (svg)", "directory" => "dom/svg/level3/xpath"});
  47. my $totalCount = 0;
  48. my $totalSuccesses = 0;
  49. my $totalDisabled = 0;
  50. my $totalFailed = 0;
  51. foreach my $suite (@suites) {
  52. my %suite = %$suite;
  53. my $directory = $suite{"directory"};
  54. my $name = $suite{"name"};
  55. my @results = `find "${testDirectory}/${directory}" -name "*-expected.txt"`;
  56. my @disabled = `find "${testDirectory}/${directory}" -name "*-disabled"`;
  57. my @failures = ();
  58. my $count = 0;
  59. foreach my $result (@results) {
  60. $count++;
  61. my $success = 0;
  62. open RESULT, "<$result";
  63. while (<RESULT>) {
  64. if (/Success/) {
  65. $success = 1;
  66. last;
  67. }
  68. }
  69. close RESULT;
  70. if (!$success) {
  71. push @failures, $result;
  72. }
  73. }
  74. my $disabledCount = (scalar @disabled);
  75. my $failureCount = (scalar @failures);
  76. $count += $disabledCount;
  77. my $successCount = $count - $failureCount - $disabledCount;
  78. my $percentage = (sprintf "%.1f", ($successCount * 100.0 / $count));
  79. if ($percentage == 100) {
  80. print "${name}: all ${count} tests succeeded";
  81. } else {
  82. print "${name}: ${successCount} out of ${count} tests succeeded (${percentage}%)";
  83. }
  84. print " ($disabledCount disabled)" if $disabledCount;
  85. print "\n";
  86. if ($verbose) {
  87. print "\n";
  88. if (@disabled) {
  89. print " Disabled:\n";
  90. foreach my $failure (sort @disabled) {
  91. $failure =~ s|.*/||;
  92. $failure =~ s|-disabled||;
  93. print " ${directory}/${failure}";
  94. }
  95. }
  96. if (@failures) {
  97. print " Failed:\n";
  98. foreach my $failure (sort @failures) {
  99. $directory =~ m|^dom/(\w+)|;
  100. my $extension = $1;
  101. $failure =~ s|.*/||;
  102. $failure =~ s|-expected\.txt|.${extension}|;
  103. print " ${directory}/${failure}";
  104. }
  105. }
  106. print "\n";
  107. }
  108. $totalCount += $count;
  109. $totalSuccesses += $successCount;
  110. $totalDisabled += $disabledCount;
  111. $totalFailed += $failureCount;
  112. }
  113. my $totalPercentage = (sprintf "%.1f", ($totalSuccesses * 100.0 / $totalCount));
  114. my $totalDisabledPercentage = (sprintf "%.1f", ($totalDisabled * 100.0 / $totalCount));
  115. my $totalFailedPercentage = (sprintf "%.1f", ($totalFailed * 100.0 / $totalCount));
  116. print "Total: ${totalSuccesses} out of ${totalCount} tests succeeded (${totalPercentage}%)\n";
  117. print " ${totalDisabled} tests disabled (${totalDisabledPercentage}%)\n";
  118. print " ${totalFailed} tests failed (${totalFailedPercentage}%)\n";