Bug 48616

Summary: new-run-webkit-tests: change TestResults to be serializable
Product: WebKit Reporter: Dirk Pranke <dpranke>
Component: New BugsAssignee: Dirk Pranke <dpranke>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, ojan, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Dirk Pranke
Reported 2010-10-28 20:54:39 PDT
new-run-webkit-tests: change TestResults to be serializable
Attachments
Patch (20.98 KB, patch)
2010-10-28 21:03 PDT, Dirk Pranke
no flags
Patch (19.84 KB, patch)
2010-10-29 14:39 PDT, Dirk Pranke
no flags
Patch (22.69 KB, patch)
2010-10-29 15:42 PDT, Dirk Pranke
no flags
Dirk Pranke
Comment 1 2010-10-28 21:03:30 PDT
Dirk Pranke
Comment 2 2010-10-28 21:05:07 PDT
Hi Tony, Ojan, Could one of you take a look at this?
Tony Chang
Comment 3 2010-10-29 09:52:41 PDT
Why did you pick json? Wouldn't pickle be a more appropriate format for passing data between python processes? http://docs.python.org/library/pickle.html
Dirk Pranke
Comment 4 2010-10-29 14:39:50 PDT
Dirk Pranke
Comment 5 2010-10-29 14:41:42 PDT
Patch updated to use cPickle instead .... I was using JSON because I wasn't that familiar with pickling and I have a long-standing bias against language specific marshalling mechanisms for objects (instead of neutral wire formats). But that bias probably didn't make any sense in this case, and the code is certainly shorter and cleaner now.
Tony Chang
Comment 6 2010-10-29 15:06:03 PDT
Comment on attachment 72396 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72396&action=review > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:42 > + return [FailureTimeout, FailureCrash, FailureMissingResult, > + FailureTextMismatch, FailureMissingImageHash, > + FailureMissingImage, FailureImageHashMismatch, > + FailureImageHashIncorrect] Nit: Can this be a tuple stored in just a variable? E.g., _ALL_FAILURE_CLASSES = (...) > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:93 > + def __eq__(self, other): > + return self.__class__.__name__ == other.__class__.__name__ If you're going to have an __eq__, can you add __ne__ too? > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:225 > + OUT_FILENAMES = ["-actual.txt", "-expected.txt", "-diff.txt", > + "-wdiff.html", "-pretty-diff.html"] Nit: Can this be a tuple? > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results.py:55 > + def __eq__(self, other): > + return (self.filename == other.filename and > + self.failures == other.failures and > + self.test_run_time == other.test_run_time and > + self.time_for_diffs == other.time_for_diffs and > + self.total_time_for_all_diffs == other.total_time_for_all_diffs) Can you define __ne__ too?
Dirk Pranke
Comment 7 2010-10-29 15:42:08 PDT
Dirk Pranke
Comment 8 2010-10-29 15:47:08 PDT
Comment on attachment 72409 [details] Patch Clearing flags on attachment: 72409 Committed r70943: <http://trac.webkit.org/changeset/70943>
Dirk Pranke
Comment 9 2010-10-29 15:47:14 PDT
All reviewed patches have been landed. Closing bug.
Dirk Pranke
Comment 10 2010-10-29 15:49:12 PDT
(In reply to comment #6) > (From update of attachment 72396 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=72396&action=review > > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:42 > > + return [FailureTimeout, FailureCrash, FailureMissingResult, > > + FailureTextMismatch, FailureMissingImageHash, > > + FailureMissingImage, FailureImageHashMismatch, > > + FailureImageHashIncorrect] > > Nit: Can this be a tuple stored in just a variable? E.g., > _ALL_FAILURE_CLASSES = (...) > Done. I made the variable public (since the method was) and had to move it to the end of the file, in order for the needed symbols to be defined. > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:93 > > + def __eq__(self, other): > > + return self.__class__.__name__ == other.__class__.__name__ > > If you're going to have an __eq__, can you add __ne__ too? > Done. I was thinking Python dealt with this automatically, but apparently I needed to def __ne__(self, other); raise NotImplementedError for it to do that, at which point implementing it directly was easier. Added another test for this as well. > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py:225 > > + OUT_FILENAMES = ["-actual.txt", "-expected.txt", "-diff.txt", > > + "-wdiff.html", "-pretty-diff.html"] > > Nit: Can this be a tuple? > Done. > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results.py:55 > > + def __eq__(self, other): > > + return (self.filename == other.filename and > > + self.failures == other.failures and > > + self.test_run_time == other.test_run_time and > > + self.time_for_diffs == other.time_for_diffs and > > + self.total_time_for_all_diffs == other.total_time_for_all_diffs) > > Can you define __ne__ too? Done (same as above).
Note You need to log in before you can comment on or make changes to this bug.