Example #1
0
 def __init__(self, file_path, handle_style_error):
     self._file_path = file_path
     self._handle_style_error = handle_style_error
     self._handle_style_error.turn_off_line_filtering()
     self._tab_checker = TabChecker(file_path, handle_style_error)
     self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)')
     # Determining the port of this expectations.
     try:
         port_name = self._file_path.split(os.sep)[-2]
         if port_name == "chromium":
             options = ChromiumOptions()
             self._port_obj = port.get(port_name=None, options=options)
         else:
             self._port_obj = port.get(port_name=port_name)
     except:
         # Using 'test' port when we couldn't determine the port for this
         # expectations.
         _log.warn("Could not determine the port for %s. "
                   "Using 'test' port, but platform-specific expectations "
                   "will fail the check." % self._file_path)
         self._port_obj = port.get('test')
     # Suppress error messages of test_expectations module since they will be
     # reported later.
     log = logging.getLogger("webkitpy.layout_tests.layout_package."
                             "test_expectations")
     log.setLevel(logging.CRITICAL)
 def __init__(self, file_path, handle_style_error):
     self._file_path = file_path
     self._handle_style_error = handle_style_error
     self._handle_style_error.turn_off_line_filtering()
     self._tab_checker = TabChecker(file_path, handle_style_error)
     self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)')
     # Determining the port of this expectations.
     try:
         port_name = self._file_path.split(os.sep)[-2]
         if port_name == "chromium":
             options = ChromiumOptions()
             self._port_obj = port.get(port_name=None, options=options)
         else:
             self._port_obj = port.get(port_name=port_name)
     except:
         # Using 'test' port when we couldn't determine the port for this
         # expectations.
         _log.warn("Could not determine the port for %s. "
                   "Using 'test' port, but platform-specific expectations "
                   "will fail the check." % self._file_path)
         self._port_obj = port.get('test')
     # Suppress error messages of test_expectations module since they will be
     # reported later.
     log = logging.getLogger("webkitpy.layout_tests.layout_package."
                             "test_expectations")
     log.setLevel(logging.CRITICAL)
Example #3
0
 def make_rebaseliner(self):
     options = MockOptions()
     host_port_obj = port.get('test', options)
     target_options = options
     target_port_obj = port.get('test', target_options)
     platform = 'test'
     return rebaseline_chromium_webkit_tests.Rebaseliner(
         host_port_obj, target_port_obj, platform, options)
Example #4
0
 def make_rebaseliner(self):
     options = MockOptions()
     host_port_obj = port.get('test', options)
     target_options = options
     target_port_obj = port.get('test', target_options)
     platform = 'test'
     return rebaseline_chromium_webkit_tests.Rebaseliner(
         host_port_obj, target_port_obj, platform, options)
 def make_rebaseliner(self):
     options = mocktool.MockOptions(configuration=None,
                                    html_directory=None)
     host_port_obj = port.get('test', options)
     target_options = options
     target_port_obj = port.get('test', target_options)
     platform = 'test'
     return rebaseline_chromium_webkit_tests.Rebaseliner(
         host_port_obj, target_port_obj, platform, options)
 def __init__(self, testFunc):
     test_port = port.get("test-win-xp", None)
     self._converter = TestConfigurationConverter(
         test_port.all_test_configurations(), test_port.configuration_specifier_macros()
     )
     self._serializer = TestExpectationSerializer(self._converter)
     unittest.TestCase.__init__(self, testFunc)
def test_host_port_and_filesystem(options, expectations):
    filesystem = unit_test_filesystem()
    host_port_obj = port.get("test", options, filesystem=filesystem, user=mocktool.MockUser())

    expectations_path = host_port_obj.path_to_test_expectations_file()
    filesystem.write_text_file(expectations_path, expectations)
    return (host_port_obj, filesystem)
    def __init__(self, running_port, target_port, platform, options, url_fetcher, zip_factory, scm):
        """
        Args:
            running_port: the Port the script is running on.
            target_port: the Port the script uses to find port-specific
                configuration information like the test_expectations.txt
                file location and the list of test platforms.
            platform: the test platform to rebaseline
            options: the command-line options object.
            url_fetcher: object that can fetch objects from URLs
            zip_factory: optional object that can fetch zip files from URLs
            scm: scm object for adding new baselines
        """
        self._platform = platform
        self._options = options
        self._port = running_port
        self._filesystem = running_port._filesystem
        self._target_port = target_port

        self._rebaseline_port = port.get(platform, options, filesystem=self._filesystem)
        self._rebaselining_tests = set()
        self._rebaselined_tests = []

        # Create tests and expectations helper which is used to:
        #   -. compile list of tests that need rebaselining.
        #   -. update the tests in test_expectations file after rebaseline
        #      is done.
        expectations_str = self._rebaseline_port.test_expectations()
        self._test_expectations = test_expectations.TestExpectations(
            self._rebaseline_port, None, expectations_str, self._rebaseline_port.test_configuration(), False)
        self._url_fetcher = url_fetcher
        self._zip_factory = zip_factory
        self._scm = scm
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    # Set up our logging format.
    log_level = logging.INFO
    if options.verbose:
        log_level = logging.DEBUG
    logging.basicConfig(level=log_level,
                        format=('%(asctime)s %(filename)s:%(lineno)-3d '
                                '%(levelname)s %(message)s'),
                        datefmt='%y%m%d %H:%M:%S')

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    return real_main(options, target_options, host_port_obj, target_port_obj,
                     url_fetcher, zip_factory, scm_obj)
def test_host_port_and_filesystem(options, expectations):
    filesystem = unit_test_filesystem()
    host_port_obj = port.get('test', options, filesystem=filesystem, user=mocktool.MockUser())

    expectations_path = host_port_obj.path_to_test_expectations_file()
    filesystem.write_text_file(expectations_path, expectations)
    return (host_port_obj, filesystem)
Example #11
0
def make_broker(manager, worker_model, start_queue=None, stop_queue=None):
    global starting_queue
    global stopping_queue
    starting_queue = start_queue
    stopping_queue = stop_queue
    options = get_options(worker_model)
    return manager_worker_broker.get(port.get("test"), options, manager, _TestWorker)
Example #12
0
def make_broker(manager, worker_model, start_queue=None, stop_queue=None):
    global starting_queue
    global stopping_queue
    starting_queue = start_queue
    stopping_queue = stop_queue
    options = get_options(worker_model)
    return manager_worker_broker.get(port.get("test"), options, manager, _TestWorker)
def logging_run(extra_args=None, port_obj=None, tests_included=False):
    extra_args = extra_args or []
    args = ['--no-record-results']
    if not '--platform' in extra_args:
        args.extend(['--platform', 'test'])
    if not '--child-processes' in extra_args:
        args.extend(['--worker-model', 'inline'])
    args.extend(extra_args)
    if not tests_included:
        args.extend(['passes',
                     'http/tests',
                     'websocket/tests',
                     'failures/expected/*'])

    oc = outputcapture.OutputCapture()
    try:
        oc.capture_output()
        options, parsed_args = run_webkit_tests.parse_args(args)
        user = MockUser()
        if not port_obj:
            port_obj = port.get(port_name=options.platform, options=options,
                                user=user)
        buildbot_output = array_stream.ArrayStream()
        regular_output = array_stream.ArrayStream()
        res = run_webkit_tests.run(port_obj, options, parsed_args,
                                   buildbot_output=buildbot_output,
                                   regular_output=regular_output)
    finally:
        oc.restore_output()
    return (res, buildbot_output, regular_output, user)
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    # Set up our logging format.
    log_level = logging.INFO
    if options.verbose:
        log_level = logging.DEBUG
    logging.basicConfig(level=log_level,
                        format=('%(asctime)s %(filename)s:%(lineno)-3d '
                                '%(levelname)s %(message)s'),
                        datefmt='%y%m%d %H:%M:%S')

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    return real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
                     zip_factory, scm_obj)
 def make_generator(self, files, tests):
     options = mocktool.MockOptions(configuration=None, html_directory="/tmp")
     host_port = port.get("test", options, filesystem=unit_test_filesystem(files))
     generator = rebaseline_chromium_webkit_tests.HtmlGenerator(
         host_port, target_port=None, options=options, platforms=["test-mac-leopard"], rebaselining_tests=tests
     )
     return generator, host_port
def passing_run(extra_args=None, port_obj=None, record_results=False, tests_included=False, filesystem=None):
    options, parsed_args = parse_args(extra_args, record_results, tests_included)
    if not port_obj:
        port_obj = port.get(port_name=options.platform, options=options, user=mocktool.MockUser(), filesystem=filesystem)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
    return res == 0 and regular_output.empty() and buildbot_output.empty()
def passing_run(args, port_obj=None, logging_included=False):
    if not logging_included:
        args.extend(['--print', 'nothing'])
    options, args = run_webkit_tests.parse_args(args)
    if port_obj is None:
        port_obj = port.get(options.platform, options)
    res = run_webkit_tests.run(port_obj, options, args)
    return res == 0
def passing_run(args, port_obj=None, logging_included=False):
    if not logging_included:
        args.extend(['--print', 'nothing'])
    options, args = run_webkit_tests.parse_args(args)
    if port_obj is None:
        port_obj = port.get(options.platform, options)
    res = run_webkit_tests.run(port_obj, options, args)
    return res == 0
def logging_run(args):
    options, args = run_webkit_tests.parse_args(args)
    port_obj = port.get(options.platform, options)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj, options, args,
                               buildbot_output=buildbot_output,
                               regular_output=regular_output)
    return (res, buildbot_output, regular_output)
Example #20
0
def passing_run(extra_args=None, port_obj=None, record_results=False,
                tests_included=False, filesystem=None):
    options, parsed_args = parse_args(extra_args, record_results,
                                      tests_included)
    if not port_obj:
        port_obj = port.get(port_name=options.platform, options=options,
                            user=mocktool.MockUser(), filesystem=filesystem)
    res = run_webkit_tests.run(port_obj, options, parsed_args)
    return res == 0
def logging_run(args):
    options, args = run_webkit_tests.parse_args(args)
    port_obj = port.get(options.platform, options)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj, options, args,
                               buildbot_output=buildbot_output,
                               regular_output=regular_output)
    return (res, buildbot_output, regular_output)
 def test_parse_empty_string(self):
     test_port = port.get("test-win-xp", None)
     test_port.test_exists = lambda test: True
     test_config = test_port.test_configuration()
     full_test_list = []
     expectation_line = TestExpectationParser.tokenize("")
     parser = TestExpectationParser(test_port, full_test_list, allow_rebaseline_modifier=False)
     parser.parse(expectation_line)
     self.assertFalse(expectation_line.is_invalid())
 def run(self):
     options = self._options
     port_obj = port.get(self._platform_name, options)
     # FIXME: this won't work if the calling process is logging
     # somewhere other than sys.stderr and sys.stdout, but I'm not sure
     # if this will be an issue in practice.
     printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout,
         int(options.child_processes), options.experimental_fully_parallel)
     self._client.run(port_obj)
     printer.cleanup()
    def test_lint_test_files__errors(self):
        options, parsed_args = parse_args(['--lint-test-files'])
        user = mocktool.MockUser()
        port_obj = port.get(options.platform, options=options, user=user)
        port_obj.test_expectations = lambda: "# syntax error"
        res, out, err = run_and_capture(port_obj, options, parsed_args)

        self.assertEqual(res, -1)
        self.assertTrue(out.empty())
        self.assertTrue(any(['Lint failed' in msg for msg in err.get()]))
Example #25
0
    def test_lint_test_files__errors(self):
        options, parsed_args = parse_args(['--lint-test-files'])
        user = mocktool.MockUser()
        port_obj = port.get(options.platform, options=options, user=user)
        port_obj.test_expectations = lambda: "# syntax error"
        res, out, err = run_and_capture(port_obj, options, parsed_args)

        self.assertEqual(res, -1)
        self.assertTrue(out.empty())
        self.assertTrue(any(['Lint failed' in msg for msg in err.get()]))
def get_host_port_object(options):
    """Return a port object for the platform we're running on."""
    # The only thing we really need on the host is a way to diff
    # text files and image files, which means we need to check that some
    # version of ImageDiff has been built. We will look for either Debug
    # or Release versions of the default port on the platform.
    options.configuration = "Release"
    port_obj = port.get(None, options)
    if not port_obj.check_image_diff(override_step=None, logging=False):
        _log.debug('No release version of the image diff binary was found.')
        options.configuration = "Debug"
        port_obj = port.get(None, options)
        if not port_obj.check_image_diff(override_step=None, logging=False):
            _log.error('No version of image diff was found. Check your build.')
            return None
        else:
            _log.debug('Found the debug version of the image diff binary.')
    else:
        _log.debug('Found the release version of the image diff binary.')
    return port_obj
def get_host_port_object(options):
    """Return a port object for the platform we're running on."""
    # We want the ImageDiff logic to match that of the chromium bots, so we
    # force the use of a Chromium port.  We will look for either Debug or
    # Release versions.
    options.configuration = "Release"
    options.chromium = True
    port_obj = port.get(None, options)
    if not port_obj.check_image_diff(override_step=None, logging=False):
        _log.debug('No release version of the image diff binary was found.')
        options.configuration = "Debug"
        port_obj = port.get(None, options)
        if not port_obj.check_image_diff(override_step=None, logging=False):
            _log.error('No version of image diff was found. Check your build.')
            return None
        else:
            _log.debug('Found the debug version of the image diff binary.')
    else:
        _log.debug('Found the release version of the image diff binary.')
    return port_obj
Example #28
0
def get_host_port_object(options):
    """Return a port object for the platform we're running on."""
    # We want the ImageDiff logic to match that of the chromium bots, so we
    # force the use of a Chromium port.  We will look for either Debug or
    # Release versions.
    options.configuration = "Release"
    options.chromium = True
    port_obj = port.get(None, options)
    if not port_obj.check_image_diff(override_step=None, logging=False):
        _log.debug('No release version of the image diff binary was found.')
        options.configuration = "Debug"
        port_obj = port.get(None, options)
        if not port_obj.check_image_diff(override_step=None, logging=False):
            _log.error('No version of image diff was found. Check your build.')
            return None
        else:
            _log.debug('Found the debug version of the image diff binary.')
    else:
        _log.debug('Found the release version of the image diff binary.')
    return port_obj
def get_host_port_object(options):
    """Return a port object for the platform we're running on."""
    # The only thing we really need on the host is a way to diff
    # text files and image files, which means we need to check that some
    # version of ImageDiff has been built. We will look for either Debug
    # or Release versions of the default port on the platform.
    options.configuration = "Release"
    port_obj = port.get(None, options)
    if not port_obj.check_image_diff(override_step=None, logging=False):
        _log.debug('No release version of the image diff binary was found.')
        options.configuration = "Debug"
        port_obj = port.get(None, options)
        if not port_obj.check_image_diff(override_step=None, logging=False):
            _log.error('No version of image diff was found. Check your build.')
            return None
        else:
            _log.debug('Found the debug version of the image diff binary.')
    else:
        _log.debug('Found the release version of the image diff binary.')
    return port_obj
def logging_run(extra_args=None, port_obj=None, record_results=False, tests_included=False, filesystem=None, new_results=False):
    options, parsed_args = parse_args(extra_args=extra_args,
                                      record_results=record_results,
                                      tests_included=tests_included,
                                      print_nothing=False, new_results=new_results)
    user = mocktool.MockUser()
    if not port_obj:
        port_obj = port.get(port_name=options.platform, options=options, user=user, filesystem=filesystem)

    res, buildbot_output, regular_output = run_and_capture(port_obj, options, parsed_args)
    return (res, buildbot_output, regular_output, user)
 def run(self):
     options = self._options
     port_obj = port.get(self._platform_name, options)
     # FIXME: this won't work if the calling process is logging
     # somewhere other than sys.stderr and sys.stdout, but I'm not sure
     # if this will be an issue in practice.
     printer = printing.Printer(port_obj, options,
                                sys.stderr, sys.stdout,
                                int(options.child_processes),
                                options.experimental_fully_parallel)
     self._client.run(port_obj)
     printer.cleanup()
Example #32
0
    def _test_json_generation(self, passed_tests, failed_tests, skipped_tests):
        # Make sure we have sets (rather than lists).
        passed_tests = set(passed_tests)
        skipped_tests = set(skipped_tests)
        tests_list = passed_tests | set(failed_tests.keys())
        test_timings = {}
        i = 0
        for test in tests_list:
            test_timings[test] = float(self._num_runs * 100 + i)
            i += 1

        port_obj = port.get(None)

        generator = json_results_generator.JSONResultsGenerator(port_obj,
            self.builder_name, self.build_name, self.build_number,
            '',
            None,   # don't fetch past json results archive
            test_timings,
            failed_tests,
            passed_tests,
            skipped_tests,
            tests_list)

        # Test incremental json results
        incremental_json = generator.get_json(incremental=True)
        self._verify_json_results(
            tests_list,
            test_timings,
            passed_tests,
            failed_tests,
            skipped_tests,
            incremental_json,
            1)

        # Test aggregated json results
        generator.set_archived_results(self._json)
        json = generator.get_json(incremental=False)
        self._json = json
        self._num_runs += 1
        self._tests_list |= tests_list
        self._test_timings.update(test_timings)
        self._failed_tests.update(failed_tests)
        self._passed_tests |= passed_tests
        self._skipped_tests |= skipped_tests
        self._verify_json_results(
            self._tests_list,
            self._test_timings,
            self._passed_tests,
            self._failed_tests,
            self._skipped_tests,
            self._json,
            self._num_runs)
    def _test_json_generation(self, passed_tests, failed_tests, skipped_tests):
        # Make sure we have sets (rather than lists).
        passed_tests = set(passed_tests)
        skipped_tests = set(skipped_tests)
        tests_list = passed_tests | set(failed_tests.keys())
        test_timings = {}
        i = 0
        for test in tests_list:
            test_timings[test] = float(self._num_runs * 100 + i)
            i += 1

        port_obj = port.get(None)

        generator = json_results_generator.JSONResultsGenerator(port_obj,
            self.builder_name, self.build_name, self.build_number,
            '',
            None,   # don't fetch past json results archive
            test_timings,
            failed_tests,
            passed_tests,
            skipped_tests,
            tests_list)

        # Test incremental json results
        incremental_json = generator.get_json(incremental=True)
        self._verify_json_results(
            tests_list,
            test_timings,
            passed_tests,
            failed_tests,
            skipped_tests,
            incremental_json,
            1)

        # Test aggregated json results
        generator.set_archived_results(self._json)
        json = generator.get_json(incremental=False)
        self._json = json
        self._num_runs += 1
        self._tests_list |= tests_list
        self._test_timings.update(test_timings)
        self._failed_tests.update(failed_tests)
        self._passed_tests |= passed_tests
        self._skipped_tests |= skipped_tests
        self._verify_json_results(
            self._tests_list,
            self._test_timings,
            self._passed_tests,
            self._failed_tests,
            self._skipped_tests,
            self._json,
            self._num_runs)
Example #34
0
    def get_printer(self, args=None, tty=False):
        args = args or []
        printing_options = printing.print_options()
        option_parser = optparse.OptionParser(option_list=printing_options)
        options, args = option_parser.parse_args(args)
        self._port = port.get('test', options)
        nproc = 2

        regular_output = array_stream.ArrayStream(tty=tty)
        buildbot_output = array_stream.ArrayStream()
        printer = printing.Printer(self._port, options, regular_output,
                                   buildbot_output, configure_logging=True)
        return printer, regular_output, buildbot_output
 def test_eq(self):
     self.assertEquals(
         TestConfiguration("xp", "x86", "release", "cpu"), TestConfiguration("xp", "x86", "release", "cpu")
     )
     self.assertEquals(
         TestConfiguration.from_port(port.get("test-win-xp", None)), TestConfiguration("xp", "x86", "release", "cpu")
     )
     self.assertNotEquals(
         TestConfiguration("xp", "x86", "release", "gpu"), TestConfiguration("xp", "x86", "release", "cpu")
     )
     self.assertNotEquals(
         TestConfiguration("xp", "x86", "debug", "cpu"), TestConfiguration("xp", "x86", "release", "cpu")
     )
 def make_generator(self, files, tests):
     options = mocktool.MockOptions(configuration=None,
                                    html_directory='/tmp')
     host_port = port.get('test',
                          options,
                          filesystem=port.unit_test_filesystem(files))
     generator = rebaseline_chromium_webkit_tests.HtmlGenerator(
         host_port,
         target_port=None,
         options=options,
         platforms=['test-mac-leopard'],
         rebaselining_tests=tests)
     return generator, host_port
def passing_run(extra_args=None,
                port_obj=None,
                record_results=False,
                tests_included=False,
                filesystem=None):
    options, parsed_args = parse_args(extra_args, record_results,
                                      tests_included)
    if not port_obj:
        port_obj = port.get(port_name=options.platform,
                            options=options,
                            user=mocktool.MockUser(),
                            filesystem=filesystem)
    res = run_webkit_tests.run(port_obj, options, parsed_args)
    return res == 0
Example #38
0
    def get_printer(self, args=None, single_threaded=False, is_fully_parallel=False):
        printing_options = printing.print_options()
        option_parser = optparse.OptionParser(option_list=printing_options)
        options, args = option_parser.parse_args(args)
        self._port = port.get("test", options)
        nproc = 2
        if single_threaded:
            nproc = 1

        regular_output = array_stream.ArrayStream()
        buildbot_output = array_stream.ArrayStream()
        printer = printing.Printer(
            self._port, options, regular_output, buildbot_output, single_threaded, is_fully_parallel
        )
        return printer, regular_output, buildbot_output
Example #39
0
    def get_printer(self, args=None, tty=False):
        args = args or []
        printing_options = printing.print_options()
        option_parser = optparse.OptionParser(option_list=printing_options)
        options, args = option_parser.parse_args(args)
        self._port = port.get('test', options)
        nproc = 2

        regular_output = array_stream.ArrayStream(tty=tty)
        buildbot_output = array_stream.ArrayStream()
        printer = printing.Printer(self._port,
                                   options,
                                   regular_output,
                                   buildbot_output,
                                   configure_logging=True)
        return printer, regular_output, buildbot_output
    def make_rebaseliner(self, expectations):
        options = test_options()
        host_port_obj, filesystem = test_host_port_and_filesystem(options, expectations)

        target_options = options
        target_port_obj = port.get('test', target_options,
                                   filesystem=filesystem)
        target_port_obj._expectations = expectations
        platform = target_port_obj.test_platform_name()

        url_fetcher = test_url_fetcher(filesystem)
        zip_factory = test_zip_factory()
        mock_scm = mocktool.MockSCM()
        rebaseliner = rebaseline_chromium_webkit_tests.Rebaseliner(host_port_obj,
            target_port_obj, platform, options, url_fetcher, zip_factory, mock_scm)
        return rebaseliner, filesystem
    def get_printer(self, args=None, single_threaded=False,
                   is_fully_parallel=False):
        printing_options = printing.print_options()
        option_parser = optparse.OptionParser(option_list=printing_options)
        options, args = option_parser.parse_args(args)
        self._port = port.get('test', options)
        nproc = 2
        if single_threaded:
            nproc = 1

        regular_output = array_stream.ArrayStream()
        buildbot_output = array_stream.ArrayStream()
        printer = printing.Printer(self._port, options, regular_output,
                                   buildbot_output, single_threaded,
                                   is_fully_parallel)
        return printer, regular_output, buildbot_output
Example #42
0
        def run(self):
            options = self._options
            port_obj = port.get(self._platform_name, options)

            # The unix multiprocessing implementation clones the
            # log handler configuration into the child processes,
            # but the win implementation doesn't.
            configure_logging = (sys.platform == 'win32')

            # FIXME: this won't work if the calling process is logging
            # somewhere other than sys.stderr and sys.stdout, but I'm not sure
            # if this will be an issue in practice.
            printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout,
                configure_logging)
            self._client.run(port_obj)
            printer.cleanup()
Example #43
0
    def __init__(self,
                 running_port,
                 target_port,
                 platform,
                 options,
                 url_fetcher,
                 zip_factory,
                 scm,
                 logged_before=False):
        """
        Args:
            running_port: the Port the script is running on.
            target_port: the Port the script uses to find port-specific
                configuration information like the test_expectations.txt
                file location and the list of test platforms.
            platform: the test platform to rebaseline
            options: the command-line options object.
            url_fetcher: object that can fetch objects from URLs
            zip_factory: optional object that can fetch zip files from URLs
            scm: scm object for adding new baselines
            logged_before: whether the previous running port logged anything.
        """
        self._platform = platform
        self._options = options
        self._port = running_port
        self._filesystem = running_port._filesystem
        self._target_port = target_port

        self._rebaseline_port = port.get(platform,
                                         options,
                                         filesystem=self._filesystem)
        self._rebaselining_tests = set()
        self._rebaselined_tests = []
        self._logged_before = logged_before
        self.did_log = False

        # Create tests and expectations helper which is used to:
        #   -. compile list of tests that need rebaselining.
        #   -. update the tests in test_expectations file after rebaseline
        #      is done.
        expectations_str = self._rebaseline_port.test_expectations()
        self._test_expectations = test_expectations.TestExpectations(
            self._rebaseline_port, None, expectations_str,
            self._rebaseline_port.test_configuration(), False)
        self._url_fetcher = url_fetcher
        self._zip_factory = zip_factory
        self._scm = scm
Example #44
0
def logging_run(args=[], tests_included=False):
    new_args = ['--no-record-results']
    if not '--platform' in args:
        new_args.extend(['--platform', 'test'])
    new_args.extend(args)
    if not tests_included:
        new_args.extend(['passes',
                         'http/tests'
                         'websocket/tests',
                         'failures/expected/*'])
    options, parsed_args = run_webkit_tests.parse_args(new_args)
    port_obj = port.get(options.platform, options)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj, options, parsed_args,
                               buildbot_output=buildbot_output,
                               regular_output=regular_output)
    return (res, buildbot_output, regular_output)
Example #45
0
def passing_run(args=[],
                port_obj=None,
                record_results=False,
                tests_included=False):
    new_args = ['--print', 'nothing']
    if not '--platform' in args:
        new_args.extend(['--platform', 'test'])
    if not record_results:
        new_args.append('--no-record-results')
    new_args.extend(args)
    if not tests_included:
        # We use the glob to test that globbing works.
        new_args.extend(
            ['passes', 'http/tests', 'websocket/tests', 'failures/expected/*'])
    options, parsed_args = run_webkit_tests.parse_args(new_args)
    if port_obj is None:
        port_obj = port.get(options.platform, options)
    res = run_webkit_tests.run(port_obj, options, parsed_args)
    return res == 0
def logging_run(extra_args=None,
                port_obj=None,
                record_results=False,
                tests_included=False,
                filesystem=None):
    options, parsed_args = parse_args(extra_args=extra_args,
                                      record_results=record_results,
                                      tests_included=tests_included,
                                      print_nothing=False)
    user = mocktool.MockUser()
    if not port_obj:
        port_obj = port.get(port_name=options.platform,
                            options=options,
                            user=user,
                            filesystem=filesystem)

    res, buildbot_output, regular_output = run_and_capture(
        port_obj, options, parsed_args)
    return (res, buildbot_output, regular_output, user)
Example #47
0
def passing_run(args=[], port_obj=None, record_results=False,
                tests_included=False):
    new_args = ['--print', 'nothing']
    if not '--platform' in args:
        new_args.extend(['--platform', 'test'])
    if not record_results:
        new_args.append('--no-record-results')
    new_args.extend(args)
    if not tests_included:
        # We use the glob to test that globbing works.
        new_args.extend(['passes',
                         'http/tests',
                         'websocket/tests',
                         'failures/expected/*'])
    options, parsed_args = run_webkit_tests.parse_args(new_args)
    if port_obj is None:
        port_obj = port.get(options.platform, options)
    res = run_webkit_tests.run(port_obj, options, parsed_args)
    return res == 0
Example #48
0
def logging_run(args=[], tests_included=False):
    new_args = ['--no-record-results']
    if not '--platform' in args:
        new_args.extend(['--platform', 'test'])
    new_args.extend(args)
    if not tests_included:
        new_args.extend(
            ['passes', 'http/tests'
             'websocket/tests', 'failures/expected/*'])
    options, parsed_args = run_webkit_tests.parse_args(new_args)
    port_obj = port.get(options.platform, options)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj,
                               options,
                               parsed_args,
                               buildbot_output=buildbot_output,
                               regular_output=regular_output)
    return (res, buildbot_output, regular_output)
    def make_rebaseliner(self, expectations):
        options = test_options()
        host_port_obj, filesystem = test_host_port_and_filesystem(
            options, expectations)

        target_options = options
        target_port_obj = port.get('test',
                                   target_options,
                                   filesystem=filesystem)
        target_port_obj._expectations = expectations
        platform = target_port_obj.name()

        url_fetcher = test_url_fetcher(filesystem)
        zip_factory = test_zip_factory()
        mock_scm = mocktool.MockSCM(filesystem)
        rebaseliner = rebaseline_chromium_webkit_tests.Rebaseliner(
            host_port_obj, target_port_obj, platform, options, url_fetcher,
            zip_factory, mock_scm)
        return rebaseliner, filesystem
def passing_run(extra_args=None,
                port_obj=None,
                record_results=False,
                tests_included=False,
                filesystem=None):
    options, parsed_args = parse_args(extra_args, record_results,
                                      tests_included)
    if not port_obj:
        port_obj = port.get(port_name=options.platform,
                            options=options,
                            user=mocktool.MockUser(),
                            filesystem=filesystem)
    buildbot_output = array_stream.ArrayStream()
    regular_output = array_stream.ArrayStream()
    res = run_webkit_tests.run(port_obj,
                               options,
                               parsed_args,
                               buildbot_output=buildbot_output,
                               regular_output=regular_output)
    return res == 0 and regular_output.empty() and buildbot_output.empty()
Example #51
0
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    if options.verbose:
        log_level = logging.DEBUG
        log_handler = DebugLogHandler()
    else:
        log_level = logging.INFO
        log_handler = NormalLogHandler()

    logger = logging.getLogger()
    logger.setLevel(log_level)
    logger.addHandler(log_handler)

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
    host_port_obj._filesystem.chdir(scm_obj.checkout_root)

    ret_code = real_main(options, target_options, host_port_obj,
                         target_port_obj, url_fetcher, zip_factory, scm_obj)
    if not ret_code and log_handler.num_failures:
        ret_code = 1
    print ''
    if ret_code:
        print 'Rebaselining failed.'
    else:
        print 'Rebaselining succeeded.'
    return ret_code
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    if options.verbose:
        log_level = logging.DEBUG
        log_handler = DebugLogHandler()
    else:
        log_level = logging.INFO
        log_handler = NormalLogHandler()

    logger = logging.getLogger()
    logger.setLevel(log_level)
    logger.addHandler(log_handler)

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
    host_port_obj._filesystem.chdir(scm_obj.checkout_root)

    ret_code = real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
                         zip_factory, scm_obj)
    if not ret_code and log_handler.num_failures:
        ret_code = 1
    print ''
    if ret_code:
        print 'Rebaselining failed.'
    else:
        print 'Rebaselining succeeded.'
    return ret_code
Example #53
0
    def make_rebaseliner(self, expectations):
        options = test_options()
        host_port_obj, filesystem = test_host_port_and_filesystem(options, expectations)

        target_options = options
        target_port_obj = port.get('test', target_options,
                                   filesystem=filesystem)
        target_port_obj._expectations = expectations
        platform = target_port_obj.name()

        url_fetcher = test_url_fetcher(filesystem)
        zip_factory = test_zip_factory()
        mock_scm = mocktool.MockSCM(filesystem)
        filesystem.maybe_make_directory(mock_scm.checkout_root)

        # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
        filesystem.chdir("/test.checkout")

        rebaseliner = rebaseline_chromium_webkit_tests.Rebaseliner(host_port_obj,
            target_port_obj, platform, options, url_fetcher, zip_factory, mock_scm)
        return rebaseliner, filesystem
    def make_rebaseliner(self, expectations):
        options = test_options()
        host_port_obj, filesystem = test_host_port_and_filesystem(options, expectations)

        target_options = options
        target_port_obj = port.get('test', target_options,
                                   filesystem=filesystem)
        target_port_obj._expectations = expectations
        platform = target_port_obj.name()

        url_fetcher = test_url_fetcher(filesystem)
        zip_factory = test_zip_factory()
        mock_scm = mocktool.MockSCM(filesystem)
        filesystem.maybe_make_directory(mock_scm.checkout_root)

        # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
        filesystem.chdir("/test.checkout")

        rebaseliner = rebaseline_chromium_webkit_tests.Rebaseliner(host_port_obj,
            target_port_obj, platform, options, url_fetcher, zip_factory, mock_scm)
        return rebaseliner, filesystem
Example #55
0
 def test_eq(self):
     self.assertEquals(TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
     self.assertEquals(TestConfiguration.from_port(port.get('test-win-xp', None)), TestConfiguration('xp', 'x86', 'release', 'cpu'))
     self.assertNotEquals(TestConfiguration('xp', 'x86', 'release', 'gpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
     self.assertNotEquals(TestConfiguration('xp', 'x86', 'debug', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
Example #56
0
 def setUp(self):
     self._error_collector = ErrorCollector()
     port_obj = port.get('test')
     self._test_file = 'passes/text.html'
Example #57
0
 def test_from_port(self):
     config = TestConfiguration.from_port(port.get('test-win-xp', None))
     self.assertEquals('<xp, x86, release, cpu>', str(config))
Example #58
0
 def setUp(self):
     port_obj = port.get('test-win-xp', None)
     self.config = port_obj.test_configuration()
     self.matcher = ModifierMatcher(self.config)
Example #59
0
 def __init__(self, testFunc, setUp=None, tearDown=None, description=None):
     self._port = port.get('test-win-xp', None)
     self._fs = self._port._filesystem
     self._exp = None
     unittest.TestCase.__init__(self, testFunc)
 def run(self):
     logging.basicConfig()
     port_obj = port.get(self._platform_name, self._options)
     self._client.run(port_obj)