OLD | NEW |
1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 12 matching lines...) Expand all Loading... |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 import optparse | 29 import optparse |
30 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand | 30 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand |
31 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx
pectationsFactory | 31 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx
pectationsFactory |
32 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser
, TestExpectationsModel, TestExpectations | 32 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser
, TestExpectationsModel, TestExpectations |
| 33 from webkitpy.common.net import sheriff_calendar |
33 | 34 |
34 | 35 |
35 class FlakyTests(AbstractDeclarativeCommand): | 36 class FlakyTests(AbstractDeclarativeCommand): |
36 name = "update-flaky-tests" | 37 name = "update-flaky-tests" |
37 help_text = "Update FlakyTests file from the flakiness dashboard" | 38 help_text = "Update FlakyTests file from the flakiness dashboard" |
38 show_in_main_help = True | 39 show_in_main_help = True |
39 | 40 |
40 def __init__(self): | 41 def __init__(self): |
41 options = [ | 42 options = [ |
42 optparse.make_option('--upload', action='store_true', | 43 optparse.make_option('--upload', action='store_true', |
(...skipping 13 matching lines...) Expand all Loading... |
56 lines.sort(key=lambda line: line.path) | 57 lines.sort(key=lambda line: line.path) |
57 # Skip any tests which are mentioned in the dashboard but not in our che
ckout: | 58 # Skip any tests which are mentioned in the dashboard but not in our che
ckout: |
58 fs = tool.filesystem | 59 fs = tool.filesystem |
59 lines = filter(lambda line: fs.exists(fs.join(port.layout_tests_dir(), l
ine.path)), lines) | 60 lines = filter(lambda line: fs.exists(fs.join(port.layout_tests_dir(), l
ine.path)), lines) |
60 flaky_tests_path = fs.join(port.layout_tests_dir(), 'FlakyTests') | 61 flaky_tests_path = fs.join(port.layout_tests_dir(), 'FlakyTests') |
61 # Note: This includes all flaky tests from the dashboard, even ones ment
ioned | 62 # Note: This includes all flaky tests from the dashboard, even ones ment
ioned |
62 # in existing TestExpectations. We could certainly load existing TestExp
ecations | 63 # in existing TestExpectations. We could certainly load existing TestExp
ecations |
63 # and filter accordingly, or update existing TestExpectations instead of
FlakyTests. | 64 # and filter accordingly, or update existing TestExpectations instead of
FlakyTests. |
64 with open(flaky_tests_path, 'w') as flake_file: | 65 with open(flaky_tests_path, 'w') as flake_file: |
65 flake_file.write(TestExpectations.list_to_string(lines)) | 66 flake_file.write(TestExpectations.list_to_string(lines)) |
| 67 print "Updated %s" % flaky_tests_path |
66 | 68 |
67 if not options.upload: | 69 if not options.upload: |
68 return 0 | 70 return 0 |
69 | 71 |
70 files = tool.scm().changed_files() | 72 files = tool.scm().changed_files() |
71 flaky_tests_path = 'LayoutTests/FlakyTests' | 73 flaky_tests_path = 'LayoutTests/FlakyTests' |
72 if flaky_tests_path not in files: | 74 if flaky_tests_path not in files: |
73 print "%s is not changed, not uploading." % flaky_tests_path | 75 print "%s is not changed, not uploading." % flaky_tests_path |
74 return 0 | 76 return 0 |
75 | 77 |
76 commit_message = "Update FlakyTests" | 78 sheriff_emails = sheriff_calendar.current_gardener_emails() |
77 git_cmd = ['git', 'commit', '-m', commit_message, flaky_tests_path] | 79 if not sheriff_emails: |
78 tool.executive.run_command(git_cmd) | 80 print "No gardener, not bothering." |
| 81 sheriff_emails = ['eseidel@chromium.org'] |
| 82 #return 1 |
79 | 83 |
80 git_cmd = ['git', 'cl', 'upload', '--use-commit-queue', '--send-mail'] | 84 commit_message = """Update FlakyTests to match current flakiness dashboa
rd results |
81 tool.executive.run_command(git_cmd) | 85 |
| 86 Automatically generated using: |
| 87 webkit-patch update-flaky-tests |
| 88 |
| 89 R=%s |
| 90 """ % ','.join(sheriff_emails) |
| 91 |
| 92 git_cmd = ['git', 'commit', '-m', commit_message, |
| 93 fs.join(tool.scm().checkout_root, flaky_tests_path)] |
| 94 tool.executive.run_and_throw_if_fail(git_cmd) |
| 95 |
| 96 git_cmd = ['git', 'cl', 'upload', '--send-mail'] |
| 97 tool.executive.run_and_throw_if_fail(git_cmd) |
82 # If there are changes to git, upload. | 98 # If there are changes to git, upload. |
OLD | NEW |