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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 gtest_results = step_result.test_utils.gtest_results | 597 gtest_results = step_result.test_utils.gtest_results |
598 if not gtest_results: | 598 if not gtest_results: |
599 return False, None # pragma: no cover | 599 return False, None # pragma: no cover |
600 | 600 |
601 global_tags = gtest_results.raw.get('global_tags', []) | 601 global_tags = gtest_results.raw.get('global_tags', []) |
602 if 'UNRELIABLE_RESULTS' in global_tags: | 602 if 'UNRELIABLE_RESULTS' in global_tags: |
603 return False, None # pragma: no cover | 603 return False, None # pragma: no cover |
604 | 604 |
605 return True, gtest_results.failures | 605 return True, gtest_results.failures |
606 | 606 |
607 class AMPGTestTest(Test): | |
608 def __init__(self, name, args=None, target_name=None, **runtest_kwargs): | |
609 super(AMPGTestTest, self).__init__() | |
610 self._name = name | |
611 self._args = args | |
612 self._target_name = target_name | |
613 self._local_test = LocalGTestTest(name, args, target_name, **runtest_kwargs) | |
614 | |
615 @property | |
616 def name(self): | |
617 return self._name | |
618 | |
619 @property | |
620 def target_name(self): | |
621 return self._target_name or self._name | |
622 | |
623 @property | |
624 def isolate_target(self): | |
625 return self.target_name # pragma: no cover | |
626 | |
627 def compile_targets(self, api): | |
628 return self._local_test.compile_targets(api) | |
629 | |
630 def trigger(self, api, suffix): | |
631 isolate_file_path = ( | |
632 api.path['checkout'].join(*isolate_file) if isolate_file else None) | |
633 deferred_trigger_result = api.amp.trigger_test_suite( | |
634 self._name, 'gtest', | |
635 api.amp.gtest_arguments(self._name, | |
636 isolate_file_path=isolate_file_path), | |
637 api.amp.amp_arguments( | |
638 api_address=AMP_INSTANCE_ADDRESS, | |
639 api_port=AMP_INSTANCE_PORT, | |
640 api_protocol=AMP_INSTANCE_PROTOCOL, | |
641 device_minimum_os=builder.get('device_minimum_os'), | |
642 device_name=builder.get('device_name'), | |
643 device_os=builder.get('device_os'), | |
644 device_timeout=builder.get('device_timeout'))) | |
645 self._trigger_successful = deferred_trigger_result.is_ok | |
646 | |
647 def collect(self, api, suffix): | |
648 # If the AMP test was not successfully triggered, run locally. | |
649 if not self._trigger_successful: | |
650 return self._local_test.run(api, suffix) | |
651 else: | |
652 deffered_step_result = api.amp.collect_test_suite( | |
jbudorick
2015/04/22 16:35:40
deferred_step_result
I'm somewhat surprised that
navabi
2015/05/07 19:21:59
Done.
| |
653 suite, 'gtest', | |
654 api.amp.gtest_arguments(suite), | |
655 api.amp.amp_arguments( | |
656 api_address=AMP_INSTANCE_ADDRESS, | |
657 api_port=AMP_INSTANCE_PORT, | |
658 api_protocol=AMP_INSTANCE_PROTOCOL, | |
659 device_minimum_os=builder.get('device_minimum_os'), | |
660 device_name=builder.get('device_name'), | |
661 device_os=builder.get('device_os'), | |
662 device_timeout=builder.get('device_timeout'))) | |
663 self._collect_successful = deferred_step_result.is_ok | |
664 # Need to return step_result here | |
navabi
2015/04/22 16:16:48
need to figure out how to return the step result h
| |
665 | |
666 def run(self, api, suffix): | |
667 self._trigger(api, suffix) | |
navabi
2015/04/22 16:16:48
I will change this to return self._local_tests.run
Paweł Hajdan Jr.
2015/04/22 16:25:09
Please take a look at how swarming tests run. Ther
navabi
2015/05/07 19:21:59
Done.
| |
668 result = self._collect(api, suffix) | |
669 return result | |
670 | |
671 def has_valid_results(self, api, suffix): | |
672 # TODO(navabi): implement this. | |
673 return True | |
674 | |
675 def failures(self, api, suffix): | |
676 # TODO(navabi): implement this. | |
677 return [] | |
678 | |
607 | 679 |
608 class GTestTest(Test): | 680 class GTestTest(Test): |
609 def __init__(self, name, args=None, target_name=None, enable_swarming=False, | 681 def __init__(self, name, args=None, target_name=None, enable_swarming=False, |
610 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, | 682 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, |
611 swarming_extra_suffix=None, **runtest_kwargs): | 683 swarming_extra_suffix=None, **runtest_kwargs): |
612 super(GTestTest, self).__init__() | 684 super(GTestTest, self).__init__() |
613 if enable_swarming: | 685 if enable_swarming: |
614 self._test = SwarmingGTestTest( | 686 self._test = SwarmingGTestTest( |
615 name, args, target_name, swarming_shards, swarming_dimensions, | 687 name, args, target_name, swarming_shards, swarming_dimensions, |
616 swarming_tags, swarming_extra_suffix) | 688 swarming_tags, swarming_extra_suffix) |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1228 GTestTest('ui_base_unittests'), | 1300 GTestTest('ui_base_unittests'), |
1229 GTestTest('ui_ios_unittests'), | 1301 GTestTest('ui_ios_unittests'), |
1230 GTestTest('sync_unit_tests'), | 1302 GTestTest('sync_unit_tests'), |
1231 GTestTest('sql_unittests'), | 1303 GTestTest('sql_unittests'), |
1232 ] | 1304 ] |
1233 | 1305 |
1234 GOMA_TESTS = [ | 1306 GOMA_TESTS = [ |
1235 GTestTest('base_unittests'), | 1307 GTestTest('base_unittests'), |
1236 GTestTest('content_unittests'), | 1308 GTestTest('content_unittests'), |
1237 ] | 1309 ] |
OLD | NEW |