diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Tools/Scripts/webkitpy/tool/commands/queues_unittest.py | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Tools/Scripts/webkitpy/tool/commands/queues_unittest.py')
-rw-r--r-- | Tools/Scripts/webkitpy/tool/commands/queues_unittest.py | 111 |
1 files changed, 65 insertions, 46 deletions
diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py index 0a32f29be..a09164dde 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py @@ -88,7 +88,7 @@ class AbstractQueueTest(CommandsTest): if port: expected_run_args.append("--port=%s" % port) expected_run_args.extend(run_args) - tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args, cwd='/mock-checkout') + tool.executive.run_command.assert_called_with(expected_run_args, cwd='/mock-checkout') def test_run_webkit_patch(self): self._assert_run_webkit_patch([1]) @@ -134,7 +134,7 @@ class FeederQueueTest(QueuesTest): "begin_work_queue": self._default_begin_work_queue_logs("feeder-queue"), "process_work_item": """Warning, attachment 10001 on bug 50000 has invalid committer (non-committer@example.com) Warning, attachment 10001 on bug 50000 has invalid committer (non-committer@example.com) -MOCK setting flag 'commit-queue' to '-' on attachment '10001' with comment 'Rejecting attachment 10001 from commit-queue.' and additional comment 'non-committer@example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py. +MOCK setting flag 'commit-queue' to '-' on attachment '10001' with comment 'Rejecting attachment 10001 from commit-queue.\n\nnon-committer@example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. @@ -156,7 +156,7 @@ class AbstractPatchQueueTest(CommandsTest): queue.bind_to_tool(tool) queue._options = Mock() queue._options.port = None - self.assertEqual(queue._next_patch(), None) + self.assertIsNone(queue._next_patch()) tool.status_server = MockStatusServer(work_items=[2, 10000, 10001]) expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes. expected_logs = "MOCK: release_work_item: None 2\n" @@ -166,18 +166,20 @@ class AbstractPatchQueueTest(CommandsTest): self.assertEqual(queue._next_patch().id(), 10001) self.assertEqual(queue._next_patch(), None) # When the queue is empty + +class PatchProcessingQueueTest(CommandsTest): def test_upload_results_archive_for_patch(self): - queue = AbstractPatchQueue() + queue = PatchProcessingQueue() queue.name = "mock-queue" tool = MockTool() queue.bind_to_tool(tool) queue._options = Mock() queue._options.port = None patch = queue._tool.bugs.fetch_attachment(10001) - expected_logs = """MOCK add_attachment_to_bug: bug_id=50000, description=Archive of layout-test-results from bot filename=layout-test-results.zip mimetype=None + expected_logs = """MOCK add_attachment_to_bug: bug_id=50000, description=Archive of layout-test-results from bot for mac-snowleopard filename=layout-test-results.zip mimetype=None -- Begin comment -- The attached test failures were seen while running run-webkit-tests on the mock-queue. -Port: MockPort Platform: MockPlatform 1.0 +Port: mac-snowleopard Platform: MockPlatform 1.0 -- End comment -- """ OutputCapture().assert_outputs(self, queue._upload_results_archive_for_patch, [patch, Mock()], expected_logs=expected_logs) @@ -236,18 +238,25 @@ class CommitQueueTest(QueuesTest): tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') expected_logs = { "begin_work_queue": self._default_begin_work_queue_logs("commit-queue"), - "process_work_item": """MOCK: update_status: commit-queue Cleaned working directory + "process_work_item": """Running: webkit-patch --status-host=example.com clean --port=mac +MOCK: update_status: commit-queue Cleaned working directory +Running: webkit-patch --status-host=example.com update --port=mac MOCK: update_status: commit-queue Updated working directory +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 --port=mac MOCK: update_status: commit-queue Applied patch +Running: webkit-patch --status-host=example.com validate-changelog --check-oops --non-interactive 10000 --port=mac MOCK: update_status: commit-queue ChangeLog validated +Running: webkit-patch --status-host=example.com build --no-clean --no-update --build-style=release --port=mac MOCK: update_status: commit-queue Built patch +Running: webkit-patch --status-host=example.com build-and-test --no-clean --no-update --test --non-interactive --port=mac MOCK: update_status: commit-queue Passed tests +Running: webkit-patch --status-host=example.com land-attachment --force-clean --non-interactive --parent-command=commit-queue 10000 --port=mac MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass MOCK: release_work_item: commit-queue 10000 """, "handle_script_error": "ScriptError error message\n\nMOCK output\n", - "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'Mock error message'\n", + "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMock error message'\n", } self.assert_queue_outputs(CommitQueue(), tool=tool, expected_logs=expected_logs) @@ -257,13 +266,13 @@ MOCK: release_work_item: commit-queue 10000 "process_work_item": """MOCK: update_status: commit-queue Cleaned working directory MOCK: update_status: commit-queue Updated working directory MOCK: update_status: commit-queue Patch does not apply -MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'MOCK script error +MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMOCK script error Full output: http://dummy_url' MOCK: update_status: commit-queue Fail MOCK: release_work_item: commit-queue 10000 """, "handle_script_error": "ScriptError error message\n\nMOCK output\n", - "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'Mock error message'\n", + "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMock error message'\n", } queue = CommitQueue() @@ -283,7 +292,7 @@ MOCK: release_work_item: commit-queue 10000 "process_work_item": """MOCK: update_status: commit-queue Cleaned working directory MOCK: update_status: commit-queue Updated working directory MOCK: update_status: commit-queue Patch does not apply -MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'New failing tests: +MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nNew failing tests: mock_test_name.html another_test_name.html Full output: http://dummy_url' @@ -291,7 +300,7 @@ MOCK: update_status: commit-queue Fail MOCK: release_work_item: commit-queue 10000 """, "handle_script_error": "ScriptError error message\n\nMOCK output\n", - "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'Mock error message'\n", + "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMock error message'\n", } queue = CommitQueue() @@ -307,56 +316,56 @@ MOCK: release_work_item: commit-queue 10000 self.assert_queue_outputs(queue, expected_logs=expected_logs) def test_rollout(self): - tool = MockTool(log_executive=True) + tool = MockTool() tool.filesystem.write_text_file('/tmp/layout-test-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') tool.buildbot.light_tree_on_fire() expected_logs = { "begin_work_queue": self._default_begin_work_queue_logs("commit-queue"), - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean', '--port=%(port_name)s'], cwd=/mock-checkout + "process_work_item": """Running: webkit-patch --status-host=example.com clean --port=%(port)s MOCK: update_status: commit-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update', '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com update --port=%(port)s MOCK: update_status: commit-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10000, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 --port=%(port)s MOCK: update_status: commit-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10000, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com validate-changelog --check-oops --non-interactive 10000 --port=%(port)s MOCK: update_status: commit-queue ChangeLog validated -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com build --no-clean --no-update --build-style=release --port=%(port)s MOCK: update_status: commit-queue Built patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive', '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com build-and-test --no-clean --no-update --test --non-interactive --port=%(port)s MOCK: update_status: commit-queue Passed tests -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10000, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com land-attachment --force-clean --non-interactive --parent-command=commit-queue 10000 --port=%(port)s MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass MOCK: release_work_item: commit-queue 10000 -""" % {"port_name": CommitQueue.port_name}, +""" % {"port": "mac"}, "handle_script_error": "ScriptError error message\n\nMOCK output\n", - "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'Mock error message'\n", + "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMock error message'\n", } self.assert_queue_outputs(CommitQueue(), tool=tool, expected_logs=expected_logs) def test_rollout_lands(self): - tool = MockTool(log_executive=True) + tool = MockTool() tool.buildbot.light_tree_on_fire() rollout_patch = tool.bugs.fetch_attachment(10005) # _patch6, a rollout patch. assert(rollout_patch.is_rollout()) expected_logs = { "begin_work_queue": self._default_begin_work_queue_logs("commit-queue"), - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean', '--port=%(port_name)s'], cwd=/mock-checkout + "process_work_item": """Running: webkit-patch --status-host=example.com clean --port=%(port)s MOCK: update_status: commit-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update', '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com update --port=%(port)s MOCK: update_status: commit-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10005, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10005 --port=%(port)s MOCK: update_status: commit-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10005, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com validate-changelog --check-oops --non-interactive 10005 --port=%(port)s MOCK: update_status: commit-queue ChangeLog validated -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10005, '--port=%(port_name)s'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com land-attachment --force-clean --non-interactive --parent-command=commit-queue 10005 --port=%(port)s MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass MOCK: release_work_item: commit-queue 10005 -""" % {"port_name": CommitQueue.port_name}, +""" % {"port": "mac"}, "handle_script_error": "ScriptError error message\n\nMOCK output\n", - "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10005' with comment 'Rejecting attachment 10005 from commit-queue.' and additional comment 'Mock error message'\n", + "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10005' with comment 'Rejecting attachment 10005 from commit-queue.\n\nMock error message'\n", } self.assert_queue_outputs(CommitQueue(), tool=tool, work_item=rollout_patch, expected_logs=expected_logs) @@ -373,9 +382,9 @@ MOCK: update_status: commit-queue Tests passed, but commit failed (checkout out state = {'patch': None} OutputCapture().assert_outputs(self, sequence.run_and_handle_errors, [tool, options, state], expected_exception=TryAgain, expected_logs=expected_logs) - self.assertEqual(options.update, True) - self.assertEqual(options.build, False) - self.assertEqual(options.test, False) + self.assertTrue(options.update) + self.assertFalse(options.build) + self.assertFalse(options.test) def test_manual_reject_during_processing(self): queue = SecondThoughtsCommitQueue(MockTool()) @@ -384,15 +393,22 @@ MOCK: update_status: commit-queue Tests passed, but commit failed (checkout out queue._tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') queue._options = Mock() queue._options.port = None - expected_logs = """MOCK: update_status: commit-queue Cleaned working directory + expected_logs = """Running: webkit-patch --status-host=example.com clean --port=mac +MOCK: update_status: commit-queue Cleaned working directory +Running: webkit-patch --status-host=example.com update --port=mac MOCK: update_status: commit-queue Updated working directory +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 --port=mac MOCK: update_status: commit-queue Applied patch +Running: webkit-patch --status-host=example.com validate-changelog --check-oops --non-interactive 10000 --port=mac MOCK: update_status: commit-queue ChangeLog validated +Running: webkit-patch --status-host=example.com build --no-clean --no-update --build-style=release --port=mac MOCK: update_status: commit-queue Built patch +Running: webkit-patch --status-host=example.com build-and-test --no-clean --no-update --test --non-interactive --port=mac MOCK: update_status: commit-queue Passed tests MOCK: update_status: commit-queue Retry MOCK: release_work_item: commit-queue 10000 """ + self.maxDiff = None OutputCapture().assert_outputs(self, queue.process_work_item, [QueuesTest.mock_work_item], expected_logs=expected_logs) def test_report_flaky_tests(self): @@ -449,15 +465,15 @@ class StyleQueueTest(QueuesTest): def test_style_queue_with_style_exception(self): expected_logs = { "begin_work_queue": self._default_begin_work_queue_logs("style-queue"), - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout + "process_work_item": """Running: webkit-patch --status-host=example.com clean MOCK: update_status: style-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com update MOCK: update_status: style-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10000], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 MOCK: update_status: style-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-watchlist-local', 50000], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-watchlist-local 50000 MOCK: update_status: style-queue Watchlist applied -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'check-style-local', '--non-interactive', '--quiet'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com check-style-local --non-interactive --quiet MOCK: update_status: style-queue Style checked MOCK: update_status: style-queue Pass MOCK: release_work_item: style-queue 10000 @@ -465,21 +481,24 @@ MOCK: release_work_item: style-queue 10000 "handle_unexpected_error": "Mock error message\n", "handle_script_error": "MOCK output\n", } - tool = MockTool(log_executive=True, executive_throws_when_run=set(['check-style'])) + tool = MockTool(executive_throws_when_run=set(['check-style'])) self.assert_queue_outputs(StyleQueue(), expected_logs=expected_logs, tool=tool) def test_style_queue_with_watch_list_exception(self): expected_logs = { "begin_work_queue": self._default_begin_work_queue_logs("style-queue"), - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout + "process_work_item": """Running: webkit-patch --status-host=example.com clean MOCK: update_status: style-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com update MOCK: update_status: style-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10000], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 MOCK: update_status: style-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-watchlist-local', 50000], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com apply-watchlist-local 50000 +Exception for ['echo', '--status-host=example.com', 'apply-watchlist-local', 50000] + +MOCK command output MOCK: update_status: style-queue Unabled to apply watchlist -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'check-style-local', '--non-interactive', '--quiet'], cwd=/mock-checkout +Running: webkit-patch --status-host=example.com check-style-local --non-interactive --quiet MOCK: update_status: style-queue Style checked MOCK: update_status: style-queue Pass MOCK: release_work_item: style-queue 10000 @@ -487,5 +506,5 @@ MOCK: release_work_item: style-queue 10000 "handle_unexpected_error": "Mock error message\n", "handle_script_error": "MOCK output\n", } - tool = MockTool(log_executive=True, executive_throws_when_run=set(['apply-watchlist-local'])) + tool = MockTool(executive_throws_when_run=set(['apply-watchlist-local'])) self.assert_queue_outputs(StyleQueue(), expected_logs=expected_logs, tool=tool) |