Changeset 84676 in webkit


Ignore:
Timestamp:
Apr 22, 2011 1:44:46 PM (13 years ago)
Author:
eric@webkit.org
Message:

2011-04-22 Eric Seidel <eric@webkit.org>

Reviewed by Dimitri Glazkov.

webkit-patch rebaseline is broken
https://bugs.webkit.org/show_bug.cgi?id=59207

My recent changes to how LayoutTestResults.results_from_string
uncovered a bug in our use of urllib2.
We now are treating the return value from _fetch_results_html()
(which returns urllib2.openurl()) as a string. That's incorrect,
the return value is a file-like object (which auto-converts to a
string in most cases).

I've updated our urllib2-using code to correctly call .read() on the
resulting object before treating it like a string.
Unfortunately there is no easy way to test this mis-understanding
of the openurl() semantics.

  • Scripts/webkitpy/common/net/buildbot/buildbot.py:
Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r84658 r84676  
     12011-04-22  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        webkit-patch rebaseline is broken
     6        https://bugs.webkit.org/show_bug.cgi?id=59207
     7
     8        My recent changes to how LayoutTestResults.results_from_string
     9        uncovered a bug in our use of urllib2.
     10        We now are treating the return value from _fetch_results_html()
     11        (which returns urllib2.openurl()) as a string.  That's incorrect,
     12        the return value is a file-like object (which auto-converts to a
     13        string in most cases).
     14
     15        I've updated our urllib2-using code to correctly call .read() on the
     16        resulting object before treating it like a string.
     17        Unfortunately there is no easy way to test this mis-understanding
     18        of the openurl() semantics.
     19
     20        * Scripts/webkitpy/common/net/buildbot/buildbot.py:
     21
    1222011-04-22  Adam Barth  <abarth@webkit.org>
    223
  • trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py

    r83614 r84676  
    238238    def _fetch_results_html(self):
    239239        results_html = "%s/results.html" % (self.results_url())
    240         # FIXME: This should use NetworkTransaction's 404 handling instead.
     240        # FIXME: This should use NetworkTransaction's 404 handling or at least move
     241        # to mechanize's to be more consistent with the rest of our code.
    241242        try:
    242243            # It seems this can return None if the url redirects and then returns 404.
    243             return urllib2.urlopen(results_html)
     244            result = urllib2.urlopen(results_html)
     245            if not result:
     246                return None
     247            # urlopen returns a file-like object which sometimes works fine with str()
     248            # but sometimes is a addinfourl object.  In either case calling read() is correct.
     249            return result.read()
    244250        except urllib2.HTTPError, error:
    245251            if error.code != 404:
Note: See TracChangeset for help on using the changeset viewer.