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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1031 |
1032 def AddBuildrunnerWebkitPythonTests(self, factory_properties=None): | 1032 def AddBuildrunnerWebkitPythonTests(self, factory_properties=None): |
1033 """Adds a step to the factory to run test-webkitpy.""" | 1033 """Adds a step to the factory to run test-webkitpy.""" |
1034 cmd = [self._python, self._test_webkitpy_tool, | 1034 cmd = [self._python, self._test_webkitpy_tool, |
1035 '--build-dir', self._build_dir, '--target', self._target] | 1035 '--build-dir', self._build_dir, '--target', self._target] |
1036 self.AddBuildrunnerTestStep(shell.ShellCommand, | 1036 self.AddBuildrunnerTestStep(shell.ShellCommand, |
1037 test_name='webkit_python_tests', | 1037 test_name='webkit_python_tests', |
1038 test_command=cmd, | 1038 test_command=cmd, |
1039 do_step_if=self.TestStepFilter) | 1039 do_step_if=self.TestStepFilter) |
1040 | 1040 |
| 1041 def AddWebRTCTests(self, tests, factory_properties, timeout=1200): |
| 1042 """Adds a list of tests, possibly prefixed for running within a tool. |
| 1043 |
| 1044 To run a test under memcheck, prefix the test name with 'memcheck_'. |
| 1045 To run a test under tsan, prefix the test name with 'tsan_'. |
| 1046 The following prefixes are supported: |
| 1047 - 'memcheck_' for memcheck |
| 1048 - 'tsan_' for Thread Sanitizer (tsan) |
| 1049 - 'tsan_gcc_' for Thread Sanitizer (GCC) |
| 1050 - 'tsan_rv_' for Thread Sanitizer (RaceVerifier) |
| 1051 - 'drmemory_full_' for Dr Memory (full) |
| 1052 - 'drmemory_light_' for Dr Memory (light) |
| 1053 - 'drmemory_pattern_' for Dr Memory (pattern) |
| 1054 |
| 1055 To run a test with perf measurements; add a key 'perf_measuring_tests' |
| 1056 mapped to a list of test names in the factory properties. |
| 1057 |
| 1058 To run a test using the buildbot_tests.py script in WebRTC; add a key |
| 1059 'custom_cmd_line_tests' mapped to a list of test names in the factory |
| 1060 properties. |
| 1061 |
| 1062 Args: |
| 1063 tests: List of test names, possibly prefixed as described above. |
| 1064 factory_properties: Dict of properties to be used during execution. |
| 1065 timeout: Max time a test may run before it is killed. |
| 1066 """ |
| 1067 |
| 1068 def M(test, prefix, fp, timeout): |
| 1069 """If the prefix matches the test name it is added and True is returned. |
| 1070 """ |
| 1071 if test.startswith(prefix): |
| 1072 self.AddMemoryTest(test[len(prefix):], prefix[:-1], timeout, fp) |
| 1073 return True |
| 1074 return False |
| 1075 |
| 1076 def IsPerf(test_name, factory_properties): |
| 1077 perf_measuring_tests = factory_properties.get('perf_measuring_tests', []) |
| 1078 return test_name in perf_measuring_tests |
| 1079 |
| 1080 custom_cmd_line_tests = factory_properties.get('custom_cmd_line_tests', []) |
| 1081 for test in tests: |
| 1082 if M(test, 'memcheck_', factory_properties, timeout): |
| 1083 continue |
| 1084 if M(test, 'tsan_rv_', factory_properties, timeout): |
| 1085 continue |
| 1086 if M(test, 'tsan_', factory_properties, timeout): |
| 1087 continue |
| 1088 if M(test, 'drmemory_full_', factory_properties, timeout): |
| 1089 continue |
| 1090 if M(test, 'drmemory_light_', factory_properties, timeout): |
| 1091 continue |
| 1092 if M(test, 'drmemory_pattern_', factory_properties, timeout): |
| 1093 continue |
| 1094 |
| 1095 if test in custom_cmd_line_tests: |
| 1096 # This hardcoded path is not pretty but it's better than duplicating |
| 1097 # the output-path-finding code that only seems to exist in runtest.py. |
| 1098 test_run_script = 'src/out/%s/buildbot_tests.py' % self._target |
| 1099 args_list = ['--test', test] |
| 1100 if IsPerf(test, factory_properties): |
| 1101 self.AddAnnotatedPerfStep(test_name=test, gtest_filter=None, |
| 1102 log_type='graphing', |
| 1103 factory_properties=factory_properties, |
| 1104 cmd_name=test_run_script, |
| 1105 cmd_options=args_list, step_name=test, |
| 1106 py_script=True) |
| 1107 else: |
| 1108 cmd = self.GetPythonTestCommand(test_run_script, arg_list=args_list) |
| 1109 self.AddTestStep(chromium_step.AnnotatedCommand, test, cmd) |
| 1110 else: |
| 1111 if IsPerf(test, factory_properties): |
| 1112 self.AddAnnotatedPerfStep(test_name=test, gtest_filter=None, |
| 1113 log_type='graphing', |
| 1114 factory_properties=factory_properties, |
| 1115 cmd_name=test) |
| 1116 else: |
| 1117 self.AddGTestTestStep(test_name=test, |
| 1118 factory_properties=factory_properties) |
| 1119 |
1041 def AddWebkitTests(self, factory_properties=None): | 1120 def AddWebkitTests(self, factory_properties=None): |
1042 """Adds a step to the factory to run the WebKit layout tests. | 1121 """Adds a step to the factory to run the WebKit layout tests. |
1043 | 1122 |
1044 Args: | 1123 Args: |
1045 with_pageheap: if True, page-heap checking will be enabled for test_shell | 1124 with_pageheap: if True, page-heap checking will be enabled for test_shell |
1046 test_timeout: buildbot timeout for the test step | 1125 test_timeout: buildbot timeout for the test step |
1047 archive_timeout: buildbot timeout for archiving the test results and | 1126 archive_timeout: buildbot timeout for archiving the test results and |
1048 crashes, if requested | 1127 crashes, if requested |
1049 archive_results: whether to archive the test results | 1128 archive_results: whether to archive the test results |
1050 archive_crashes: whether to archive crash reports resulting from the | 1129 archive_crashes: whether to archive crash reports resulting from the |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1669 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
1591 | 1670 |
1592 | 1671 |
1593 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1672 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
1594 if not factory_properties or 'gs_bucket' not in factory_properties: | 1673 if not factory_properties or 'gs_bucket' not in factory_properties: |
1595 return (_GetArchiveUrl('snapshots', builder_name), None) | 1674 return (_GetArchiveUrl('snapshots', builder_name), None) |
1596 gs_bucket = factory_properties['gs_bucket'] | 1675 gs_bucket = factory_properties['gs_bucket'] |
1597 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1676 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
1598 gs_bucket) | 1677 gs_bucket) |
1599 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1678 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
OLD | NEW |