Beispiel #1
0
def run(port, options, args, logging_stream, stdout):
    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO)

    printer = printing.Printer(port, options, logging_stream, logger=logger)
    try:
        run_details = _run_tests(port, options, args, printer)
        printer.flush()

        if (not options.dry_run and
                (run_details.exit_code not in test_run_results.ERROR_CODES or
                 run_details.exit_code == test_run_results.EARLY_EXIT_STATUS) and
                not run_details.initial_results.keyboard_interrupted):
            bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)
            bot_printer.print_results(run_details)
            stdout.flush()

            _log.debug("Generating dashboard...")
            gen_dash_board = DashBoardGenerator(port)
            gen_dash_board.generate()
            _log.debug("Dashboard generated.")

        _log.debug("")
        _log.debug("Testing completed, Exit status: %d", run_details.exit_code)

        # Temporary process dump for debugging windows timeout issues, see crbug.com/522396.
        _log.debug("")
        _log.debug("Process dump:")
        for process in port.host.executive.process_dump():
            _log.debug("\t%s", process)

        return run_details

    finally:
        printer.cleanup()
Beispiel #2
0
def run(port, options, args, logging_stream, stdout):
    logger = logging.getLogger()
    logger.setLevel(
        logging.DEBUG if options.debug_rwt_logging else logging.INFO)

    printer = printing.Printer(port, options, logging_stream, logger=logger)
    try:
        run_details = _run_tests(port, options, args, printer)
        printer.flush()

        if (not options.dry_run
                and (run_details.exit_code not in exit_codes.ERROR_CODES
                     or run_details.exit_code == exit_codes.EARLY_EXIT_STATUS)
                and not run_details.initial_results.keyboard_interrupted):
            bot_printer = buildbot_results.BuildBotPrinter(
                stdout, options.debug_rwt_logging)
            bot_printer.print_results(run_details)
            stdout.flush()

        _log.debug('')
        _log.debug('Testing completed, Exit status: %d', run_details.exit_code)
        return run_details

    finally:
        printer.cleanup()
Beispiel #3
0
def main(argv, stdout, stderr):
    options, args = parse_args(argv)

    if options.platform and 'test' in options.platform:
        # It's a bit lame to import mocks into real code, but this allows the user
        # to run tests against the test platform interactively, which is useful for
        # debugging test failures.
        from webkitpy.common.host_mock import MockHost
        host = MockHost()
    else:
        host = Host()

    if options.lint_test_files:
        from webkitpy.layout_tests.lint_test_expectations import lint
        return lint(host, options, stderr)

    try:
        port = host.port_factory.get(options.platform, options)
    except NotImplementedError as e:
        # FIXME: is this the best way to handle unsupported port names?
        print(str(e), file=stderr)
        return EXCEPTIONAL_EXIT_STATUS

    stack_trace_path = host.filesystem.join(port.results_directory(),
                                            'python_stack_trace.txt')
    log_stack_trace_on_ctrl_c(output_file=stack_trace_path)
    log_stack_trace_on_term(output_file=stack_trace_path)

    if options.print_expectations:
        return _print_expectations(port, options, args, stderr)

    try:
        # Force all tests to use a smaller stack so that stack overflow tests can run faster.
        stackSizeInBytes = int(1.5 * 1024 * 1024)
        options.additional_env_var.append('JSC_maxPerThreadStackUsage=' +
                                          str(stackSizeInBytes))
        options.additional_env_var.append('__XPC_JSC_maxPerThreadStackUsage=' +
                                          str(stackSizeInBytes))
        options.additional_env_var.append('JSC_useSharedArrayBuffer=1')
        options.additional_env_var.append('__XPC_JSC_useSharedArrayBuffer=1')
        run_details = run(port, options, args, stderr)
        if run_details.exit_code != -1 and run_details.skipped_all_tests:
            return run_details.exit_code
        if run_details.exit_code != -1 and not run_details.initial_results.keyboard_interrupted:
            bot_printer = buildbot_results.BuildBotPrinter(
                stdout, options.debug_rwt_logging)
            bot_printer.print_results(run_details)

        return run_details.exit_code
    # We still need to handle KeyboardInterrupt, at least for webkitpy unittest cases.
    except KeyboardInterrupt:
        return INTERRUPTED_EXIT_STATUS
    except BaseException as e:
        if isinstance(e, Exception):
            print('\n%s raised: %s' % (e.__class__.__name__, str(e)),
                  file=stderr)
            traceback.print_exc(file=stderr)
        return EXCEPTIONAL_EXIT_STATUS
Beispiel #4
0
    if options.lint_test_files:
        from webkitpy.layout_tests.lint_test_expectations import lint
        return lint(host, options, stderr)

    try:
        port = host.port_factory.get(options.platform, options)
    except NotImplementedError, e:
        # FIXME: is this the best way to handle unsupported port names?
        print >> stderr, str(e)
        return EXCEPTIONAL_EXIT_STATUS

    try:
        run_details = run(port, options, args, stderr)
        if run_details.exit_code != -1:
            bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)
            bot_printer.print_results(run_details)

        return run_details.exit_code
    except KeyboardInterrupt:
        return INTERRUPTED_EXIT_STATUS
    except BaseException as e:
        if isinstance(e, Exception):
            print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e))
            traceback.print_exc(file=stderr)
        return EXCEPTIONAL_EXIT_STATUS


def parse_args(args):
    option_group_definitions = []
 def get_printer(self):
     stream = StringIO.StringIO()
     printer = buildbot_results.BuildBotPrinter(stream, debug_logging=True)
     return printer, stream