示例#1
0
 def test_land(self):
     expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning WebKit unit tests\nRunning run-webkit-tests\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\nUpdating bug 50000\n"
     mock_tool = MockTool()
     mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
     mock_tool.checkout().modified_changelogs = Mock(return_value=[])
     self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool)
     # Make sure we're not calling expensive calls too often.
     self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
     self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
 def test_land_diff(self):
     expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\nUpdating bug 42\n"
     mock_tool = MockTool()
     mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
     mock_tool.checkout().modified_changelogs = Mock(return_value=[])
     self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool)
     # Make sure we're not calling expensive calls too often.
     self.assertEqual(mock_tool.scm().create_patch.call_count, 1)
     self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
示例#3
0
 def test_land_diff(self):
     expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\nUpdating bug 42\n"
     mock_tool = MockTool()
     mock_tool.scm().create_patch = Mock()
     mock_tool.checkout().modified_changelogs = Mock(return_value=[])
     self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool)
     # Make sure we're not calling expensive calls too often.
     self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
     self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
示例#4
0
    def test_land(self):
        expected_logs = """Building WebKit
Committed r49824: <https://commits.webkit.org/r49824>
Adding comment and closing bug 50000
"""
        with self.mock_svn_remote():
            mock_tool = MockTool()
            mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
            mock_tool.checkout().modified_changelogs = Mock(return_value=[])
            self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
            # Make sure we're not calling expensive calls too often.
            self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
            self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
    def test_integration_uploads(self):
        command = flakytests.FlakyTests()
        tool = MockTool()
        tool.scm = ChangedExpectationsMockSCM
        command.expectations_factory = FakeBotTestExpectationsFactory
        reviewer = '*****@*****.**'
        options = MockOptions(upload=True, reviewers=reviewer)
        expected_stdout = """Updated /mock-checkout/third_party/WebKit/LayoutTests/FlakyTests
"""
        self.assert_execute_outputs(command,
                                    options=options,
                                    tool=tool,
                                    expected_stdout=expected_stdout)
        self.assertEqual(tool.executive.calls, [
            [
                'git', 'commit', '-m', command.COMMIT_MESSAGE % reviewer,
                '/mock-checkout/third_party/WebKit/LayoutTests/FlakyTests'
            ],
            [
                'git', 'cl', 'upload', '--send-mail', '-f', '--cc',
                '[email protected],[email protected],[email protected]'
            ],
        ])

        port = tool.port_factory.get()
        self.assertEqual(
            tool.filesystem.read_text_file(
                tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')),
            command.FLAKY_TEST_CONTENTS % '')
示例#6
0
 def test_patch_not_relevant_bindings(self):
     self.maxDiff = None
     mock_options = self._step_options()
     mock_options.group = "bindings"
     tool = MockTool(log_executive=True)
     tool.scm()._mockChangedFiles = ["Source/JavaScriptCore/Makefile", "Source/ChangeLog"]
     # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
     tool._deprecated_port = DeprecatedPort()
     step = steps.CheckPatchRelevance(tool, mock_options)
     expected_logs = """Checking relevance of patch
示例#7
0
    def test_patch_relevant(self):
        self.maxDiff = None
        mock_options = self._step_options()
        tool = MockTool(log_executive=True)
        tool.scm()._mockChangedFiles = ["JSTests/MockFile1", "ChangeLog"]
        # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
        tool._deprecated_port = DeprecatedPort()
        step = steps.CheckPatchRelevance(tool, mock_options)
        expected_logs = """Checking relevance of patch
"""
        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
示例#8
0
    def test_patch_not_relevant_jsc(self):
        self.maxDiff = None
        mock_options = self._step_options()
        mock_options.group = "jsc"
        tool = MockTool(log_executive=True)
        tool.scm()._mockChangedFiles = ["Tools/ChangeLog", "Tools/Scripts/webkitpy/tool/steps/steps_unittest.py"]
        # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
        tool._deprecated_port = DeprecatedPort()
        step = steps.CheckPatchRelevance(tool, mock_options)
        expected_logs = """Checking relevance of patch
This patch does not have relevant changes.
"""
        with self.assertRaises(ScriptError):
            OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
示例#9
0
 def test_patch_relevant(self):
     self.maxDiff = None
     mock_options = self._step_options()
     tool = MockTool(log_executive=True)
     tool.scm()._mockChangedFiles = ["JSTests/MockFile1", "ChangeLog"]
     # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
     tool._deprecated_port = DeprecatedPort()
     step = steps.CheckPatchRelevance(tool, mock_options)
     with OutputCapture(level=logging.INFO) as captured:
         step.run({})
     self.assertEqual(
         captured.root.log.getvalue(),
         'Checking relevance of patch\n',
     )
示例#10
0
    def test_integration_uploads(self):
        command = flakytests.FlakyTests()
        tool = MockTool()
        tool.scm = ChangedExpectationsMockSCM
        command.expectations_factory = FakeBotTestExpectationsFactory
        reviewer = '*****@*****.**'
        options = MockOptions(upload=True, reviewers=reviewer)
        expected_stdout = """Updated /mock-checkout/third_party/WebKit/LayoutTests/FlakyTests
"""
        self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout)
        self.assertEqual(tool.executive.calls,
            [
                ['git', 'commit', '-m', command.COMMIT_MESSAGE % reviewer, '/mock-checkout/third_party/WebKit/LayoutTests/FlakyTests'],
                ['git', 'cl', 'upload', '--send-mail', '-f', '--cc', '[email protected],[email protected],[email protected]'],
            ])

        port = tool.port_factory.get()
        self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
示例#11
0
    def test_patch_not_relevant_jsc(self):
        self.maxDiff = None
        mock_options = self._step_options()
        mock_options.group = "jsc"
        tool = MockTool(log_executive=True)
        tool.scm()._mockChangedFiles = [
            "Tools/ChangeLog",
            "Tools/Scripts/webkitpy/tool/steps/steps_unittest.py"
        ]
        # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
        tool._deprecated_port = DeprecatedPort()
        step = steps.CheckPatchRelevance(tool, mock_options)

        with self.assertRaises(ScriptError), OutputCapture(
                level=logging.INFO) as captured:
            step.run({})
        self.assertEqual(
            captured.root.log.getvalue(),
            'Checking relevance of patch\n',
        )