OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Set of utilities to add commands to a buildbot factory. | 5 """Set of utilities to add commands to a buildbot factory. |
6 | 6 |
7 This is based on commands.py and adds chromium-specific commands.""" | 7 This is based on commands.py and adds chromium-specific commands.""" |
8 | 8 |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 def AddMemoryTest(self, test_name, tool_name, timeout=1200, | 772 def AddMemoryTest(self, test_name, tool_name, timeout=1200, |
773 factory_properties=None, | 773 factory_properties=None, |
774 wrapper_args=None): | 774 wrapper_args=None): |
775 factory_properties = factory_properties or {} | 775 factory_properties = factory_properties or {} |
776 factory_properties['full_test_name'] = True | 776 factory_properties['full_test_name'] = True |
777 if not wrapper_args: | 777 if not wrapper_args: |
778 wrapper_args = [] | 778 wrapper_args = [] |
779 wrapper_args.extend([ | 779 wrapper_args.extend([ |
780 '--annotate=gtest', | 780 '--annotate=gtest', |
781 '--test-type', 'memory test: %s' % test_name | 781 '--test-type', 'memory test: %s' % test_name |
| 782 '--pass-build-dir', |
| 783 '--pass-target', |
782 ]) | 784 ]) |
783 command_class = chromium_step.AnnotatedCommand | 785 command_class = chromium_step.AnnotatedCommand |
784 | 786 |
785 # TODO(timurrrr): merge this with Heapcheck runner. http://crbug.com/45482 | 787 # TODO(timurrrr): merge this with Heapcheck runner. http://crbug.com/45482 |
786 build_dir, _ = chromium_utils.ConvertBuildDirToLegacy(self._build_dir, | |
787 self._target_platform) | |
788 build_dir = os.path.join(build_dir, self._target) | |
789 | |
790 do_step_if = self.TestStepFilter | 788 do_step_if = self.TestStepFilter |
791 matched = re.search(r'_([0-9]*)_of_([0-9]*)$', test_name) | 789 matched = re.search(r'_([0-9]*)_of_([0-9]*)$', test_name) |
792 if matched: | 790 if matched: |
793 test_name = test_name[0:matched.start()] | 791 test_name = test_name[0:matched.start()] |
794 shard = int(matched.group(1)) | 792 shard = int(matched.group(1)) |
795 numshards = int(matched.group(2)) | 793 numshards = int(matched.group(2)) |
796 wrapper_args.extend(['--shard-index', str(shard), | 794 wrapper_args.extend(['--shard-index', str(shard), |
797 '--total-shards', str(numshards)]) | 795 '--total-shards', str(numshards)]) |
798 if test_name in factory_properties.get('sharded_tests', []): | 796 if test_name in factory_properties.get('sharded_tests', []): |
799 wrapper_args.append('--parallel') | 797 wrapper_args.append('--parallel') |
800 sharding_args = factory_properties.get('sharding_args') | 798 sharding_args = factory_properties.get('sharding_args') |
801 if sharding_args: | 799 if sharding_args: |
802 wrapper_args.extend(['--sharding-args', sharding_args]) | 800 wrapper_args.extend(['--sharding-args', sharding_args]) |
803 elif test_name.endswith('_gtest_filter_required'): | 801 elif test_name.endswith('_gtest_filter_required'): |
804 test_name = test_name[0:-len('_gtest_filter_required')] | 802 test_name = test_name[0:-len('_gtest_filter_required')] |
805 # This is only to be run on the Try Server. | 803 # This is only to be run on the Try Server. |
806 # TODO(maruel): This code should use GetTestStepFilter() instead! | 804 # TODO(maruel): This code should use GetTestStepFilter() instead! |
807 do_step_if = self.TestStepFilterGTestFilterRequired | 805 do_step_if = self.TestStepFilterGTestFilterRequired |
808 | 806 |
809 # Memory tests runner script path is relative to build_dir. | 807 # Memory tests runner script path is relative to build dir. |
810 if self._target_platform != 'win32': | 808 if self._target_platform != 'win32': |
811 runner = os.path.join('..', '..', '..', self._posix_memory_tests_runner) | 809 runner = os.path.join('..', '..', '..', self._posix_memory_tests_runner) |
812 else: | 810 else: |
813 runner = os.path.join('..', '..', '..', self._win_memory_tests_runner) | 811 runner = os.path.join('..', '..', '..', self._win_memory_tests_runner) |
814 | 812 |
815 cmd = self.GetShellTestCommand(runner, arg_list=[ | 813 cmd = self.GetShellTestCommand(runner, arg_list=[ |
816 '--build_dir', build_dir, | |
817 '--test', test_name, | 814 '--test', test_name, |
818 '--tool', tool_name, | 815 '--tool', tool_name, |
819 WithProperties('%(gtest_filter)s')], | 816 WithProperties('%(gtest_filter)s')], |
820 wrapper_args=wrapper_args, | 817 wrapper_args=wrapper_args, |
821 factory_properties=factory_properties) | 818 factory_properties=factory_properties) |
822 | 819 |
823 test_name = 'memory test: %s' % test_name | 820 test_name = 'memory test: %s' % test_name |
824 self.AddTestStep(command_class, test_name, cmd, | 821 self.AddTestStep(command_class, test_name, cmd, |
825 timeout=timeout, | 822 timeout=timeout, |
826 do_step_if=do_step_if) | 823 do_step_if=do_step_if) |
827 | 824 |
828 def AddHeapcheckTest(self, test_name, timeout, factory_properties, | 825 def AddHeapcheckTest(self, test_name, timeout, factory_properties, |
829 wrapper_args=None): | 826 wrapper_args=None): |
830 | 827 |
831 factory_properties = factory_properties or {} | 828 factory_properties = factory_properties or {} |
832 factory_properties['full_test_name'] = True | 829 factory_properties['full_test_name'] = True |
833 if not wrapper_args: | 830 if not wrapper_args: |
834 wrapper_args = [] | 831 wrapper_args = [] |
835 wrapper_args.extend([ | 832 wrapper_args.extend([ |
836 '--annotate=gtest', | 833 '--annotate=gtest', |
837 '--test-type', 'heapcheck test: %s' % test_name | 834 '--test-type', 'heapcheck test: %s' % test_name |
| 835 '--pass-build-dir', |
| 836 '--pass-target', |
838 ]) | 837 ]) |
839 command_class = chromium_step.AnnotatedCommand | 838 command_class = chromium_step.AnnotatedCommand |
840 | 839 |
841 build_dir, _ = chromium_utils.ConvertBuildDirToLegacy(self._build_dir, | |
842 self._target_platform) | |
843 build_dir = os.path.join(build_dir, self._target) | |
844 | |
845 matched = re.search(r'_([0-9]*)_of_([0-9]*)$', test_name) | 840 matched = re.search(r'_([0-9]*)_of_([0-9]*)$', test_name) |
846 if matched: | 841 if matched: |
847 test_name = test_name[0:matched.start()] | 842 test_name = test_name[0:matched.start()] |
848 shard = int(matched.group(1)) | 843 shard = int(matched.group(1)) |
849 numshards = int(matched.group(2)) | 844 numshards = int(matched.group(2)) |
850 wrapper_args.extend(['--shard-index', str(shard), | 845 wrapper_args.extend(['--shard-index', str(shard), |
851 '--total-shards', str(numshards)]) | 846 '--total-shards', str(numshards)]) |
852 | 847 |
853 heapcheck_tool = os.path.join('..', '..', '..', self._heapcheck_tool) | 848 heapcheck_tool = os.path.join('..', '..', '..', self._heapcheck_tool) |
854 | 849 |
855 cmd = self.GetShellTestCommand(heapcheck_tool, arg_list=[ | 850 cmd = self.GetShellTestCommand(heapcheck_tool, arg_list=[ |
856 '--build_dir', build_dir, | |
857 '--test', test_name], | 851 '--test', test_name], |
858 wrapper_args=wrapper_args, | 852 wrapper_args=wrapper_args, |
859 factory_properties=factory_properties) | 853 factory_properties=factory_properties) |
860 | 854 |
861 test_name = 'heapcheck test: %s' % test_name | 855 test_name = 'heapcheck test: %s' % test_name |
862 self.AddTestStep(command_class, test_name, cmd, | 856 self.AddTestStep(command_class, test_name, cmd, |
863 timeout=timeout, | 857 timeout=timeout, |
864 do_step_if=self.TestStepFilter) | 858 do_step_if=self.TestStepFilter) |
865 | 859 |
866 def _AddBasicPythonTest(self, test_name, script, args=None, timeout=1200): | 860 def _AddBasicPythonTest(self, test_name, script, args=None, timeout=1200): |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1826 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
1833 | 1827 |
1834 | 1828 |
1835 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1829 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
1836 if not factory_properties or 'gs_bucket' not in factory_properties: | 1830 if not factory_properties or 'gs_bucket' not in factory_properties: |
1837 return (_GetArchiveUrl('snapshots', builder_name), None) | 1831 return (_GetArchiveUrl('snapshots', builder_name), None) |
1838 gs_bucket = factory_properties['gs_bucket'] | 1832 gs_bucket = factory_properties['gs_bucket'] |
1839 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1833 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
1840 gs_bucket) | 1834 gs_bucket) |
1841 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1835 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
OLD | NEW |