Exemplo n.º 1
0
def _RunGTests(args, devices):
    """Subcommand of RunTestsCommands which runs gtests."""
    exit_code = 0
    for suite_name in args.suite_name:
        # TODO(jbudorick): Either deprecate multi-suite or move its handling down
        # into the gtest code.
        gtest_options = gtest_test_options.GTestOptions(
            args.tool, args.test_filter, args.run_disabled,
            args.test_arguments, args.timeout, args.isolate_file_path,
            suite_name, args.app_data_files, args.app_data_file_dir,
            args.delete_stale_data)
        runner_factory, tests = gtest_setup.Setup(gtest_options, devices)

        results, test_exit_code = test_dispatcher.RunTests(
            tests,
            runner_factory,
            devices,
            shard=True,
            test_timeout=None,
            num_retries=args.num_retries)

        if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
            exit_code = test_exit_code

        report_results.LogFull(
            results=results,
            test_type='Unit test',
            test_package=suite_name,
            flakiness_server=args.flakiness_dashboard_server)

        if args.json_results_file:
            json_results.GenerateJsonResultsFile(results,
                                                 args.json_results_file)

    return exit_code
Exemplo n.º 2
0
def _RunGTests(options, devices):
    """Subcommand of RunTestsCommands which runs gtests."""
    ProcessGTestOptions(options)

    exit_code = 0
    for suite_name in options.suite_name:
        # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for
        # the gtest command.
        gtest_options = gtest_test_options.GTestOptions(
            options.tool, options.cleanup_test_files, options.push_deps,
            options.test_filter, options.run_disabled, options.test_arguments,
            options.timeout, suite_name)
        runner_factory, tests = gtest_setup.Setup(gtest_options, devices)

        results, test_exit_code = test_dispatcher.RunTests(
            tests,
            runner_factory,
            devices,
            shard=True,
            test_timeout=None,
            num_retries=options.num_retries)

        if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
            exit_code = test_exit_code

        report_results.LogFull(
            results=results,
            test_type='Unit test',
            test_package=suite_name,
            flakiness_server=options.flakiness_dashboard_server)

    if os.path.isdir(constants.ISOLATE_DEPS_DIR):
        shutil.rmtree(constants.ISOLATE_DEPS_DIR)

    return exit_code