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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 cmd = map(lambda x:x if x!= self._build_dir else J(src_base, x), cmd) | 979 cmd = map(lambda x:x if x!= self._build_dir else J(src_base, x), cmd) |
980 | 980 |
981 # Allow setting a custom environment for a PyAuto test. | 981 # Allow setting a custom environment for a PyAuto test. |
982 env = factory_properties.get('pyauto_env', {'PYTHONPATH': '.'}) | 982 env = factory_properties.get('pyauto_env', {'PYTHONPATH': '.'}) |
983 | 983 |
984 self.AddTestStep(chromium_step.AnnotatedCommand, test_name, cmd, env=env, | 984 self.AddTestStep(chromium_step.AnnotatedCommand, test_name, cmd, env=env, |
985 target=self._target, factory_properties=factory_properties, | 985 target=self._target, factory_properties=factory_properties, |
986 timeout=timeout, workdir=workdir, | 986 timeout=timeout, workdir=workdir, |
987 do_step_if=self.GetTestStepFilter(factory_properties)) | 987 do_step_if=self.GetTestStepFilter(factory_properties)) |
988 | 988 |
989 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, | |
990 factory_properties, timeout=1200, wpr=False): | |
991 """Adds a step to run PyAuto-based Chrome Endure tests. | |
992 | |
993 Args: | |
994 test_class_name: A string name for this class of tests. For example, | |
995 'control' for Endure 'control' tests. | |
996 pyauto_test_list: A list of strings, where each string is the full name | |
997 of a pyauto test to run (file.class.test_name). | |
998 factory_properties: A dictionary of factory property values. | |
999 timeout: The buildbot timeout for this step, in seconds. The step will | |
1000 fail if the test does not produce any output within this time. | |
1001 wpr: A boolean indicating whether or not to run the test using Web Page | |
1002 replay (WPR). If using WPR, the test will replay webapp interactions | |
1003 from a pre-recorded file, rather than using the live site. | |
1004 """ | |
1005 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', | |
1006 'pyauto_functional.py') | |
1007 # Only run on linux for now. | |
1008 if not self._target_platform.startswith('linux'): | |
1009 return | |
1010 | |
1011 env = factory_properties.get('test_env', {}) | |
1012 if 'PYTHONPATH' not in env: | |
1013 env['PYTHONPATH'] = '.' | |
1014 if 'GSUTIL' not in env: | |
1015 env['GSUTIL'] = self._gsutil | |
1016 if not wpr: | |
1017 env['ENDURE_NO_WPR'] = '1' | |
1018 | |
1019 factory_properties = factory_properties.copy() | |
1020 for pyauto_test_name in pyauto_test_list: | |
1021 tool_opts = [] | |
1022 if not factory_properties.get('use_xvfb_on_linux'): | |
1023 tool_opts = ['--no-xvfb'] | |
1024 | |
1025 test_name = (test_class_name.replace('-', '_') + '-' + | |
1026 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) | |
1027 step_name = 'endure_' + test_name | |
1028 factory_properties['step_name'] = step_name | |
1029 | |
1030 pyauto_cmd = self.GetAnnotatedPerfCmd( | |
1031 gtest_filter=None, | |
1032 log_type='endure', | |
1033 test_name=test_name, | |
1034 cmd_name=pyauto_script, | |
1035 tool_opts=tool_opts, | |
1036 options=['-v'], | |
1037 factory_properties=factory_properties, | |
1038 py_script=True) | |
1039 pyauto_cmd.append(pyauto_test_name) | |
1040 | |
1041 self.AddTestStep(chromium_step.AnnotatedCommand, | |
1042 step_name, | |
1043 pyauto_cmd, | |
1044 env=env, | |
1045 timeout=timeout, | |
1046 target=self._target, | |
1047 factory_properties=factory_properties, | |
1048 do_step_if=self.GetTestStepFilter(factory_properties)) | |
1049 | |
1050 def AddDevToolsTests(self, factory_properties=None): | 989 def AddDevToolsTests(self, factory_properties=None): |
1051 factory_properties = factory_properties or {} | 990 factory_properties = factory_properties or {} |
1052 | 991 |
1053 args = ['--target', self._target, | 992 args = ['--target', self._target, |
1054 '--build-dir', self._build_dir] | 993 '--build-dir', self._build_dir] |
1055 | 994 |
1056 self.AddAnnotatedPerfStep('devtools_perf', None, 'graphing', | 995 self.AddAnnotatedPerfStep('devtools_perf', None, 'graphing', |
1057 step_name='DevTools.PerfTest', | 996 step_name='DevTools.PerfTest', |
1058 cmd_name = self._devtools_perf_test_tool, | 997 cmd_name = self._devtools_perf_test_tool, |
1059 cmd_options=args, | 998 cmd_options=args, |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1777 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
1839 | 1778 |
1840 | 1779 |
1841 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1780 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
1842 if not factory_properties or 'gs_bucket' not in factory_properties: | 1781 if not factory_properties or 'gs_bucket' not in factory_properties: |
1843 return (_GetArchiveUrl('snapshots', builder_name), None) | 1782 return (_GetArchiveUrl('snapshots', builder_name), None) |
1844 gs_bucket = factory_properties['gs_bucket'] | 1783 gs_bucket = factory_properties['gs_bucket'] |
1845 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1784 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
1846 gs_bucket) | 1785 gs_bucket) |
1847 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1786 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
OLD | NEW |