Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 import datetime | 6 import datetime |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 env={'BUILDTYPE': self.c.BUILD_CONFIG}, | 595 env={'BUILDTYPE': self.c.BUILD_CONFIG}, |
| 596 **kwargs) | 596 **kwargs) |
| 597 | 597 |
| 598 | 598 |
| 599 def _run_sharded_tests(self, | 599 def _run_sharded_tests(self, |
| 600 config='sharded_perf_tests.json', | 600 config='sharded_perf_tests.json', |
| 601 flaky_config=None, | 601 flaky_config=None, |
| 602 chartjson_output=False, | 602 chartjson_output=False, |
| 603 max_battery_temp=None, | 603 max_battery_temp=None, |
| 604 known_devices_file=None, | 604 known_devices_file=None, |
| 605 enable_platform_mode=False, | |
| 605 **kwargs): | 606 **kwargs): |
| 606 args = [ | 607 args = [ |
| 607 'perf', | 608 'perf', |
| 608 '--release', | 609 '--release', |
| 609 '--verbose', | 610 '--verbose', |
| 610 '--steps', config, | 611 '--steps', config, |
| 611 '--blacklist-file', self.blacklist_file | 612 '--blacklist-file', self.blacklist_file |
| 612 ] | 613 ] |
| 613 if flaky_config: | 614 if flaky_config: |
| 614 args.extend(['--flaky-steps', flaky_config]) | 615 args.extend(['--flaky-steps', flaky_config]) |
| 615 if chartjson_output: | 616 if chartjson_output: |
| 616 args.append('--collect-chartjson-data') | 617 args.append('--collect-chartjson-data') |
| 617 if max_battery_temp: | 618 if max_battery_temp: |
| 618 args.extend(['--max-battery-temp', max_battery_temp]) | 619 args.extend(['--max-battery-temp', max_battery_temp]) |
| 619 if known_devices_file: | 620 if known_devices_file: |
| 620 args.extend(['--known-devices-file', known_devices_file]) | 621 args.extend(['--known-devices-file', known_devices_file]) |
| 622 if enable_platform_mode: | |
| 623 args.extend(['--enable-platform-mode']) | |
| 621 | 624 |
| 622 self.test_runner( | 625 self.test_runner( |
| 623 'Sharded Perf Tests', | 626 'Sharded Perf Tests', |
| 624 args, | 627 args, |
| 625 cwd=self.m.path['checkout'], | 628 cwd=self.m.path['checkout'], |
| 626 env=self.m.chromium.get_env(), | 629 env=self.m.chromium.get_env(), |
| 627 **kwargs) | 630 **kwargs) |
| 628 | 631 |
| 629 def run_sharded_perf_tests(self, config, flaky_config=None, perf_id=None, | 632 def run_sharded_perf_tests(self, config, flaky_config=None, perf_id=None, |
| 630 test_type_transform=lambda x: x, | 633 test_type_transform=lambda x: x, |
| 631 chartjson_file=False, max_battery_temp=None, | 634 chartjson_file=False, max_battery_temp=None, |
| 632 upload_archives_to_bucket=None, | 635 upload_archives_to_bucket=None, |
| 633 known_devices_file=None, **kwargs): | 636 known_devices_file=None, |
| 637 enable_platform_mode=False, **kwargs): | |
| 634 """Run the perf tests from the given config file. | 638 """Run the perf tests from the given config file. |
| 635 | 639 |
| 636 config: the path of the config file containing perf tests. | 640 config: the path of the config file containing perf tests. |
| 637 flaky_config: optional file of tests to avoid. | 641 flaky_config: optional file of tests to avoid. |
| 638 perf_id: the id of the builder running these tests | 642 perf_id: the id of the builder running these tests |
| 639 test_type_transform: a lambda transforming the test name to the | 643 test_type_transform: a lambda transforming the test name to the |
| 640 test_type to upload to. | 644 test_type to upload to. |
| 641 known_devices_file: Path to file containing serial numbers of known devices. | 645 known_devices_file: Path to file containing serial numbers of known devices. |
| 646 enable_platform_mode: If set, will run in new platform mode for android test | |
|
jbudorick
2016/07/13 18:06:13
nit: "will run using the android test runner's new
rnephew (Reviews Here)
2016/07/13 20:45:54
Done.
| |
| 647 runner. | |
| 642 """ | 648 """ |
| 643 # test_runner.py actually runs the tests and records the results | 649 # test_runner.py actually runs the tests and records the results |
| 644 self._run_sharded_tests(config=config, flaky_config=flaky_config, | 650 self._run_sharded_tests(config=config, flaky_config=flaky_config, |
| 645 chartjson_output=chartjson_file, | 651 chartjson_output=chartjson_file, |
| 646 max_battery_temp=max_battery_temp, | 652 max_battery_temp=max_battery_temp, |
| 647 known_devices_file=known_devices_file, **kwargs) | 653 known_devices_file=known_devices_file, |
| 654 enable_platform_mode=enable_platform_mode, **kwargs) | |
| 648 | 655 |
| 649 # now obtain the list of tests that were executed. | 656 # now obtain the list of tests that were executed. |
| 650 result = self.test_runner( | 657 result = self.test_runner( |
| 651 'get perf test list', | 658 'get perf test list', |
| 652 ['perf', '--steps', config, '--output-json-list', self.m.json.output(), | 659 ['perf', '--steps', config, '--output-json-list', self.m.json.output(), |
| 653 '--blacklist-file', self.blacklist_file], | 660 '--blacklist-file', self.blacklist_file], |
| 654 step_test_data=lambda: self.m.json.test_api.output([ | 661 step_test_data=lambda: self.m.json.test_api.output([ |
| 655 {'test': 'perf_test.foo', 'device_affinity': 0, | 662 {'test': 'perf_test.foo', 'device_affinity': 0, |
| 656 'end_time': 1443438432.949711, 'has_archive': True}, | 663 'end_time': 1443438432.949711, 'has_archive': True}, |
| 657 {'test': 'page_cycler.foo', 'device_affinity': 0}]), | 664 {'test': 'page_cycler.foo', 'device_affinity': 0}]), |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 672 annotate = self.m.chromium.get_annotate_by_test_name(test_name) | 679 annotate = self.m.chromium.get_annotate_by_test_name(test_name) |
| 673 | 680 |
| 674 if upload_archives_to_bucket and test_data.get('has_archive'): | 681 if upload_archives_to_bucket and test_data.get('has_archive'): |
| 675 archive = self.m.path.mkdtemp('perf_archives').join('output_dir.zip') | 682 archive = self.m.path.mkdtemp('perf_archives').join('output_dir.zip') |
| 676 else: | 683 else: |
| 677 archive = None | 684 archive = None |
| 678 print_step_cmd = ['perf', '--print-step', test_name, '--verbose', | 685 print_step_cmd = ['perf', '--print-step', test_name, '--verbose', |
| 679 '--blacklist-file', self.blacklist_file] | 686 '--blacklist-file', self.blacklist_file] |
| 680 if archive: | 687 if archive: |
| 681 print_step_cmd.extend(['--get-output-dir-archive', archive]) | 688 print_step_cmd.extend(['--get-output-dir-archive', archive]) |
| 689 if enable_platform_mode: | |
| 690 print_step_cmd.extend(['--enable-platform-mode']) | |
| 682 | 691 |
| 683 try: | 692 try: |
| 684 with self.handle_exit_codes(): | 693 with self.handle_exit_codes(): |
| 685 env = self.m.chromium.get_env() | 694 env = self.m.chromium.get_env() |
| 686 env['CHROMIUM_OUTPUT_DIR'] = self.m.chromium.output_dir | 695 env['CHROMIUM_OUTPUT_DIR'] = self.m.chromium.output_dir |
| 687 self.m.chromium.runtest( | 696 self.m.chromium.runtest( |
| 688 self.c.test_runner, | 697 self.c.test_runner, |
| 689 print_step_cmd, | 698 print_step_cmd, |
| 690 name=test_name, | 699 name=test_name, |
| 691 perf_dashboard_id=test_type, | 700 perf_dashboard_id=test_type, |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1377 script = self.c.test_runner | 1386 script = self.c.test_runner |
| 1378 if wrapper_script_suite_name: | 1387 if wrapper_script_suite_name: |
| 1379 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1388 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
| 1380 wrapper_script_suite_name) | 1389 wrapper_script_suite_name) |
| 1381 else: | 1390 else: |
| 1382 env = kwargs.get('env', {}) | 1391 env = kwargs.get('env', {}) |
| 1383 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1392 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
| 1384 self.m.chromium.output_dir) | 1393 self.m.chromium.output_dir) |
| 1385 kwargs['env'] = env | 1394 kwargs['env'] = env |
| 1386 return self.m.python(step_name, script, args, **kwargs) | 1395 return self.m.python(step_name, script, args, **kwargs) |
| OLD | NEW |