コード例 #1
0
def _RunPerfTests(options, args, error_func, devices):
    """Subcommand of RunTestsCommands which runs perf tests."""
    perf_options = ProcessPerfTestOptions(options, args, error_func)
    # Just print the results from a single previously executed step.
    if perf_options.print_step:
        return perf_test_runner.PrintTestOutput(perf_options.print_step)

    runner_factory, tests = perf_setup.Setup(perf_options)

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

    report_results.LogFull(results=results,
                           test_type='Perf',
                           test_package='Perf')

    if perf_options.single_step:
        return perf_test_runner.PrintTestOutput('single_step')

    perf_test_runner.PrintSummary(tests)

    # Always return 0 on the sharding stage. Individual tests exit_code
    # will be returned on the print_step stage.
    return 0
コード例 #2
0
ファイル: test_runner.py プロジェクト: TobbyT/mojo-apps
def _RunPerfTests(args):
    """Subcommand of RunTestsCommands which runs perf tests."""
    perf_options = ProcessPerfTestOptions(args)

    # Just save a simple json with a list of test names.
    if perf_options.output_json_list:
        return perf_test_runner.OutputJsonList(perf_options.steps,
                                               perf_options.output_json_list)

    if perf_options.output_chartjson_data:
        return perf_test_runner.OutputChartjson(
            perf_options.print_step, perf_options.output_chartjson_data)

    # Just print the results from a single previously executed step.
    if perf_options.print_step:
        return perf_test_runner.PrintTestOutput(perf_options.print_step)

    runner_factory, tests, devices = perf_setup.Setup(perf_options)

    # shard=False means that each device will get the full list of tests
    # and then each one will decide their own affinity.
    # shard=True means each device will pop the next test available from a queue,
    # which increases throughput but have no affinity.
    results, _ = test_dispatcher.RunTests(tests,
                                          runner_factory,
                                          devices,
                                          shard=False,
                                          test_timeout=None,
                                          num_retries=args.num_retries)

    report_results.LogFull(results=results,
                           test_type='Perf',
                           test_package='Perf')

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

    if perf_options.single_step:
        return perf_test_runner.PrintTestOutput('single_step')

    perf_test_runner.PrintSummary(tests)

    # Always return 0 on the sharding stage. Individual tests exit_code
    # will be returned on the print_step stage.
    return 0