From 9b9256d9b947be852f236490311801f6e8d0e5eb Mon Sep 17 00:00:00 2001 From: simonhatch Date: Wed, 7 Jan 2015 10:03:42 -0800 Subject: [PATCH] Fix output not appearing in individual steps on android. Previously we were returning after writing out the chartjson data before getting a chance to print out the output from the previous step. BUG= Review URL: https://codereview.chromium.org/822813002 Cr-Commit-Position: refs/heads/master@{#310317} --- build/android/pylib/perf/test_runner.py | 15 ++++++--------- build/android/test_runner.py | 7 ++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/build/android/pylib/perf/test_runner.py b/build/android/pylib/perf/test_runner.py index a8048d4a9e68..b7fadd23e724 100644 --- a/build/android/pylib/perf/test_runner.py +++ b/build/android/pylib/perf/test_runner.py @@ -75,19 +75,12 @@ def OutputJsonList(json_input, json_output): return 0 -def OutputChartjson(test_name, json_file_name): - file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) - with file(file_name, 'r') as f: - persisted_result = pickle.load(f) - with open(json_file_name, 'w') as o: - o.write(persisted_result['chartjson']) - - -def PrintTestOutput(test_name): +def PrintTestOutput(test_name, json_file_name=None): """Helper method to print the output of previously executed test_name. Args: test_name: name of the test that has been previously executed. + json_file_name: name of the file to output chartjson data to. Returns: exit code generated by the test step. @@ -105,6 +98,10 @@ def PrintTestOutput(test_name): logging.info('*' * 80) print persisted_result['output'] + if json_file_name: + with file(json_file_name, 'w') as f: + f.write(persisted_result['chartjson']) + return persisted_result['exit_code'] diff --git a/build/android/test_runner.py b/build/android/test_runner.py index bda3405af669..cc0078191d58 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py @@ -773,13 +773,10 @@ def _RunPerfTests(args): 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) + return perf_test_runner.PrintTestOutput( + perf_options.print_step, perf_options.output_chartjson_data) runner_factory, tests, devices = perf_setup.Setup(perf_options) -- 2.11.4.GIT