| 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 | 1515 |
| 1516 Returns: | 1516 Returns: |
| 1517 Exit status code. | 1517 Exit status code. |
| 1518 """ | 1518 """ |
| 1519 if not os.environ.get('CHROMIUM_OUTPUT_DIR') and options.target: | 1519 if not os.environ.get('CHROMIUM_OUTPUT_DIR') and options.target: |
| 1520 extra_env['CHROMIUM_OUTPUT_DIR'] = ( | 1520 extra_env['CHROMIUM_OUTPUT_DIR'] = ( |
| 1521 os.path.abspath(os.path.join(options.build_dir, options.target))) | 1521 os.path.abspath(os.path.join(options.build_dir, options.target))) |
| 1522 if options.run_python_script: | 1522 if options.run_python_script: |
| 1523 return _MainLinux(options, args, extra_env) | 1523 return _MainLinux(options, args, extra_env) |
| 1524 | 1524 |
| 1525 if len(args) < 1: | 1525 raise Exception('runtest.py without --run-python-script not supported for ' |
| 1526 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) | 1526 'Android') |
| 1527 | |
| 1528 if _ListLogProcessors(options.annotate): | |
| 1529 return 0 | |
| 1530 log_processor_class = _SelectLogProcessor(options, False) | |
| 1531 log_processor = _CreateLogProcessor(log_processor_class, options, None) | |
| 1532 | |
| 1533 if options.generate_json_file: | |
| 1534 if os.path.exists(options.test_output_xml): | |
| 1535 # remove the old XML output file. | |
| 1536 os.remove(options.test_output_xml) | |
| 1537 | |
| 1538 # Assume it's a gtest apk, so use the android harness. | |
| 1539 test_suite = args[0] | |
| 1540 run_test_target_option = '--release' | |
| 1541 if options.target == 'Debug': | |
| 1542 run_test_target_option = '--debug' | |
| 1543 command = ['src/build/android/test_runner.py', 'gtest', | |
| 1544 run_test_target_option, '-s', test_suite] | |
| 1545 | |
| 1546 if options.flakiness_dashboard_server: | |
| 1547 command += ['--flakiness-dashboard-server=%s' % | |
| 1548 options.flakiness_dashboard_server] | |
| 1549 | |
| 1550 result = _RunGTestCommand( | |
| 1551 options, command, extra_env, log_processor=log_processor) | |
| 1552 | |
| 1553 if options.generate_json_file: | |
| 1554 if not _GenerateJSONForTestResults(options, log_processor): | |
| 1555 return 1 | |
| 1556 | |
| 1557 if options.annotate: | |
| 1558 annotation_utils.annotate( | |
| 1559 options.test_type, result, log_processor, | |
| 1560 perf_dashboard_id=options.perf_dashboard_id) | |
| 1561 | |
| 1562 if options.results_url: | |
| 1563 if not _SendResultsToDashboard( | |
| 1564 log_processor, _ResultsDashboardDict(options)): | |
| 1565 return 1 | |
| 1566 | |
| 1567 return result | |
| 1568 | 1527 |
| 1569 | 1528 |
| 1570 def _UpdateRunBenchmarkArgs(args, options): | 1529 def _UpdateRunBenchmarkArgs(args, options): |
| 1571 """Updates the arguments for telemetry run_benchmark commands. | 1530 """Updates the arguments for telemetry run_benchmark commands. |
| 1572 | 1531 |
| 1573 Ensures that --output=chartjson is set and adds a --output argument. | 1532 Ensures that --output=chartjson is set and adds a --output argument. |
| 1574 | 1533 |
| 1575 Arguments: | 1534 Arguments: |
| 1576 args: list of command line arguments, starts with 'run_benchmark' for | 1535 args: list of command line arguments, starts with 'run_benchmark' for |
| 1577 telemetry tests. | 1536 telemetry tests. |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 finally: | 1901 finally: |
| 1943 if did_launch_dbus: | 1902 if did_launch_dbus: |
| 1944 # It looks like the command line argument --exit-with-session | 1903 # It looks like the command line argument --exit-with-session |
| 1945 # isn't working to clean up the spawned dbus-daemon. Kill it | 1904 # isn't working to clean up the spawned dbus-daemon. Kill it |
| 1946 # manually. | 1905 # manually. |
| 1947 _ShutdownDBus() | 1906 _ShutdownDBus() |
| 1948 | 1907 |
| 1949 | 1908 |
| 1950 if '__main__' == __name__: | 1909 if '__main__' == __name__: |
| 1951 sys.exit(main()) | 1910 sys.exit(main()) |
| OLD | NEW |