Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 re | 5 import re |
| 6 import string | 6 import string |
| 7 | 7 |
| 8 | 8 |
| 9 class Test(object): | 9 class Test(object): |
| 10 """ | 10 """ |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 if not gtest_results: | 611 if not gtest_results: |
| 612 return False, None # pragma: no cover | 612 return False, None # pragma: no cover |
| 613 | 613 |
| 614 global_tags = gtest_results.raw.get('global_tags', []) | 614 global_tags = gtest_results.raw.get('global_tags', []) |
| 615 if 'UNRELIABLE_RESULTS' in global_tags: | 615 if 'UNRELIABLE_RESULTS' in global_tags: |
| 616 return False, None # pragma: no cover | 616 return False, None # pragma: no cover |
| 617 | 617 |
| 618 return True, gtest_results.failures | 618 return True, gtest_results.failures |
| 619 | 619 |
| 620 | 620 |
| 621 class AMPGTestTest(Test): | |
| 622 AMP_INSTANCE_ADDRESS = '172.22.21.180' | |
| 623 AMP_INSTANCE_PORT = '80' | |
| 624 AMP_INSTANCE_PROTOCOL = 'http' | |
| 625 AMP_RESULTS_BUCKET = 'chrome-amp-results' | |
| 626 def __init__(self, name, args=None, target_name=None, device_name=['Nexus 5'], | |
| 627 device_os=['4.4.2'], android_isolate_path=None, | |
| 628 **runtest_kwargs): | |
| 629 self._name = name | |
| 630 self._args = args | |
| 631 self._target_name = target_name | |
| 632 self._android_isolate_path = android_isolate_path | |
| 633 # LocalGTestTest is used when AMP tests are not triggered successfully. | |
| 634 self._local_test = LocalGTestTest(name, args, target_name, **runtest_kwargs) | |
| 635 self._device_name = device_name | |
| 636 self._device_os = device_os | |
| 637 self._trigger_successful = None | |
| 638 self._failures = [] | |
| 639 | |
| 640 @property | |
| 641 def name(self): | |
|
Paweł Hajdan Jr.
2015/06/08 09:33:21
I don't see "failures" method being defined by thi
Paweł Hajdan Jr.
2015/06/19 10:46:09
Have you addressed this comment? It may be fine fo
navabi
2015/06/19 19:49:28
I see. Can you show me where these are used in the
Paweł Hajdan Jr.
2015/06/22 14:31:41
Please see determine_new_failures in build/scripts
| |
| 642 return self._name | |
| 643 | |
| 644 def run(self, api, suffix): # pylint: disable=R0201 | |
| 645 """Not used. All logic in pre_run, post_run.""" | |
| 646 return [] | |
| 647 | |
| 648 def pre_run(self, api, suffix): | |
| 649 """Triggers an AMP test.""" | |
| 650 amp_arguments = api.amp.amp_arguments( | |
| 651 api_address=AMPGTestTest.AMP_INSTANCE_ADDRESS, | |
| 652 api_port=AMPGTestTest.AMP_INSTANCE_PORT, | |
| 653 api_protocol=AMPGTestTest.AMP_INSTANCE_PROTOCOL, | |
| 654 device_name=self._device_name, | |
|
navabi
2015/06/06 01:56:53
is it cool if device_timeout is missing from amp_a
| |
| 655 device_os=self._device_os) | |
| 656 | |
| 657 isolate_file_path = (api.path['checkout'].join(self._android_isolate_path) | |
| 658 if self._android_isolate_path else None) | |
| 659 try: | |
| 660 api.amp.trigger_test_suite( | |
| 661 self._name, 'gtest', | |
| 662 api.amp.gtest_arguments(self._name, | |
| 663 isolate_file_path=isolate_file_path), | |
| 664 amp_arguments) | |
| 665 self._trigger_successful = True | |
| 666 except api.step.StepFailure: | |
| 667 self._trigger_successful = False | |
| 668 | |
| 669 def post_run(self, api, suffix): | |
| 670 # If we were unable to successfully trigger the AMP job, run locally. | |
| 671 if not self._trigger_successful: | |
| 672 return self._local_test.run(api, suffix) | |
|
Paweł Hajdan Jr.
2015/06/08 09:33:21
How are failures of the local test run propagated
| |
| 673 else: | |
| 674 amp_arguments = api.amp.amp_arguments( | |
| 675 api_address=AMPGTestTest.AMP_INSTANCE_ADDRESS, | |
| 676 api_port=AMPGTestTest.AMP_INSTANCE_PORT, | |
| 677 api_protocol=AMPGTestTest.AMP_INSTANCE_PROTOCOL, | |
| 678 device_name=self._device_name, | |
| 679 device_os=self._device_os) | |
| 680 | |
| 681 try: | |
| 682 api.amp.collect_test_suite( | |
| 683 self._name, 'gtest', api.amp.gtest_arguments(self._name), | |
| 684 amp_arguments) | |
| 685 except api.step.StepFailure as f: | |
| 686 self._failures = [str(f)] | |
|
Paweł Hajdan Jr.
2015/06/08 09:33:21
Where is self._failures read?
| |
| 687 | |
| 688 | |
| 621 class GTestTest(Test): | 689 class GTestTest(Test): |
| 622 def __init__(self, name, args=None, target_name=None, enable_swarming=False, | 690 def __init__(self, name, args=None, target_name=None, enable_swarming=False, |
| 623 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, | 691 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, |
| 624 swarming_extra_suffix=None, **runtest_kwargs): | 692 swarming_extra_suffix=None, **runtest_kwargs): |
| 625 super(GTestTest, self).__init__() | 693 super(GTestTest, self).__init__() |
| 626 if enable_swarming: | 694 if enable_swarming: |
| 627 self._test = SwarmingGTestTest( | 695 self._test = SwarmingGTestTest( |
| 628 name, args, target_name, swarming_shards, swarming_dimensions, | 696 name, args, target_name, swarming_shards, swarming_dimensions, |
| 629 swarming_tags, swarming_extra_suffix) | 697 swarming_tags, swarming_extra_suffix) |
| 630 else: | 698 else: |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 GTestTest('ui_base_unittests'), | 1310 GTestTest('ui_base_unittests'), |
| 1243 GTestTest('ui_ios_unittests'), | 1311 GTestTest('ui_ios_unittests'), |
| 1244 GTestTest('sync_unit_tests'), | 1312 GTestTest('sync_unit_tests'), |
| 1245 GTestTest('sql_unittests'), | 1313 GTestTest('sql_unittests'), |
| 1246 ] | 1314 ] |
| 1247 | 1315 |
| 1248 GOMA_TESTS = [ | 1316 GOMA_TESTS = [ |
| 1249 GTestTest('base_unittests'), | 1317 GTestTest('base_unittests'), |
| 1250 GTestTest('content_unittests'), | 1318 GTestTest('content_unittests'), |
| 1251 ] | 1319 ] |
| OLD | NEW |