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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 env=env, | 930 env=env, |
931 workdir=workdir, | 931 workdir=workdir, |
932 timeout=timeout, | 932 timeout=timeout, |
933 do_step_if=self.GetTestStepFilter(factory_properties)) | 933 do_step_if=self.GetTestStepFilter(factory_properties)) |
934 | 934 |
935 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, | 935 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, |
936 factory_properties, timeout=1200, wpr=False): | 936 factory_properties, timeout=1200, wpr=False): |
937 """Adds a step to run PyAuto-based Chrome Endure tests. | 937 """Adds a step to run PyAuto-based Chrome Endure tests. |
938 | 938 |
939 Args: | 939 Args: |
940 test_class_name: A string name for this class of tests. | 940 test_class_name: A string name for this class of tests. For example, |
| 941 'control' for Endure 'control' tests. |
941 pyauto_test_list: A list of strings, where each string is the full name | 942 pyauto_test_list: A list of strings, where each string is the full name |
942 of a pyauto test to run (file.class.test_name). | 943 of a pyauto test to run (file.class.test_name). |
943 factory_properties: A dictionary of factory property values. | 944 factory_properties: A dictionary of factory property values. |
944 timeout: The buildbot timeout for this step, in seconds. The step will | 945 timeout: The buildbot timeout for this step, in seconds. The step will |
945 fail if the test does not produce any output within this time. | 946 fail if the test does not produce any output within this time. |
946 wpr: A boolean indicating whether or not to run the test using Web Page | 947 wpr: A boolean indicating whether or not to run the test using Web Page |
947 replay (WPR). If using WPR, the test will replay webapp interactions | 948 replay (WPR). If using WPR, the test will replay webapp interactions |
948 from a pre-recorded file, rather than using the live site. | 949 from a pre-recorded file, rather than using the live site. |
949 """ | 950 """ |
950 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', | 951 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', |
951 'pyauto_functional.py') | 952 'pyauto_functional.py') |
952 # Only run on linux for now. | 953 # Only run on linux for now. |
953 if not self._target_platform.startswith('linux'): | 954 if not self._target_platform.startswith('linux'): |
954 return | 955 return |
955 | 956 |
956 env = factory_properties.get('test_env', {}) | 957 env = factory_properties.get('test_env', {}) |
957 if 'PYTHONPATH' not in env: | 958 if 'PYTHONPATH' not in env: |
958 env['PYTHONPATH'] = '.' | 959 env['PYTHONPATH'] = '.' |
959 if not wpr: | 960 if not wpr: |
960 env['ENDURE_NO_WPR'] = '1' | 961 env['ENDURE_NO_WPR'] = '1' |
961 | 962 |
962 factory_properties = factory_properties.copy() | 963 factory_properties = factory_properties.copy() |
963 for pyauto_test_name in pyauto_test_list: | 964 for pyauto_test_name in pyauto_test_list: |
964 tool_opts = [] | 965 tool_opts = [] |
965 if not factory_properties.get('use_xvfb_on_linux'): | 966 if not factory_properties.get('use_xvfb_on_linux'): |
966 tool_opts = ['--no-xvfb'] | 967 tool_opts = ['--no-xvfb'] |
967 | 968 |
968 step_name = (test_class_name.replace('-', '_') + '-' + | 969 test_name = (test_class_name.replace('-', '_') + '-' + |
969 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) | 970 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) |
| 971 step_name = 'endure_' + test_name |
970 factory_properties['step_name'] = step_name | 972 factory_properties['step_name'] = step_name |
971 | 973 |
972 pyauto_cmd = self.GetAnnotatedPerfCmd( | 974 pyauto_cmd = self.GetAnnotatedPerfCmd( |
973 gtest_filter=None, | 975 gtest_filter=None, |
974 log_type='endure', | 976 log_type='endure', |
975 test_name=test_class_name, | 977 test_name=test_name, |
976 cmd_name=pyauto_script, | 978 cmd_name=pyauto_script, |
977 tool_opts=tool_opts, | 979 tool_opts=tool_opts, |
978 options=['-v'], | 980 options=['-v'], |
979 factory_properties=factory_properties, | 981 factory_properties=factory_properties, |
980 py_script=True) | 982 py_script=True) |
981 pyauto_cmd.append(pyauto_test_name) | 983 pyauto_cmd.append(pyauto_test_name) |
982 | 984 |
983 self.AddTestStep(chromium_step.AnnotatedCommand, | 985 self.AddTestStep(chromium_step.AnnotatedCommand, |
984 step_name, | 986 step_name, |
985 pyauto_cmd, | 987 pyauto_cmd, |
986 env=env, | 988 env=env, |
987 timeout=timeout, | 989 timeout=timeout, |
| 990 target=self._target, |
| 991 factory_properties=factory_properties, |
988 do_step_if=self.GetTestStepFilter(factory_properties)) | 992 do_step_if=self.GetTestStepFilter(factory_properties)) |
989 | 993 |
990 def AddDevToolsTests(self, factory_properties=None): | 994 def AddDevToolsTests(self, factory_properties=None): |
991 factory_properties = factory_properties or {} | 995 factory_properties = factory_properties or {} |
992 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', | 996 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', |
993 process_log.GraphingLogProcessor) | 997 process_log.GraphingLogProcessor) |
994 | 998 |
995 cmd = [self._python, self._devtools_perf_test_tool, | 999 cmd = [self._python, self._devtools_perf_test_tool, |
996 '--target', self._target, | 1000 '--target', self._target, |
997 '--build-dir', self._build_dir | 1001 '--build-dir', self._build_dir |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1583 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
1580 | 1584 |
1581 | 1585 |
1582 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1586 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
1583 if not factory_properties or 'gs_bucket' not in factory_properties: | 1587 if not factory_properties or 'gs_bucket' not in factory_properties: |
1584 return (_GetArchiveUrl('snapshots', builder_name), None) | 1588 return (_GetArchiveUrl('snapshots', builder_name), None) |
1585 gs_bucket = factory_properties['gs_bucket'] | 1589 gs_bucket = factory_properties['gs_bucket'] |
1586 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1590 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
1587 gs_bucket) | 1591 gs_bucket) |
1588 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1592 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
OLD | NEW |