def test_rebaseline_command_line_flags(self):
        old_exact_matches = builders._exact_matches
        try:
            builders._exact_matches = {
                "MOCK builder": {
                    "port_name": "test-mac-leopard",
                    "specifiers": set(["mock-specifier"])
                },
            }

            command = Rebaseline()
            tool = MockTool()
            command.bind_to_tool(tool)

            for port_name in tool.port_factory.all_port_names():
                port = tool.port_factory.get(port_name)
                for path in port.expectations_files():
                    tool.filesystem.write_text_file(path, '')

            tool.executive = MockExecutive(should_log=True)

            expected_stdout = """rebaseline-json: {'mock/path/to/test.html': {'MOCK builder': ['txt']}}
"""

            expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt', 'mock/path/to/test.html'], cwd=/mock-checkout
"""

            builder = "MOCK builder"
            test = "mock/path/to/test.html"
            OutputCapture().assert_outputs(
                self,
                command.execute, [
                    MockOptions(optimize=True,
                                builders=[builder],
                                suffixes=["txt"],
                                verbose=True), [test], tool
                ],
                expected_stdout=expected_stdout,
                expected_stderr=expected_stderr)

        finally:
            builders._exact_matches = old_exact_matches
Ejemplo n.º 2
0
 def _assert_search_path(self,
                         search_paths,
                         os_name,
                         use_webkit2=False,
                         qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host,
                           qt_version=qt_version,
                           port_name=port_name,
                           options=MockOptions(
                               webkit_test_runner=use_webkit2,
                               platform='qt'))
     absolute_search_paths = map(port._webkit_baseline_path, search_paths)
     self.assertEqual(port.baseline_search_path(), absolute_search_paths)
Ejemplo n.º 3
0
    def test_stop(self):
        port = Port(MockSystemHost(log_executive=True),
                    'xvfbdrivertestport',
                    options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info(
            "MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()

        expected_logs = "MOCK kill_process pid: 1234\n"
        OutputCapture().assert_outputs(self,
                                       driver.stop, [],
                                       expected_logs=expected_logs)

        self.assertIsNone(driver._xvfb_process)
Ejemplo n.º 4
0
    def test_failing_tests_message(self):
        # Needed to define port_name, used in AbstractEarlyWarningSystem.__init__
        class TestEWS(AbstractEarlyWarningSystem):
            port_name = "win"  # Needs to be a port which port/factory understands.

        ews = TestEWS()
        ews.bind_to_tool(MockTool())
        ews._options = MockOptions(port=None, confirm=False)
        OutputCapture().assert_outputs(
            self,
            ews.begin_work_queue,
            expected_logs=self._default_begin_work_queue_logs(ews.name))
        ews._expected_failures.unexpected_failures_observed = lambda results: set(
            ["foo.html", "bar.html"])
        task = Mock()
        task.results_from_patch_test_run = lambda a: None
        patch = ews._tool.bugs.fetch_attachment(10000)
        self.assertMultiLineEqual(ews._failing_tests_message(task, patch),
                                  "New failing tests:\nbar.html\nfoo.html")
Ejemplo n.º 5
0
    def run_test(self, tests, expected_stdout, platform='test-win-xp', **args):
        options = MockOptions(all=False,
                              csv=False,
                              full=False,
                              platform=platform,
                              include_keyword=[],
                              exclude_keyword=[]).update(**args)
        tool = MockTool()
        tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANTS
        command = PrintExpectations()
        command.bind_to_tool(tool)

        oc = OutputCapture()
        try:
            oc.capture_output()
            command.execute(options, tests, tool)
        finally:
            stdout, _, _ = oc.restore_output()
        self.assertEquals(stdout, expected_stdout)
Ejemplo n.º 6
0
 def test_multiple(self):
     command = PrintBaselines()
     command.bind_to_tool(self.tool)
     self.capture_output()
     command.execute(
         MockOptions(all=False, csv=False, platform='test-win-*'),
         ['passes/text.html'], self.tool)
     stdout, _, _ = self.restore_output()
     self.assertMultiLineEqual(stdout, ('// For test-win-vista\n'
                                        'passes/text-expected.png\n'
                                        'passes/text-expected.txt\n'
                                        '\n'
                                        '// For test-win-7sp0\n'
                                        'passes/text-expected.png\n'
                                        'passes/text-expected.txt\n'
                                        '\n'
                                        '// For test-win-xp\n'
                                        'passes/text-expected.png\n'
                                        'passes/text-expected.txt\n'))
Ejemplo n.º 7
0
 def _default_options(self):
     options = MockOptions()
     options.build = True
     options.build_style = "release"
     options.check_style = True
     options.check_style_filter = None
     options.clean = True
     options.close_bug = True
     options.force_clean = False
     options.non_interactive = False
     options.parent_command = 'MOCK parent command'
     options.quiet = False
     options.test = True
     options.update = True
     options.architecture = 'MOCK ARCH'
     options.iterate_on_new_tests = 0
     options.group = None
     options.sort_xcode_project = False
     return options
Ejemplo n.º 8
0
 def test_run(self,
              verbose=0,
              timing=False,
              child_processes=1,
              quiet=False):
     options = MockOptions(verbose=verbose,
                           timing=timing,
                           child_processes=child_processes,
                           quiet=quiet,
                           pass_through=False)
     stream = StringIO.StringIO()
     loader = FakeLoader(('test1 (Foo)', '.', ''),
                         ('test2 (Foo)', 'F', 'test2\nfailed'),
                         ('test3 (Foo)', 'E', 'test3\nerred'))
     runner = Runner(Printer(stream, options), loader)
     runner.run(['Foo.test1', 'Foo.test2', 'Foo.test3'], 1)
     self.assertEqual(runner.tests_run, 3)
     self.assertEqual(len(runner.failures), 1)
     self.assertEqual(len(runner.errors), 1)
    def test_rebaseline(self):
        # This test basically tests the path from command.execute() to command._rebaseline();
        # it doesn't test that _rebaseline() actually does anything (that is tested in TestRebaselineJson.
        self.test_list = {}

        def rebaseline_stub(options, test_list):
            self.test_list = test_list

        self.command._builders_to_pull_from = lambda: [
            MockBuilder('MOCK builder')
        ]
        self.command._tests_to_update = lambda builder: [
            'mock/path/to/test.html'
        ]
        self.command._rebaseline = rebaseline_stub

        self._zero_out_test_expectations()

        old_exact_matches = builders._exact_matches
        oc = OutputCapture()
        try:
            builders._exact_matches = {
                "MOCK builder": {
                    "port_name": "test-mac-leopard",
                    "specifiers": set(["mock-specifier"])
                },
            }
            oc.capture_output()
            self.command.execute(
                MockOptions(optimize=True,
                            builders=None,
                            suffixes=["txt"],
                            verbose=True), [], self.tool)
        finally:
            oc.restore_output()
            builders._exact_matches = old_exact_matches

        self.assertEquals(
            self.test_list,
            {'mock/path/to/test.html': {
                'MOCK builder': ['txt']
            }})
Ejemplo n.º 10
0
 def assert_run(self,
                verbose=0,
                timing=False,
                child_processes=1,
                quiet=False):
     options = MockOptions(verbose=verbose,
                           timing=timing,
                           child_processes=child_processes,
                           quiet=quiet,
                           pass_through=False)
     stream = StringIO.StringIO()
     loader = FakeLoader(('test1 (Foo)', '.', ''),
                         ('test2 (Foo)', 'F', 'test2\nfailed'),
                         ('test3 (Foo)', 'E', 'test3\nerred'))
     runner = Runner(Printer(stream, options), options, loader)
     result = runner.run(loader.top_suite())
     self.assertFalse(result.wasSuccessful())
     self.assertEquals(result.testsRun, 3)
     self.assertEquals(len(result.failures), 1)
     self.assertEquals(len(result.errors), 1)
 def test_ensure_bug_url(self):
     capture = OutputCapture()
     step = PrepareChangeLog(MockTool(), MockOptions())
     changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate,
                                       self._example_changelog)
     changelog_path = self._write_tmp_file_with_contents(
         changelog_contents.encode("utf-8"))
     state = {
         "bug_title": "Example title",
         "bug_id": 1234,
         "changelogs": [changelog_path],
     }
     capture.assert_outputs(self, step.run, [state])
     actual_contents = self._read_file_contents(changelog_path, "utf-8")
     expected_message = "Example title\n        http://example.com/1234"
     expected_contents = changelog_contents.replace(
         "Need a short description and bug URL (OOPS!)", expected_message)
     os.remove(changelog_path)
     self.assertEquals(actual_contents.splitlines(),
                       expected_contents.splitlines())
Ejemplo n.º 12
0
    def test_webkit_run_unit_tests(self):
        tool = MockTool(log_executive=True)
        tool._deprecated_port.run_python_unittests_command = lambda: None
        tool._deprecated_port.run_perl_unittests_command = lambda: None
        step = RunTests(tool, MockOptions(test=True, non_interactive=True, quiet=False, build_style="release", iterate_on_new_tests=0, group=None))

        if sys.platform != "cygwin":
            expected_logs = """Running bindings generation tests
MOCK run_and_throw_if_fail: ['mock-run-bindings-tests'], cwd=/mock-checkout
Running run-webkit-tests
MOCK run_and_throw_if_fail: ['mock-run-webkit-tests', '--no-new-test-results', '--no-show-results', '--exit-after-n-failures=30', '--quiet', '--skip-failing-tests'], cwd=/mock-checkout
"""
        else:
            expected_logs = """Running bindings generation tests
MOCK run_and_throw_if_fail: ['mock-run-bindings-tests'], cwd=/mock-checkout
Running run-webkit-tests
MOCK run_and_throw_if_fail: ['mock-run-webkit-tests', '--no-new-test-results', '--no-show-results', '--exit-after-n-failures=30', '--no-build'], cwd=/mock-checkout
"""

        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
Ejemplo n.º 13
0
    def test_no_optimize(self):
        options = MockOptions(optimize=False,
                              verbose=True,
                              move_overwritten_baselines=False,
                              results_directory=None,
                              update_expectations=True)
        self.command._rebaseline(
            options, {
                "user-scripts/another-test.html": {
                    "MOCK builder (Debug)": ["txt", "png"]
                }
            })

        # Note that we have only one run_in_parallel() call
        self.assertEqual(self.tool.executive.calls, [[[
            'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
            '--builder', 'MOCK builder (Debug)', '--test',
            'user-scripts/another-test.html', '--update-expectations', 'True',
            '--verbose'
        ]]])
Ejemplo n.º 14
0
 def test_command_aliases(self):
     tool = MockTool()
     options = MockOptions()
     options.ensure_value("confirm", False)
     sheriffbot = SheriffBot()
     sheriffbot.execute(options, [], tool, MockQueueEngine)
     sheriffbot.begin_work_queue()
     irc_bot = sheriffbot._irc_bot
     # Test Rollout command aliases
     revert_command, args = irc_bot._parse_command_and_args("revert")
     self.assertEqual(revert_command, Rollout)
     # Test Sheriffs command aliases
     gardeners_command, args = irc_bot._parse_command_and_args("gardeners")
     self.assertEqual(gardeners_command, Sheriffs)
     sherifs_command, args = irc_bot._parse_command_and_args("sherifs")
     self.assertEqual(sherifs_command, Sheriffs)
     sherrifs_command, args = irc_bot._parse_command_and_args("sherrifs")
     self.assertEqual(sherrifs_command, Sheriffs)
     sherriffs_command, args = irc_bot._parse_command_and_args("sherriffs")
     self.assertEqual(sherriffs_command, Sheriffs)
 def _assert_start_line_produces_output(self,
                                        start_line,
                                        should_fail=False,
                                        non_interactive=False):
     tool = MockTool()
     tool._checkout.is_path_to_changelog = lambda path: True
     step = ValidateChangeLogs(
         tool, MockOptions(git_commit=None,
                           non_interactive=non_interactive))
     diff_file = Mock()
     diff_file.filename = "mock/ChangeLog"
     diff_file.lines = [(start_line, start_line, "foo")]
     expected_stdout = expected_stderr = ""
     if should_fail and not non_interactive:
         expected_stderr = "The diff to mock/ChangeLog looks wrong.  Are you sure your ChangeLog entry is at the top of the file?\nOK to continue?\n"
     result = OutputCapture().assert_outputs(
         self,
         step._check_changelog_diff, [diff_file],
         expected_stderr=expected_stderr)
     self.assertEqual(not result, should_fail)
Ejemplo n.º 16
0
    def test_post(self):
        options = MockOptions()
        options.cc = None
        options.check_style = True
        options.check_style_filter = None
        options.comment = None
        options.description = "MOCK description"
        options.request_commit = False
        options.review = True
        options.suggest_reviewers = False
        expected_logs = """MOCK: user.open_url: file://...
Was that diff correct?
Obsoleting 2 old patches on bug 50000
MOCK reassign_bug: bug_id=50000, assignee=None
MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False
MOCK: user.open_url: http://example.com/50000
"""
        self.assert_execute_outputs(Post(), [50000],
                                    options=options,
                                    expected_logs=expected_logs)
    def test_rebaseline_expectations(self):
        self._zero_out_test_expectations()

        self.tool.executive = MockExecutive2()

        self.command._tests_to_rebaseline = lambda port: {
            'userscripts/another-test.html': set(['txt']),
            'userscripts/images.svg': set(['png'])
        }
        self.command.execute(
            MockOptions(optimize=False,
                        verbose=False,
                        move_overwritten_baselines=False,
                        results_directory=None), [], self.tool)

        # FIXME: change this to use the test- ports.
        calls = filter(lambda x: x != ['qmake', '-v'],
                       self.tool.executive.calls)
        self.assertTrue(len(calls) == 1)
        self.assertTrue(len(calls[0]) == 26)
Ejemplo n.º 18
0
    def _assert_start_line_produces_output(self, start_line, should_fail=False, non_interactive=False):
        tool = MockTool()
        step = ValidateChangeLogs(tool, MockOptions(git_commit=None, non_interactive=non_interactive))
        diff_file = Mock()
        diff_file.filename = "mock/ChangeLog"
        diff_file.lines = [(start_line, start_line, "foo")]

        with OutputCapture(level=logging.INFO) as captured:
            result = step._check_changelog_diff(diff_file)
        self.assertEqual(not result, should_fail)

        self.assertEqual(captured.stdout.getvalue(), '')
        self.assertEqual(captured.stderr.getvalue(), '')
        if should_fail and not non_interactive:
            self.assertEqual(
                captured.root.log.getvalue(),
                'The diff to mock/ChangeLog looks wrong. Are you sure your ChangeLog entry is at the top of the file?\nOK to continue?\n',
            )
        else:
            self.assertEqual(captured.root.log.getvalue(), '')
Ejemplo n.º 19
0
    def test_rebaseline(self):
        self.command._builders_to_pull_from = lambda: [
            MockBuilder('MOCK builder')
        ]
        self.command._tests_to_update = lambda builder: [
            'mock/path/to/test.html'
        ]

        self._zero_out_test_expectations()

        old_exact_matches = builders._exact_matches
        oc = OutputCapture()
        try:
            builders._exact_matches = {
                "MOCK builder": {
                    "port_name": "test-mac-leopard",
                    "specifiers": set(["mock-specifier"])
                },
            }
            oc.capture_output()
            self.command.execute(
                MockOptions(optimize=False,
                            builders=None,
                            suffixes="txt,png",
                            verbose=True,
                            move_overwritten_baselines=False,
                            update_expectations=True), [], self.tool)
        finally:
            oc.restore_output()
            builders._exact_matches = old_exact_matches

        calls = list(
            filter(
                lambda x: x[
                    0] not in ['perl', '/usr/bin/xcrun', '/usr/bin/ulimit'],
                self.tool.executive.calls))
        self.assertEqual(calls, [[[
            'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
            '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html',
            '--update-expectations', 'True', '--verbose'
        ]]])
Ejemplo n.º 20
0
    def test_expectations_ordering(self):
        port = self.make_port()
        for path in port.expectations_files():
            port._filesystem.write_text_file(path, '')
        ordered_dict = port.expectations_dict()
        self.assertEqual(port.path_to_generic_test_expectations_file(),
                         ordered_dict.keys()[0])
        self.assertEqual(
            port.path_to_test_expectations_file(),
            ordered_dict.keys()[port.test_expectations_file_position()])

        options = MockOptions(additional_expectations=['/tmp/foo', '/tmp/bar'])
        port = self.make_port(options=options)
        for path in port.expectations_files():
            port._filesystem.write_text_file(path, '')
        port._filesystem.write_text_file('/tmp/foo', 'foo')
        port._filesystem.write_text_file('/tmp/bar', 'bar')
        ordered_dict = port.expectations_dict()
        self.assertEqual(ordered_dict.keys()[-2:],
                         options.additional_expectations)  # pylint: disable=E1101
        self.assertEqual(ordered_dict.values()[-2:], ['foo', 'bar'])
Ejemplo n.º 21
0
    def test_run(self):
        capture = OutputCapture()
        options = MockOptions(git_commit='MOCK git commit')

        files = {
            '/Users/mock/.subversion/config':
            'enable-auto-props = yes\n*.png = svn:mime-type=image/png'
        }
        fs = MockFileSystem(files)
        scm = MockSCMDetector('git')

        step = AddSvnMimetypeForPng(
            MockTool(), options, MockSystemHost(os_name='linux',
                                                filesystem=fs), scm)
        state = {
            "changed_files": ["test.png", "test.txt"],
        }
        try:
            capture.assert_outputs(self, step.run, [state])
        except SystemExit, e:
            self.assertEqual(e.code, 1)
Ejemplo n.º 22
0
 def test_ensure_bug_url(self):
     capture = OutputCapture()
     step = PrepareChangeLog(MockTool(), MockOptions())
     changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate,
                                       self._example_changelog)
     changelog_path = "ChangeLog"
     state = {
         "bug_title": "Example title",
         "bug_id": 1234,
         "changelogs": [changelog_path],
     }
     step._tool.filesystem = MockFileSystem()
     step._tool.filesystem.write_text_file(changelog_path,
                                           changelog_contents)
     capture.assert_outputs(self, step._ensure_bug_url, [state])
     actual_contents = step._tool.filesystem.read_text_file(changelog_path)
     expected_message = "Example title\n        http://example.com/1234"
     expected_contents = changelog_contents.replace(
         "Need a short description (OOPS!).\n        Need the bug URL (OOPS!).",
         expected_message)
     self.assertEqual(actual_contents, expected_contents)
Ejemplo n.º 23
0
    def test_update_command_non_interactive(self):
        tool = MockTool()
        options = MockOptions(non_interactive=True)
        step = Update(tool, options)
        self.assertEqual(["mock-update-webkit"], step._update_command())

        tool._deprecated_port = ChromiumPort()
        self.assertEqual(
            ["Tools/Scripts/update-webkit", "--chromium", "--force-update"],
            step._update_command())

        tool._deprecated_port = ChromiumXVFBPort()
        self.assertEqual(
            ["Tools/Scripts/update-webkit", "--chromium", "--force-update"],
            step._update_command())

        tool._deprecated_port = ChromiumAndroidPort()
        self.assertEqual([
            "Tools/Scripts/update-webkit", "--chromium", "--force-update",
            "--chromium-android"
        ], step._update_command())
    def test_can_build(self):
        # Needed to define port_name, used in AbstractEarlyWarningSystem.__init__
        class TestEWS(AbstractEarlyWarningSystem):
            port_name = "win"  # Needs to be a port which port/factory understands.

        queue = TestEWS()
        queue.bind_to_tool(MockTool(log_executive=True))
        queue._options = MockOptions(port=None)
        expected_stderr = "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--port=win', '--build-style=release', '--force-clean', '--no-update']\n"
        OutputCapture().assert_outputs(self,
                                       queue._can_build, [],
                                       expected_stderr=expected_stderr)

        def mock_run_webkit_patch(args):
            raise ScriptError("MOCK script error")

        queue.run_webkit_patch = mock_run_webkit_patch
        expected_stderr = "MOCK: update_status: None Unable to perform a build\n"
        OutputCapture().assert_outputs(self,
                                       queue._can_build, [],
                                       expected_stderr=expected_stderr)
    def test_rebaseline(self):
        self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder')]

        self._write("userscripts/first-test.html", "test data")

        self._zero_out_test_expectations()
        self._setup_mock_builder_data()

        old_exact_matches = builders._exact_matches
        try:
            builders._exact_matches = {
                "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
            }
            self.command.execute(MockOptions(results_directory=False, optimize=False, builders=None, suffixes="txt,png", verbose=True), ['userscripts/first-test.html'], self.tool)
        finally:
            builders._exact_matches = old_exact_matches

        calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.tool.executive.calls)
        self.assertEqual(calls,
            [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose']],
             [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose']]])
Ejemplo n.º 26
0
    def test_rebaseline_multiple_builders(self):
        old_exact_matches = builders._exact_matches
        try:
            builders._exact_matches = {
                "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
                "MOCK builder2": {"port_name": "test-mac-snowleopard", "specifiers": set(["mock-specifier2"])},
            }

            command = Rebaseline()
            tool = MockTool()
            command.bind_to_tool(tool)

            for port_name in tool.port_factory.all_port_names():
                port = tool.port_factory.get(port_name)
                for path in port.expectations_files():
                    tool.filesystem.write_text_file(path, '')

            tool.executive = MockExecutive(should_log=True)

            def mock_builders_to_pull_from():
                return [MockBuilder('MOCK builder'), MockBuilder('MOCK builder2')]

            def mock_tests_to_update(build):
                return ['mock/path/to/test.html']

            command._builders_to_pull_from = mock_builders_to_pull_from
            command._tests_to_update = mock_tests_to_update

            expected_stdout = """rebaseline-json: {'mock/path/to/test.html': {'MOCK builder2': ['txt'], 'MOCK builder': ['txt']}}
"""

            expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK builder2', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt', 'mock/path/to/test.html'], cwd=/mock-checkout
"""

            OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True, builders=None, suffixes=["txt"], verbose=True), [], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr)

        finally:
            builders._exact_matches = old_exact_matches
Ejemplo n.º 27
0
 def make_port(self,
               host=None,
               port_name=None,
               options=None,
               os_name=None,
               os_version=Version(5),
               **kwargs):
     if options:
         options.architecture = 'x86'
         options.webkit_test_runner = True
     else:
         options = MockOptions(architecture='x86',
                               webkit_test_runner=True,
                               configuration='Release')
     port = super(WatchTest, self).make_port(host=host,
                                             port_name=port_name,
                                             options=options,
                                             os_name=os_name,
                                             os_version=None,
                                             kwargs=kwargs)
     port.set_option('version', str(os_version))
     return port
Ejemplo n.º 28
0
 def make_port(self,
               host=None,
               port_name=None,
               options=None,
               os_name=None,
               os_version=None,
               config=None,
               **kwargs):
     host = host or MockSystemHost(os_name=(os_name or self.os_name),
                                   os_version=(os_version
                                               or self.os_version))
     options = options or MockOptions(configuration='Release')
     config = config or MockConfig(filesystem=host.filesystem,
                                   default_configuration='Release')
     port_name = port_name or self.port_name
     port_name = self.port_maker.determine_full_port_name(
         host, options, port_name)
     return self.port_maker(host,
                            port_name,
                            options=options,
                            config=config,
                            **kwargs)
Ejemplo n.º 29
0
    def test_upload_with_no_review_and_ews(self):
        options = MockOptions()
        options.cc = None
        options.check_style = True
        options.check_style_filter = None
        options.comment = None
        options.description = 'MOCK description'
        options.non_interactive = False
        options.request_commit = False
        options.review = False
        options.ews = True
        options.sort_xcode_project = False
        options.suggest_reviewers = False
        expected_logs = """MOCK: user.open_url: file://...
Was that diff correct?
Obsoleting 2 old patches on bug 50000
MOCK reassign_bug: bug_id=50000, assignee=None
MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=False
MOCK: user.open_url: http://example.com/50000
MOCK: submit_to_ews: 10001
"""
        self.assert_execute_outputs(Upload(), [50000], options=options, expected_logs=expected_logs)
    def test_rebaseline_directory(self):
        self.command._builders_to_pull_from = lambda: [
            MockBuilder('MOCK builder')
        ]
        self.command._tests_to_update = lambda builder: ['userscripts']

        self._write("userscripts/first-test.html", "test data")
        self._write("userscripts/second-test.html", "test data")

        old_exact_matches = builders._exact_matches
        try:
            builders._exact_matches = {
                "MOCK builder": {
                    "port_name": "test-mac-leopard",
                    "specifiers": set(["mock-specifier"])
                },
            }
            self.command.execute(
                MockOptions(optimize=False,
                            builders=None,
                            suffixes="txt,png",
                            verbose=True,
                            move_overwritten_baselines=False), [], self.tool)
        finally:
            builders._exact_matches = old_exact_matches

        calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl',
                       self.tool.executive.calls)
        self.assertEqual(
            calls, [[[
                'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
                '--builder', 'MOCK builder', '--test',
                'userscripts/first-test.html', '--verbose'
            ],
                     [
                         'echo', 'rebaseline-test-internal', '--suffixes',
                         'txt,png', '--builder', 'MOCK builder', '--test',
                         'userscripts/second-test.html', '--verbose'
                     ]]])