Example #1
0
def run(port, options, args, regular_output=sys.stderr, buildbot_output=sys.stdout):
    """Run the tests.

    Args:
      port: Port object for port-specific behavior
      options: a dictionary of command line options
      args: a list of sub directories or files to test
      regular_output: a stream-like object that we can send logging/debug
          output to
      buildbot_output: a stream-like object that we can write all output that
          is intended to be parsed by the buildbot to
    Returns:
      the number of unexpected results that occurred, or -1 if there is an
          error.

    """
    warnings = _set_up_derived_options(port, options)

    printer = printing.Printer(port, options, regular_output, buildbot_output, configure_logging=True)
    for w in warnings:
        _log.warning(w)

    if options.help_printing:
        printer.help_printing()
        printer.cleanup()
        return 0

    # We wrap any parts of the run that are slow or likely to raise exceptions
    # in a try/finally to ensure that we clean up the logging configuration.
    num_unexpected_results = -1
    try:
        manager = Manager(port, options, printer)
        manager.print_config()

        printer.print_update("Collecting tests ...")
        try:
            manager.collect_tests(args)
        except IOError, e:
            if e.errno == errno.ENOENT:
                return -1
            raise

        if options.lint_test_files:
            return manager.lint()

        printer.print_update("Checking build ...")
        if not port.check_build(manager.needs_servers()):
            _log.error("Build check failed")
            return -1

        printer.print_update("Parsing expectations ...")
        manager.parse_expectations()

        result_summary = manager.set_up_run()
        if result_summary:
            num_unexpected_results = manager.run(result_summary)
            manager.clean_up_run()
            _log.debug("Testing completed, Exit status: %d" % num_unexpected_results)
Example #2
0
def run(port,
        options,
        args,
        regular_output=sys.stderr,
        buildbot_output=sys.stdout):
    warnings = _set_up_derived_options(port, options)

    printer = printing.Printer(port,
                               options,
                               regular_output,
                               buildbot_output,
                               configure_logging=True)

    for warning in warnings:
        _log.warning(warning)

    if options.help_printing:
        printer.help_printing()
        printer.cleanup()
        return 0

    if options.lint_test_files:
        return lint(port, options, test_expectations.TestExpectations)

    # We wrap any parts of the run that are slow or likely to raise exceptions
    # in a try/finally to ensure that we clean up the logging configuration.
    unexpected_result_count = -1
    try:
        manager = Manager(port, options, printer)
        manager.print_config()

        printer.print_update("Collecting tests ...")
        try:
            manager.collect_tests(args)
        except IOError, e:
            if e.errno == errno.ENOENT:
                return -1
            raise

        printer.print_update("Checking build ...")
        if not port.check_build(manager.needs_servers()):
            _log.error("Build check failed")
            return -1

        printer.print_update("Parsing expectations ...")
        manager.parse_expectations()

        result_summary = manager.set_up_run()
        if result_summary:
            unexpected_result_count = manager.run(result_summary)
            manager.clean_up_run()
            _log.debug("Testing completed, Exit status: %d" %
                       unexpected_result_count)
Example #3
0
def run(port, options, args, regular_output=sys.stderr, buildbot_output=sys.stdout):
    warnings = _set_up_derived_options(port, options)

    printer = printing.Printer(port, options, regular_output, buildbot_output, configure_logging=True)

    for warning in warnings:
        _log.warning(warning)

    if options.help_printing:
        printer.help_printing()
        printer.cleanup()
        return 0

    if options.lint_test_files:
        return lint(port, options, test_expectations.TestExpectations)

    # We wrap any parts of the run that are slow or likely to raise exceptions
    # in a try/finally to ensure that we clean up the logging configuration.
    unexpected_result_count = -1
    try:
        manager = Manager(port, options, printer)
        manager.print_config()

        printer.print_update("Collecting tests ...")
        try:
            manager.collect_tests(args)
        except IOError, e:
            if e.errno == errno.ENOENT:
                return -1
            raise

        printer.print_update("Checking build ...")
        if not port.check_build(manager.needs_servers()):
            _log.error("Build check failed")
            return -1

        printer.print_update("Parsing expectations ...")
        manager.parse_expectations()

        result_summary = manager.set_up_run()
        if result_summary:
            unexpected_result_count = manager.run(result_summary)
            manager.clean_up_run()
            _log.debug("Testing completed, Exit status: %d" % unexpected_result_count)
Example #4
0
def run(port,
        options,
        args,
        regular_output=sys.stderr,
        buildbot_output=sys.stdout):
    """Run the tests.

    Args:
      port: Port object for port-specific behavior
      options: a dictionary of command line options
      args: a list of sub directories or files to test
      regular_output: a stream-like object that we can send logging/debug
          output to
      buildbot_output: a stream-like object that we can write all output that
          is intended to be parsed by the buildbot to
    Returns:
      the number of unexpected results that occurred, or -1 if there is an
          error.

    """
    warnings = _set_up_derived_options(port, options)

    printer = printing.Printer(port,
                               options,
                               regular_output,
                               buildbot_output,
                               configure_logging=True)
    for w in warnings:
        _log.warning(w)

    if options.help_printing:
        printer.help_printing()
        printer.cleanup()
        return 0

    # We wrap any parts of the run that are slow or likely to raise exceptions
    # in a try/finally to ensure that we clean up the logging configuration.
    num_unexpected_results = -1
    try:
        manager = Manager(port, options, printer)
        manager.print_config()

        printer.print_update("Collecting tests ...")
        try:
            manager.collect_tests(args)
        except IOError, e:
            if e.errno == errno.ENOENT:
                return -1
            raise

        if options.lint_test_files:
            return manager.lint()

        printer.print_update("Checking build ...")
        if not port.check_build(manager.needs_servers()):
            _log.error("Build check failed")
            return -1

        printer.print_update("Parsing expectations ...")
        manager.parse_expectations()

        result_summary = manager.set_up_run()
        if result_summary:
            num_unexpected_results = manager.run(result_summary)
            manager.clean_up_run()
            _log.debug("Testing completed, Exit status: %d" %
                       num_unexpected_results)