Title: [94976] trunk/Tools
Revision
94976
Author
e...@webkit.org
Date
2011-09-12 13:54:21 -0700 (Mon, 12 Sep 2011)

Log Message

[NRWT] REGRESSION: Local loader tests are failing on machines that lost /tmp/LayoutTests symlink
https://bugs.webkit.org/show_bug.cgi?id=65781

Reviewed by Ryosuke Niwa.

Instead of making NRWT create the symlink, I just made DumpRenderTree smart enough
to resolve the passed in url relative to the absolute url for the test.

I believe this is a better approach than the on used in the Qt and Chromium DRT's
(which resolves the path relative to the built location of the DRT executable)
and we should move this new code into a shared location in a follow-up patch.

* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::pathToLocalResource):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94975 => 94976)


--- trunk/Tools/ChangeLog	2011-09-12 20:30:12 UTC (rev 94975)
+++ trunk/Tools/ChangeLog	2011-09-12 20:54:21 UTC (rev 94976)
@@ -1,5 +1,22 @@
 2011-09-12  Eric Seidel  <e...@webkit.org>
 
+        [NRWT] REGRESSION: Local loader tests are failing on machines that lost /tmp/LayoutTests symlink
+        https://bugs.webkit.org/show_bug.cgi?id=65781
+
+        Reviewed by Ryosuke Niwa.
+
+        Instead of making NRWT create the symlink, I just made DumpRenderTree smart enough
+        to resolve the passed in url relative to the absolute url for the test.
+
+        I believe this is a better approach than the on used in the Qt and Chromium DRT's
+        (which resolves the path relative to the built location of the DRT executable)
+        and we should move this new code into a shared location in a follow-up patch.
+
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::pathToLocalResource):
+
+2011-09-12  Eric Seidel  <e...@webkit.org>
+
         Reshuffle some code in WebKitDriver._read_block in preparation for reading stderr/stdout separately
         https://bugs.webkit.org/show_bug.cgi?id=67530
 

Modified: trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm (94975 => 94976)


--- trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm	2011-09-12 20:30:12 UTC (rev 94975)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm	2011-09-12 20:54:21 UTC (rev 94976)
@@ -355,9 +355,24 @@
     m_waitToDump = false;
 }
 
-JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
+JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef localResourcePath)
 {
-    return JSStringRetain(url); // Do nothing on mac.
+    // Use the absolute path for the test from m_testPathOrURL
+    // to create an absolute path for the requested local resource.
+    // FIXME: This code should work on all *nix platforms and can be moved into LayoutTestController.cpp.
+    size_t maxBufferSize = JSStringGetMaximumUTF8CStringSize(localResourcePath);
+    char* resourcePathAsUTF8 = new char[maxBufferSize];
+    size_t resourcePathAsUTF8BufferSize = JSStringGetUTF8CString(localResourcePath, resourcePathAsUTF8, maxBufferSize);
+
+    std::string resourcePathAsString(resourcePathAsUTF8, resourcePathAsUTF8BufferSize - 1); // Ignore the trailing \0 when creating the string.
+    delete[] resourcePathAsUTF8;
+
+    size_t resourceLayoutTestsIndex = resourcePathAsString.rfind("LayoutTests/");
+    ASSERT(resourceLayoutTestsIndex); // Passed in paths must include "LayoutTests/"
+    size_t testLayoutTestsIndex = m_testPathOrURL.rfind("LayoutTests/");
+    std::string resolvedResourcePath = m_testPathOrURL.substr(0, testLayoutTestsIndex) + resourcePathAsString.substr(resourceLayoutTestsIndex);
+
+    return JSStringCreateWithUTF8CString(resolvedResourcePath.c_str());
 }
 
 void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to