Bug #: 3917
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Aug 2005 18:36:22 +0000 (18:36 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Aug 2005 18:36:22 +0000 (18:36 +0000)
Submitted by: eseidel
Reviewed by: darin
        * DumpKCanvasTree/DumpKCanvasTree.m: Added.
        * DumpKCanvasTree/DumpKCanvasTree.xcodeproj/project.pbxproj: Added.
        * Scripts/build-dumpkcanvastree: Added.
        * Scripts/run-webkit-tests-svg: Added.
        Adds a DumpRenderTree-like tool for SVG which allows us to do
        text-based layout regression testing.  This (like most of the
        SVG specific stuff) is temporary and will be replaced by
        DumpRenderTree once the DOMs and RenderTrees merge.
        http://bugzilla.opendarwin.org/show_bug.cgi?id=3917

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10073 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/DumpKCanvasTree/DumpKCanvasTree.m [new file with mode: 0644]
WebKitTools/DumpKCanvasTree/DumpKCanvasTree.xcodeproj/project.pbxproj [new file with mode: 0644]
WebKitTools/Scripts/build-dumpkcanvastree [new file with mode: 0755]
WebKitTools/Scripts/run-webkit-tests-svg [new file with mode: 0755]

index 7957bfe2f315c2e81fe8da47c7bed89979ffe837..07c797519d6ce10bb72885681a5f74b43a712ba2 100644 (file)
@@ -1,3 +1,17 @@
+2005-08-06  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by darin.
+
+        * DumpKCanvasTree/DumpKCanvasTree.m: Added.
+        * DumpKCanvasTree/DumpKCanvasTree.xcodeproj/project.pbxproj: Added.
+        * Scripts/build-dumpkcanvastree: Added.
+        * Scripts/run-webkit-tests-svg: Added.
+        Adds a DumpRenderTree-like tool for SVG which allows us to do
+        text-based layout regression testing.  This (like most of the
+        SVG specific stuff) is temporary and will be replaced by
+        DumpRenderTree once the DOMs and RenderTrees merge.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=3917
+
 2005-08-06  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by darin.
diff --git a/WebKitTools/DumpKCanvasTree/DumpKCanvasTree.m b/WebKitTools/DumpKCanvasTree/DumpKCanvasTree.m
new file mode 100644 (file)
index 0000000..f48dfec
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore+SVG/DrawDocumentPrivate.h>
+
+static void dumpRenderTree(const char *filename);
+
+int main(int argc, const char *argv[])
+{
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    if (argc == 2 && strcmp(argv[1], "-") == 0) {
+        char filenameBuffer[2048];
+        while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) {
+            char *newLineCharacter = strchr(filenameBuffer, '\n');
+            if (newLineCharacter) {
+                *newLineCharacter = '\0';
+            }
+            dumpRenderTree(filenameBuffer);
+            puts("#EOF");
+            fflush(stdout);
+        }
+    } else {
+        int i;
+        for (i = 1; i != argc; ++i) {
+            dumpRenderTree(argv[i]);
+        }
+    }
+
+    [pool release];
+    return 0;
+}
+
+static void dumpRenderTree(const char *filename)
+{
+    NSString *svgPath = [NSString stringWithUTF8String:filename];
+    if (svgPath == nil) {
+        fprintf(stderr, "can't parse filename as UTF-8\n");
+        return;
+    }
+    
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    DrawDocument *document = [[DrawDocument alloc] initWithContentsOfFile:svgPath];
+    
+    NSString *result = [document renderTreeAsExternalRepresentation];
+    if (!result)
+        puts("error");
+    else
+        fputs([result UTF8String], stdout);
+    
+    [document release];
+    [pool release];
+}
diff --git a/WebKitTools/DumpKCanvasTree/DumpKCanvasTree.xcodeproj/project.pbxproj b/WebKitTools/DumpKCanvasTree/DumpKCanvasTree.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..b22f48b
--- /dev/null
@@ -0,0 +1,265 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 42;
+       objects = {
+
+/* Begin PBXBuildFile section */
+               8DD76F9A0486AA7600D96B5E /* DumpKCanvasTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* DumpKCanvasTree.m */; settings = {ATTRIBUTES = (); }; };
+               8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
+               A810E4BC08A4462800333D98 /* WebCore+SVG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A810E4BB08A4462800333D98 /* WebCore+SVG.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+               014CEA4F0018CE4811CA2923 /* Debug */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               ZERO_LINK = YES;
+                       };
+                       name = Debug;
+               };
+               014CEA500018CE4811CA2923 /* Release */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+/* End PBXBuildStyle section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+               8DD76F9E0486AA7600D96B5E /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /usr/share/man/man1/;
+                       dstSubfolderSpec = 0;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+               08FB7796FE84155DC02AAC07 /* DumpKCanvasTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DumpKCanvasTree.m; sourceTree = "<group>"; };
+               08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+               8DD76FA10486AA7600D96B5E /* DumpKCanvasTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpKCanvasTree; sourceTree = BUILT_PRODUCTS_DIR; };
+               A810E4BB08A4462800333D98 /* WebCore+SVG.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = "WebCore+SVG.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               8DD76F9B0486AA7600D96B5E /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */,
+                               A810E4BC08A4462800333D98 /* WebCore+SVG.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               08FB7794FE84155DC02AAC07 /* DumpKCanvasTree */ = {
+                       isa = PBXGroup;
+                       children = (
+                               08FB7795FE84155DC02AAC07 /* Source */,
+                               08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
+                               1AB674ADFE9D54B511CA2CBB /* Products */,
+                       );
+                       name = DumpKCanvasTree;
+                       sourceTree = "<group>";
+               };
+               08FB7795FE84155DC02AAC07 /* Source */ = {
+                       isa = PBXGroup;
+                       children = (
+                               08FB7796FE84155DC02AAC07 /* DumpKCanvasTree.m */,
+                       );
+                       name = Source;
+                       sourceTree = "<group>";
+               };
+               08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A810E4BB08A4462800333D98 /* WebCore+SVG.framework */,
+                               08FB779EFE84155DC02AAC07 /* Foundation.framework */,
+                       );
+                       name = "External Frameworks and Libraries";
+                       sourceTree = "<group>";
+               };
+               1AB674ADFE9D54B511CA2CBB /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               8DD76FA10486AA7600D96B5E /* DumpKCanvasTree */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+               8DD76F960486AA7600D96B5E /* DumpKCanvasTree */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = A810DED508A40F3100333D98 /* Build configuration list for PBXNativeTarget "DumpKCanvasTree" */;
+                       buildPhases = (
+                               8DD76F990486AA7600D96B5E /* Sources */,
+                               8DD76F9B0486AA7600D96B5E /* Frameworks */,
+                               8DD76F9E0486AA7600D96B5E /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       buildSettings = {
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = DumpKCanvasTree_Prefix.pch;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DumpKCanvasTree;
+                       };
+                       dependencies = (
+                       );
+                       name = DumpKCanvasTree;
+                       productInstallPath = "$(HOME)/bin";
+                       productName = DumpKCanvasTree;
+                       productReference = 8DD76FA10486AA7600D96B5E /* DumpKCanvasTree */;
+                       productType = "com.apple.product-type.tool";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               08FB7793FE84155DC02AAC07 /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = A810DED908A40F3100333D98 /* Build configuration list for PBXProject "DumpKCanvasTree" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               014CEA4F0018CE4811CA2923 /* Debug */,
+                               014CEA500018CE4811CA2923 /* Release */,
+                       );
+                       hasScannedForEncodings = 1;
+                       mainGroup = 08FB7794FE84155DC02AAC07 /* DumpKCanvasTree */;
+                       projectDirPath = "";
+                       targets = (
+                               8DD76F960486AA7600D96B5E /* DumpKCanvasTree */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+               8DD76F990486AA7600D96B5E /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               8DD76F9A0486AA7600D96B5E /* DumpKCanvasTree.m in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+               A810DED608A40F3100333D98 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DumpKCanvasTree;
+                               ZERO_LINK = YES;
+                       };
+                       name = Development;
+               };
+               A810DED708A40F3100333D98 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DumpKCanvasTree;
+                               ZERO_LINK = NO;
+                       };
+                       name = Deployment;
+               };
+               A810DED808A40F3100333D98 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INSTALL_PATH = "$(HOME)/bin";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DumpKCanvasTree;
+                       };
+                       name = Default;
+               };
+               A810DEDA08A40F3100333D98 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                       };
+                       name = Development;
+               };
+               A810DEDB08A40F3100333D98 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                       };
+                       name = Deployment;
+               };
+               A810DEDC08A40F3100333D98 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                       };
+                       name = Default;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               A810DED508A40F3100333D98 /* Build configuration list for PBXNativeTarget "DumpKCanvasTree" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A810DED608A40F3100333D98 /* Development */,
+                               A810DED708A40F3100333D98 /* Deployment */,
+                               A810DED808A40F3100333D98 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               A810DED908A40F3100333D98 /* Build configuration list for PBXProject "DumpKCanvasTree" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A810DEDA08A40F3100333D98 /* Development */,
+                               A810DEDB08A40F3100333D98 /* Deployment */,
+                               A810DEDC08A40F3100333D98 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/WebKitTools/Scripts/build-dumpkcanvastree b/WebKitTools/Scripts/build-dumpkcanvastree
new file mode 100755 (executable)
index 0000000..44076a5
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer. 
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution. 
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission. 
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Simplified build script for WebKit Open Source Project.
+# Modified copy of build-dumprendertree. Perhaps these could share code.
+
+use strict;
+use FindBin;
+use lib $FindBin::Bin;
+use webkitdirs;
+
+checkRequiredSystemConfig();
+setConfiguration();
+chdirWebKit();
+my @options = XcodeOptions();
+
+# Check to see that all the frameworks are built.
+checkSVGFrameworks();
+
+# Build
+chdir "WebKitTools/DumpKCanvasTree" or die;
+exit system "xcodebuild", "-project", "DumpKCanvasTree.xcodeproj", @options;
diff --git a/WebKitTools/Scripts/run-webkit-tests-svg b/WebKitTools/Scripts/run-webkit-tests-svg
new file mode 100755 (executable)
index 0000000..fb753c6
--- /dev/null
@@ -0,0 +1,253 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer. 
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution. 
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission. 
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Script to run the Web Kit Open Source Project layout tests.
+
+use strict;
+use IPC::Open2;
+use FindBin;
+use Cwd;
+use lib $FindBin::Bin;
+use webkitdirs;
+
+# Run all the tests passed in on the command line.
+# If no tests are passed, find all the .svg files in the test directory.
+
+# Run each text.
+# Compare against the existing file xxx-expected.txt.
+# If there is a mismatch, generate xxx-actual.txt and xxx-diffs.txt.
+
+# At the end, report:
+#   the number of tests that got the expected results
+#   the number of tests that ran, but did not get the expected results
+#   the number of tests that failed to run
+#   the number of tests that were run but had no expected results to compare against
+
+setConfiguration();
+my $productDir = productDir();
+
+chdirWebKit();
+
+my $result = system "WebKitTools/Scripts/build-dumpkcanvastree", @ARGV;
+exit $result if $result;
+
+my $tool = "$productDir/DumpKCanvasTree";
+die "can't find executable DumpKCanvasTree tool (looked in $productDir)\n" if !-x $tool;
+
+checkSVGFrameworks();
+
+my $workingDir = getcwd();
+my $SVGSupportDirectory = "$workingDir/SVGSupport";
+my $testDirectory = "$SVGSupportDirectory/layout-tests";
+my $testResultsDirectory = "/tmp/layout-test-results";
+my $testResults = "$testResultsDirectory/results.html";
+
+$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
+
+my @tests;
+
+my $findArguments = "\\( -name resources \\! -prune \\) -or -name '*.svg'";
+my $foundTestName = 0;
+for my $test (@ARGV) {
+    next if $test =~ /^-/;
+    $foundTestName = 1;
+    $test =~ s/^$testDirectory\///;
+    if ($test =~ /^\//) {
+        print "can't run test outside $testDirectory\n";
+    } elsif (-f "$testDirectory/$test") {
+        if ($test !~ /\.(svg)$/) {
+            print "test $test does not have an .svg extension\n";
+        } else {
+            push @tests, $test;
+        }
+    } elsif (-d "$testDirectory/$test") {
+        push @tests, map { chomp; s-^$testDirectory/--; $_; } `find -Ls $testDirectory/$test $findArguments`;
+    } else {
+        print "test $test not found\n";
+    }
+}
+if (!$foundTestName) {
+    @tests = map { chomp; s-^$testDirectory/--; $_; } `find -Ls $testDirectory $findArguments`;
+}
+
+die "no tests to run\n" if !@tests;
+
+my %counts;
+my %tests;
+my $count;
+
+open2(\*IN, \*OUT, $tool, "-") or die;
+
+$| = 1;
+
+for my $test (@tests) {
+    next if $test eq 'results.html';
+    
+    my $base = $test;
+    $base =~ s/\.(svg)$//;
+    
+    print "running $base test";
+    
+    my $result;
+
+    print OUT "$testDirectory/$test\n";
+
+    my $actual = "";
+    while (<IN>) {
+        last if /#EOF$/;
+        $actual .= $_;
+    }
+    
+    my $expected;
+    if (open EXPECTED, "<", "$testDirectory/$base-expected.txt") {
+        $expected = "";
+        while (<EXPECTED>) {
+            $expected .= $_;
+        }
+        close EXPECTED;
+    }
+    if (!defined $expected) {
+        print " -> new test\n";        
+        $result = "new";
+        open EXPECTED, ">", "$testDirectory/$base-expected.txt" or die "could not create $testDirectory/$base-expected.txt\n";
+        print EXPECTED $actual;
+        close EXPECTED;
+        unlink "$testResultsDirectory/$base-actual.txt";
+        unlink "$testResultsDirectory/$base-diffs.txt";
+    } elsif ($actual eq $expected) {
+        print " -> succeeded\n";        
+        $result = "match";
+        unlink "$testResultsDirectory/$base-actual.txt";
+        unlink "$testResultsDirectory/$base-diffs.txt";
+    } else {
+        print " -> failed\n";        
+        $result = "mismatch";
+        my $dir = "$testResultsDirectory/$base";
+        $dir =~ s|/[^/]+$||;
+        system "mkdir", "-p", $dir;
+        open ACTUAL, ">", "$testResultsDirectory/$base-actual.txt" or die;
+        print ACTUAL $actual;
+        close ACTUAL;
+        system "diff -u \"$testDirectory/$base-expected.txt\" \"$testResultsDirectory/$base-actual.txt\" > \"$testResultsDirectory/$base-diffs.txt\"";
+    }
+    
+    $count += 1;
+    $counts{$result} += 1;
+    push @{$tests{$result}}, $test;
+}
+
+close IN;
+close OUT;
+
+my %text = (
+    match => "succeeded",
+    mismatch => "had incorrect layout",
+    new => "were new",
+    fail => "failed (tool did not execute successfully)",
+);
+
+print "\n";
+
+if ($counts{match} && $counts{match} == $count) {
+    print "all $count test cases succeeded\n";
+    unlink $testResults;
+} else {
+    for my $type ("match", "mismatch", "new", "fail") {
+        my $c = $counts{$type};
+        if ($c) {
+            my $t = $text{$type};
+            my $message;
+            if ($c == 1) {
+                $t =~ s/were/was/;
+                $message = sprintf "1 test case (%d%%) %s\n", 1 * 100 / $count, $t;
+            } else {
+                $message = sprintf "%d test cases (%d%%) %s\n", $c, $c * 100 / $count, $t;
+            }
+            $message =~ s-\(0%\)-(<1%)-;
+            print $message;
+        }
+    }
+    
+    system "mkdir", "-p", $testResultsDirectory;
+
+    open HTML, ">", $testResults or die;
+    print HTML "<html>\n";
+    print HTML "<head>\n";
+    print HTML "<title>Layout Test Results</title>\n";
+    print HTML "</head>\n";
+    print HTML "<body>\n";
+
+    if ($counts{mismatch}) {
+        print HTML "<p>Tests where results did not match expected results:</p>\n";
+        print HTML "<table>\n";
+        for my $test (@{$tests{mismatch}}) {
+            my $base = $test;
+            $base =~ s/\.(svg)$//;
+            print HTML "<tr>\n";
+            print HTML "<td><a href=\"$testDirectory/$test\">$base</a></td>\n";
+            print HTML "<td><a href=\"$testDirectory/$base-expected.txt\">expected</a></td>\n";
+            print HTML "<td><a href=\"$base-actual.txt\">actual</a></td>\n";
+            print HTML "<td><a href=\"$base-diffs.txt\">diffs</a></td>\n";
+            print HTML "</tr>\n";
+        }
+        print HTML "</table>\n";
+    }
+
+    if ($counts{fail}) {
+        print HTML "<p>Tests that caused the DumpRenderTree tool to fail:</p>\n";
+        print HTML "<table>\n";
+        for my $test (@{$tests{fail}}) {
+            my $base = $test;
+            $base =~ s/\.(html|xml|xhtml)$//;
+            print HTML "<tr>\n";
+            print HTML "<td><a href=\"$testDirectory/$test\">$base</a></td>\n";
+            print HTML "</tr>\n";
+        }
+        print HTML "</table>\n";
+    }
+
+    if ($counts{new}) {
+        print HTML "<p>Tests that had no expected results (probably new):</p>\n";
+        print HTML "<table>\n";
+        for my $test (@{$tests{new}}) {
+            my $base = $test;
+            $base =~ s/\.(svg)$//;
+            print HTML "<tr>\n";
+            print HTML "<td><a href=\"$testDirectory/$test\">$base</a></td>\n";
+            print HTML "<td><a href=\"$testDirectory/$base-expected.txt\">results</a></td>\n";
+            print HTML "</tr>\n";
+        }
+        print HTML "</table>\n";
+    }
+
+    print HTML "</body>\n";
+    print HTML "</html>\n";
+    close HTML;
+    
+    system "open", $testResults;
+}