Bug 76802 - run-perf-tests should report server-side errors
Summary: run-perf-tests should report server-side errors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 10266
  Show dependency treegraph
 
Reported: 2012-01-22 18:16 PST by Ryosuke Niwa
Modified: 2012-01-23 15:49 PST (History)
5 users (show)

See Also:


Attachments
fixes the bug (6.25 KB, patch)
2012-01-22 19:24 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed the bug pointed out by Tony (6.27 KB, patch)
2012-01-23 13:33 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-01-22 18:16:06 PST
webkit-perf.appspot.com may reject uploaded jsons for reasons other than network errors. e.g. malformed data. run-perf-tests should report those errors.
Comment 1 Ryosuke Niwa 2012-01-22 19:24:10 PST
Created attachment 123509 [details]
fixes the bug
Comment 2 Tony Chang 2012-01-23 09:47:30 PST
Comment on attachment 123509 [details]
fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=123509&action=review

> Tools/Scripts/webkitpy/common/net/file_uploader.py:116
> -            NetworkTransaction(timeout_seconds=self._timeout_seconds).run(callback)
> +            response = NetworkTransaction(timeout_seconds=self._timeout_seconds).run(callback)
>          finally:
>              socket.setdefaulttimeout(orig_timeout)
> +            return response

Do we need to define response outside of the try?  Otherwise if response doesn't get set, you'll get an UnboundLocalError exception.

> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
> +        response_body = [line.strip('\n') for line in response]
> +        if response_body != ['OK']:

Can you just check for response.strip('\n') == 'OK'?
Comment 3 Ryosuke Niwa 2012-01-23 11:03:04 PST
Comment on attachment 123509 [details]
fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=123509&action=review

>> Tools/Scripts/webkitpy/common/net/file_uploader.py:116
>> +            return response
> 
> Do we need to define response outside of the try?  Otherwise if response doesn't get set, you'll get an UnboundLocalError exception.

Oops, yes, I should set it to None. It's very annoying that we can't create a unit test for this function :(

>> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
>> +        if response_body != ['OK']:
> 
> Can you just check for response.strip('\n') == 'OK'?

response is a file-like object so not sure if we can do that. I was initially fetching only the first line but then it didn't really matter because the for-loop terminates after one iteration when the response is just 'OK' and we have to read the entire response otherwise anyways.
Comment 4 Tony Chang 2012-01-23 11:08:57 PST
Comment on attachment 123509 [details]
fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=123509&action=review

>>> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
>>> +        if response_body != ['OK']:
>> 
>> Can you just check for response.strip('\n') == 'OK'?
> 
> response is a file-like object so not sure if we can do that. I was initially fetching only the first line but then it didn't really matter because the for-loop terminates after one iteration when the response is just 'OK' and we have to read the entire response otherwise anyways.

You could do response.read().strip('\n') and store that in a variable.  I guess that's about the same amount of code.  *shrug*
Comment 5 Ryosuke Niwa 2012-01-23 11:23:39 PST
Comment on attachment 123509 [details]
fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=123509&action=review

>>>> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
>>>> +        if response_body != ['OK']:
>>> 
>>> Can you just check for response.strip('\n') == 'OK'?
>> 
>> response is a file-like object so not sure if we can do that. I was initially fetching only the first line but then it didn't really matter because the for-loop terminates after one iteration when the response is just 'OK' and we have to read the entire response otherwise anyways.
> 
> You could do response.read().strip('\n') and store that in a variable.  I guess that's about the same amount of code.  *shrug*

But then I'd have to store that value when it doesn't match 'OK' or else I'd have to manually seek back (not even sure if we can do that on the response).
Comment 6 Ryosuke Niwa 2012-01-23 13:33:27 PST
Created attachment 123611 [details]
Fixed the bug pointed out by Tony
Comment 7 Dirk Pranke 2012-01-23 13:48:27 PST
Comment on attachment 123611 [details]
Fixed the bug pointed out by Tony

View in context: https://bugs.webkit.org/attachment.cgi?id=123611&action=review

change looks fine to me but I'll let tony r+ it.

> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
> +        if response_body != ['OK']:

Minor nit: why not just delete 182 and change 183 to <code>if response_body != ['OK\n']:</code>?
Comment 8 Ryosuke Niwa 2012-01-23 13:51:42 PST
Comment on attachment 123611 [details]
Fixed the bug pointed out by Tony

View in context: https://bugs.webkit.org/attachment.cgi?id=123611&action=review

>> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
>> +        if response_body != ['OK']:
> 
> Minor nit: why not just delete 182 and change 183 to <code>if response_body != ['OK\n']:</code>?

If I do that, then I'd have to call stip on each line when we output the error.
Comment 9 Dirk Pranke 2012-01-23 13:53:08 PST
Comment on attachment 123611 [details]
Fixed the bug pointed out by Tony

View in context: https://bugs.webkit.org/attachment.cgi?id=123611&action=review

>>> Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py:183
>>> +        if response_body != ['OK']:
>> 
>> Minor nit: why not just delete 182 and change 183 to <code>if response_body != ['OK\n']:</code>?
> 
> If I do that, then I'd have to call stip on each line when we output the error.

Ah, fair enough.
Comment 10 Ryosuke Niwa 2012-01-23 15:49:02 PST
Comment on attachment 123611 [details]
Fixed the bug pointed out by Tony

Clearing flags on attachment: 123611

Committed r105650: <http://trac.webkit.org/changeset/105650>
Comment 11 Ryosuke Niwa 2012-01-23 15:49:07 PST
All reviewed patches have been landed.  Closing bug.