Changeset 94976 in webkit


Ignore:
Timestamp:
Sep 12, 2011 1:54:21 PM (13 years ago)
Author:
eric@webkit.org
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r94973 r94976  
     12011-09-12  Eric Seidel  <eric@webkit.org>
     2
     3        [NRWT] REGRESSION: Local loader tests are failing on machines that lost /tmp/LayoutTests symlink
     4        https://bugs.webkit.org/show_bug.cgi?id=65781
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Instead of making NRWT create the symlink, I just made DumpRenderTree smart enough
     9        to resolve the passed in url relative to the absolute url for the test.
     10
     11        I believe this is a better approach than the on used in the Qt and Chromium DRT's
     12        (which resolves the path relative to the built location of the DRT executable)
     13        and we should move this new code into a shared location in a follow-up patch.
     14
     15        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     16        (LayoutTestController::pathToLocalResource):
     17
    1182011-09-12  Eric Seidel  <eric@webkit.org>
    219
  • trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r94343 r94976  
    356356}
    357357
    358 JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
    359 {
    360     return JSStringRetain(url); // Do nothing on mac.
     358JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef localResourcePath)
     359{
     360    // Use the absolute path for the test from m_testPathOrURL
     361    // to create an absolute path for the requested local resource.
     362    // FIXME: This code should work on all *nix platforms and can be moved into LayoutTestController.cpp.
     363    size_t maxBufferSize = JSStringGetMaximumUTF8CStringSize(localResourcePath);
     364    char* resourcePathAsUTF8 = new char[maxBufferSize];
     365    size_t resourcePathAsUTF8BufferSize = JSStringGetUTF8CString(localResourcePath, resourcePathAsUTF8, maxBufferSize);
     366
     367    std::string resourcePathAsString(resourcePathAsUTF8, resourcePathAsUTF8BufferSize - 1); // Ignore the trailing \0 when creating the string.
     368    delete[] resourcePathAsUTF8;
     369
     370    size_t resourceLayoutTestsIndex = resourcePathAsString.rfind("LayoutTests/");
     371    ASSERT(resourceLayoutTestsIndex); // Passed in paths must include "LayoutTests/"
     372    size_t testLayoutTestsIndex = m_testPathOrURL.rfind("LayoutTests/");
     373    std::string resolvedResourcePath = m_testPathOrURL.substr(0, testLayoutTestsIndex) + resourcePathAsString.substr(resourceLayoutTestsIndex);
     374
     375    return JSStringCreateWithUTF8CString(resolvedResourcePath.c_str());
    361376}
    362377
Note: See TracChangeset for help on using the changeset viewer.