Bug 124714 - Instead of a large 'if' block, each failure class should write its own result in test_result_writer.py
Summary: Instead of a large 'if' block, each failure class should write its own result...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-21 07:05 PST by Dániel Bátyai
Modified: 2013-12-02 15:52 PST (History)
4 users (show)

See Also:


Attachments
Proposed patch (9.47 KB, patch)
2013-11-21 07:09 PST, Dániel Bátyai
no flags Details | Formatted Diff | Diff
Proposed patch (9.80 KB, patch)
2013-11-21 07:19 PST, Dániel Bátyai
no flags Details | Formatted Diff | Diff
Proposed patch (9.74 KB, patch)
2013-11-22 03:40 PST, Dániel Bátyai
no flags Details | Formatted Diff | Diff
Proposed patch (9.73 KB, patch)
2013-11-22 03:49 PST, Dániel Bátyai
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dániel Bátyai 2013-11-21 07:05:25 PST
# FIXME: Instead of this long 'if' block, each failure class might
# have a responsibility for writing a test result.
Comment 1 Dániel Bátyai 2013-11-21 07:09:49 PST
Created attachment 217562 [details]
Proposed patch
Comment 2 WebKit Commit Bot 2013-11-21 07:11:54 PST
Attachment 217562 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py', u'Tools/Scripts/webkitpy/layout_tests/models/test_failures.py']" exit_code: 1
Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:214:  [FailureReftestMismatch.write_result] Undefined variable '_log'  [pylint/E0602] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Dániel Bátyai 2013-11-21 07:19:26 PST
Created attachment 217564 [details]
Proposed patch
Comment 4 Ryosuke Niwa 2013-11-21 19:20:16 PST
Comment on attachment 217564 [details]
Proposed patch

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

> Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:153
>  class FailureMissingResult(TestFailure):
>      def message(self):
>          return "-expected.txt was missing"
>  
> +    def write_failure(self, writer, driver_output, expected_driver_output, port):
> +        writer.write_text_files(driver_output.text, expected_driver_output.text)
> +        writer.create_text_diff_and_write_result(driver_output.text, expected_driver_output.text)

Can we create a common superclass of FailureMissingResult and FailureTextMismatch to share the code here?

> Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:247
> +    def write_failure(self, writer, driver_output, expected_driver_output, port):
> +        writer.write_audio_files(driver_output.audio, expected_driver_output.audio)
> +

Ditto about extracting a common superclass for FailureMissingAudio and FailureAudioMismatch.
Comment 5 Dániel Bátyai 2013-11-22 03:40:46 PST
Created attachment 217665 [details]
Proposed patch
Comment 6 WebKit Commit Bot 2013-11-22 03:42:23 PST
Attachment 217665 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py', u'Tools/Scripts/webkitpy/layout_tests/models/test_failures.py']" exit_code: 1
Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:115:  expected 2 blank lines, found 1  [pep8/E302] [5]
Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:120:  expected 2 blank lines, found 1  [pep8/E302] [5]
Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:155:  expected 2 blank lines, found 1  [pep8/E302] [5]
Tools/Scripts/webkitpy/layout_tests/models/test_failures.py:159:  expected 2 blank lines, found 1  [pep8/E302] [5]
Total errors found: 4 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Dániel Bátyai 2013-11-22 03:49:05 PST
Created attachment 217666 [details]
Proposed patch
Comment 8 Dániel Bátyai 2013-12-02 05:16:00 PST
Can I get a review on this please?
Comment 9 WebKit Commit Bot 2013-12-02 15:52:20 PST
Comment on attachment 217666 [details]
Proposed patch

Clearing flags on attachment: 217666

Committed r159978: <http://trac.webkit.org/changeset/159978>
Comment 10 WebKit Commit Bot 2013-12-02 15:52:22 PST
All reviewed patches have been landed.  Closing bug.