Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A tool used to run a Chrome test executable and process the output. | 6 """A tool used to run a Chrome test executable and process the output. |
| 7 | 7 |
| 8 This script is used by the buildbot slaves. It must be run from the outer | 8 This script is used by the buildbot slaves. It must be run from the outer |
| 9 build directory, e.g. chrome-release/build/. | 9 build directory, e.g. chrome-release/build/. |
| 10 | 10 |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 | 670 |
| 671 Args: | 671 Args: |
| 672 chartjson_file: Path to the file to write the chartjson. | 672 chartjson_file: Path to the file to write the chartjson. |
| 673 log_processor: An instance of a log processor class, which has been used to | 673 log_processor: An instance of a log processor class, which has been used to |
| 674 process the test output, so it contains the test results. | 674 process the test output, so it contains the test results. |
| 675 args: Dict of additional args to send to results_dashboard. | 675 args: Dict of additional args to send to results_dashboard. |
| 676 """ | 676 """ |
| 677 assert log_processor.IsChartJson() | 677 assert log_processor.IsChartJson() |
| 678 | 678 |
| 679 chartjson_data = _GenerateDashboardJson(log_processor, args) | 679 chartjson_data = _GenerateDashboardJson(log_processor, args) |
| 680 | 680 if chartjson_data: |
| 681 with open(chartjson_file, 'w') as f: | 681 with open(chartjson_file, 'w') as f: |
| 682 json.dump(chartjson_data, f) | 682 json.dump(chartjson_data[1], f) |
| 683 | 683 |
| 684 | 684 |
| 685 def _SendResultsToDashboard(log_processor, args): | 685 def _SendResultsToDashboard(log_processor, args): |
| 686 """Sends results from a log processor instance to the dashboard. | 686 """Sends results from a log processor instance to the dashboard. |
| 687 | 687 |
| 688 Args: | 688 Args: |
| 689 log_processor: An instance of a log processor class, which has been used to | 689 log_processor: An instance of a log processor class, which has been used to |
| 690 process the test output, so it contains the test results. | 690 process the test output, so it contains the test results. |
| 691 args: Dict of additional args to send to results_dashboard. | 691 args: Dict of additional args to send to results_dashboard. |
| 692 | 692 |
| 693 Returns: | 693 Returns: |
| 694 True if no errors occurred. | 694 True if no errors occurred. |
| 695 """ | 695 """ |
| 696 if args['system'] is None: | 696 if args['system'] is None: |
| 697 # perf_id not specified in factory properties. | 697 # perf_id not specified in factory properties. |
| 698 print 'Error: No system name (perf_id) specified when sending to dashboard.' | 698 print 'Error: No system name (perf_id) specified when sending to dashboard.' |
| 699 return True | 699 return True |
| 700 | 700 |
| 701 results = None | 701 results = None |
| 702 if log_processor.IsChartJson(): | 702 if log_processor.IsChartJson(): |
| 703 results = _GenerateDashboardJson(log_processor, args) | 703 chartjson_results = _GenerateDashboardJson(log_processor, args) |
| 704 if not results: | 704 if not chartjson_results: |
| 705 print 'Error: No json output from telemetry.' | 705 print 'Error: No json output from telemetry.' |
| 706 print '@@@STEP_FAILURE@@@' | 706 print '@@@STEP_FAILURE@@@' |
| 707 log_processor.Cleanup() | 707 log_processor.Cleanup() |
| 708 if not chartjson_results: | |
| 709 return False | |
| 710 if chartjson_results[0]: | |
| 711 # This benchmark was disabled so don't send results to the dashboard | |
| 712 # but it was a successful run. | |
| 713 return True | |
| 714 results = chartjson_results[1] | |
| 708 else: | 715 else: |
| 709 charts = _GetDataFromLogProcessor(log_processor) | 716 charts = _GetDataFromLogProcessor(log_processor) |
| 710 results = results_dashboard.MakeListOfPoints( | 717 results = results_dashboard.MakeListOfPoints( |
| 711 charts, args['system'], args['test'], args['buildername'], | 718 charts, args['system'], args['test'], args['buildername'], |
| 712 args['buildnumber'], args['supplemental_columns']) | 719 args['buildnumber'], args['supplemental_columns']) |
| 713 | 720 |
| 714 if not results: | 721 if not results: |
| 715 return False | 722 return False |
| 716 | 723 |
| 717 logging.debug(json.dumps(results, indent=2)) | 724 logging.debug(json.dumps(results, indent=2)) |
| 718 return results_dashboard.SendResults(results, args['url'], args['build_dir']) | 725 return results_dashboard.SendResults( |
| 726 results, args['url'], args['build_dir']) | |
|
perezju
2016/09/22 08:50:27
nit: two extra indent spaces
eyaich1
2016/09/26 15:22:11
Done.
| |
| 719 | 727 |
| 720 | 728 |
| 721 def _GetDataFromLogProcessor(log_processor): | 729 def _GetDataFromLogProcessor(log_processor): |
| 722 """Returns a mapping of chart names to chart data. | 730 """Returns a mapping of chart names to chart data. |
| 723 | 731 |
| 724 Args: | 732 Args: |
| 725 log_processor: A log processor (aka results tracker) object. | 733 log_processor: A log processor (aka results tracker) object. |
| 726 | 734 |
| 727 Returns: | 735 Returns: |
| 728 A dictionary mapping chart name to lists of chart data. | 736 A dictionary mapping chart name to lists of chart data. |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1907 finally: | 1915 finally: |
| 1908 if did_launch_dbus: | 1916 if did_launch_dbus: |
| 1909 # It looks like the command line argument --exit-with-session | 1917 # It looks like the command line argument --exit-with-session |
| 1910 # isn't working to clean up the spawned dbus-daemon. Kill it | 1918 # isn't working to clean up the spawned dbus-daemon. Kill it |
| 1911 # manually. | 1919 # manually. |
| 1912 _ShutdownDBus() | 1920 _ShutdownDBus() |
| 1913 | 1921 |
| 1914 | 1922 |
| 1915 if '__main__' == __name__: | 1923 if '__main__' == __name__: |
| 1916 sys.exit(main()) | 1924 sys.exit(main()) |
| OLD | NEW |