2006-03-03 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Mar 2006 01:35:56 +0000 (01:35 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Mar 2006 01:35:56 +0000 (01:35 +0000)
        Reviewed by darin.

        Make run-webkit-tests work on win32.

        * DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp:
        (localFileTest):
        (dumpRenderTreeMain):
        (dumpRenderTreeToStdOut):
        (serializeToStdOut):
        (main):
        * Scripts/run-webkit-tests:
        * Scripts/webkitdirs.pm:
        * Spinneret/Spinneret/WebView.cpp:
        (WebKit::WebView::WebView):

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp
WebKitTools/Scripts/run-webkit-tests
WebKitTools/Scripts/webkitdirs.pm
WebKitTools/Spinneret/Spinneret/WebView.cpp

index daac4379e8119632b22bed4ebfeaf67fc91c53a3..42426e3f706ef7a2cbe12fcc0be659fd342c5bd4 100644 (file)
@@ -1,3 +1,20 @@
+2006-03-03  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by darin.
+
+        Make run-webkit-tests work on win32.
+
+        * DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp:
+        (localFileTest):
+        (dumpRenderTreeMain):
+        (dumpRenderTreeToStdOut):
+        (serializeToStdOut):
+        (main):
+        * Scripts/run-webkit-tests:
+        * Scripts/webkitdirs.pm:
+        * Spinneret/Spinneret/WebView.cpp:
+        (WebKit::WebView::WebView):
+
 2006-03-03  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by mjs.
index b5869e86972828525470e0b86b311f80629b488d..241a97b2ccdcf638903f5584bba639f6b92ed0d0 100644 (file)
 
 using namespace WebCore;
 
-#define LOCAL_FILE_TEST 0
-
-int main(int argc, char* argv[])
+static void localFileTest(FrameWin* frame, char* path)
 {
-    Page* page = new Page();
-    FrameWin* frame = new FrameWin(page, 0);
-    FrameView* frameView = new FrameView(frame);
-    frame->setView(frameView);
-    
+    fprintf(stderr, "Testing file: %s\n", path);
     frame->begin();
-
-#if LOCAL_FILE_TEST
-    char* path = "c:\\cygwin\\tmp\\test.html";
     FILE* file = fopen(path, "rb");
     if (!file) {
-        printf("Failed to open file: %s\n", path);
-        printf("Current path: %s\n", _getcwd(0,0));
-        while(1);
-        exit(1);
+        fprintf(stderr, "Failed to open file: %s\n", path);
+        return;
     }
 
     char buffer[4000];
@@ -68,17 +57,64 @@ int main(int argc, char* argv[])
         frame->write(buffer, newBytes);
     }
     fclose(file);
-#else
-    frame->write("<html><body><p>hello world</p></body></html>");
-#endif
     frame->end();
+}
+
+static void dumpRenderTreeMain(FrameWin* frame)
+{
+    char filenameBuffer[2048];
+    while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) {
+        char *newLineCharacter = strchr(filenameBuffer, '\n');
+        if (newLineCharacter)
+            *newLineCharacter = '\0';
+        
+        if (!*filenameBuffer)
+            continue;
+            
+        localFileTest(frame, filenameBuffer);
+        QString renderDump = externalRepresentation(frame->renderer());
+        puts(renderDump.ascii());
+        puts("#EOF\n");
+
+        fflush(stdout);
+    }
+}
+
+static void dumpRenderTreeToStdOut(FrameWin* frame)
+{
+    QString renderDump = externalRepresentation(frame->renderer());
+    printf("\n\nRenderTree:\n\n%s", renderDump.ascii());
+}
 
+static void serializeToStdOut(FrameWin* frame)
+{
     QString markup = createMarkup(frame->document());
     printf("Source:\n\n%s", markup.ascii());
+}
+
+int main(int argc, char* argv[])
+{
+    Page* page = new Page();
+    FrameWin* frame = new FrameWin(page, 0);
+    FrameView* frameView = new FrameView(frame);
+    frame->setView(frameView);
     
-    QString renderDump = externalRepresentation(frame->renderer());
-    printf("\n\nRenderTree:\n\n%s", renderDump.ascii());
-    fflush(stdout);
-    while(1);
+    if (argc == 2 && strcmp(argv[1], "-") == 0)
+        dumpRenderTreeMain(frame);
+    else {
+        // Default file for debugging in visual studio
+        char *fileToTest = "c:\\cygwin\\tmp\\test.html";
+        if (argc == 2)
+            fileToTest = argv[1];
+        localFileTest(frame, fileToTest);
+        serializeToStdOut(frame);
+        dumpRenderTreeToStdOut(frame);
+        if (argc != 2) {
+            // Keep window open for visual studio debugging.
+            fflush(stdout);
+            while(1);
+        }
+    }
+
     return 0;
 }
index 04ef010c1c817ecff2aee6cfea7ce8f100a499a0..80f73f3f9ba4f29e624c322bbd885ae08aa468dc 100755 (executable)
@@ -126,6 +126,7 @@ if (!$testHTTP) {
 }
 my $findArguments = "$prunePart -or $extensionPart";
 
+my $findOrderArg = isCygwin() ? "" : "-s";
 my $foundTestName = 0;
 for my $test (@ARGV) {
     next if $test =~ /^-/;
@@ -140,7 +141,7 @@ for my $test (@ARGV) {
             push @tests, $test;
         }
     } elsif (-d "$testDirectory/$test") {
-        push @tests, sort pathcmp map { chomp; s-^$testDirectory/--; $_; } `find -Ls $testDirectory/$test $findArguments`;
+        push @tests, sort pathcmp map { chomp; s-^$testDirectory/--; $_; } `find -L $findOrderArg "$testDirectory/$test" $findArguments`;
     } else {
         print "test $test not found\n";
     }
@@ -294,7 +295,12 @@ for my $test (@tests) {
     my $startTime = time if $report10Slowest;
 
     if ($test !~ /^http\//) {
-        print OUT "$testDirectory/$test\n";
+        my $testPath = "$testDirectory/$test";
+        if (isCygwin()) {
+            $testPath =~ s|/cygdrive/c|c:|;
+            $testPath =~ s|/|\\|g;
+        } 
+        print OUT "$testPath\n";
     } else {
         openHTTPDIfNeeded();
         
index 7733d4db18a382b4274ffa1a71b4b4fa0a5e5038..3abcc3b8b7090a2fc91bd9b4e64a7a58b6e03286 100644 (file)
@@ -232,13 +232,21 @@ sub builtDylibPathForName
 {
     my $framework = shift;
     determineConfigurationProductDir();
-    return "$configurationProductDir/$framework.framework/Versions/A/$framework";
+    if (isOSX()) {
+        return "$configurationProductDir/$framework.framework/Versions/A/$framework";
+    }
+    if (isCygwin()) {
+        return "$baseProductDir/$framework.intermediate/$configuration/$framework.intermediate/$framework.lib";
+    }
+    die "Unsupported platform, can't determine built library locations.";
 }
 
 # Check to see that all the frameworks are built.
 sub checkFrameworks
 {
-    for my $framework ("JavaScriptCore", "WebCore", "WebKit") {
+    my @frameworks = ("JavaScriptCore", "WebCore");
+    push(@frameworks, "WebKit") if isOSX();
+    for my $framework (@frameworks) {
         my $path = builtDylibPathForName($framework);
         die "Can't find built framework at \"$path\".\n" unless -x $path;
     }
@@ -246,6 +254,7 @@ sub checkFrameworks
 
 sub hasSVGSupport
 {
+    return 0 if isCygwin(); 
     my $path = shift;
     open NM, "-|", "nm", $path or die;
     my $hasSVGSupport = 0;
index 613eb00f8f414fdbf0a20b78659299a1dc2a6e78..1494ded2905a267646a4662c7c588555d87dfc5e 100755 (executable)
@@ -103,7 +103,7 @@ WebView::WebView(HWND hWnd)
     d = new WebViewPrivate();
     d->windowHandle = hWnd;
     d->mainFrame = new WebFrame("dummy", this);
-    d->mainFrame->loadHTMLString("<img src=\"data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7\" alt=\"Larry\"><div style=\"border: 1px black\">foo</div><ul><li>foo<li>bar<li>baz</ul>");
+    d->mainFrame->loadHTMLString("<p style=\"background-color: #00FF00\">Testing</p><img src=\"data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7\" alt=\"Face\"><div style=\"border: solid blue\">div with blue border</div><ul><li>foo<li>bar<li>baz</ul>");
 }
 
 WebView::~WebView()