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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 | 1020 |
1021 def AddBuildrunnerWebkitPythonTests(self, factory_properties=None): | 1021 def AddBuildrunnerWebkitPythonTests(self, factory_properties=None): |
1022 """Adds a step to the factory to run test-webkitpy.""" | 1022 """Adds a step to the factory to run test-webkitpy.""" |
1023 cmd = [self._python, self._test_webkitpy_tool, | 1023 cmd = [self._python, self._test_webkitpy_tool, |
1024 '--build-dir', self._build_dir, '--target', self._target] | 1024 '--build-dir', self._build_dir, '--target', self._target] |
1025 self.AddBuildrunnerTestStep(shell.ShellCommand, | 1025 self.AddBuildrunnerTestStep(shell.ShellCommand, |
1026 test_name='webkit_python_tests', | 1026 test_name='webkit_python_tests', |
1027 test_command=cmd, | 1027 test_command=cmd, |
1028 do_step_if=self.TestStepFilter) | 1028 do_step_if=self.TestStepFilter) |
1029 | 1029 |
1030 def AddWebRTCTests(self, tests, factory_properties, timeout=1200): | |
iannucci
2013/06/25 05:32:27
Breaks my heart to add more code to the master :/
| |
1031 """Adds a list of tests, possibly prefixed for running within a tool. | |
1032 | |
1033 To run a test under memcheck, prefix the test name with 'memcheck_'. | |
1034 To run a test under tsan, prefix the test name with 'tsan_'. | |
1035 The following prefixes are supported: | |
1036 - 'memcheck_' for memcheck | |
1037 - 'tsan_' for Thread Sanitizer (tsan) | |
1038 - 'tsan_gcc_' for Thread Sanitizer (GCC) | |
1039 - 'tsan_rv_' for Thread Sanitizer (RaceVerifier) | |
1040 - 'drmemory_full_' for Dr Memory (full) | |
1041 - 'drmemory_light_' for Dr Memory (light) | |
1042 - 'drmemory_pattern_' for Dr Memory (pattern) | |
1043 | |
1044 To run a test with perf measurements; add a key 'perf_measuring_tests' | |
1045 mapped to a list of test names in the factory properties. | |
1046 | |
1047 To run a test using the buildbot_tests.py script in WebRTC; add a key | |
1048 'custom_cmd_line_tests' mapped to a list of test names in the factory | |
1049 properties. | |
1050 | |
1051 Args: | |
1052 tests: List of test names, possibly prefixed as described above. | |
1053 factory_properties: Dict of properties to be used during execution. | |
1054 timeout: Max time a test may run before it is killed. | |
1055 """ | |
1056 | |
1057 def M(test, prefix, fp, timeout): | |
1058 """If the prefix matches the test name it is added and True is returned. | |
1059 """ | |
1060 if test.startswith(prefix): | |
1061 self.AddMemoryTest(test[len(prefix):], prefix[:-1], timeout, fp) | |
1062 return True | |
1063 return False | |
1064 | |
1065 def IsPerf(test_name, factory_properties): | |
1066 perf_measuring_tests = factory_properties.get('perf_measuring_tests', []) | |
1067 return test_name in perf_measuring_tests | |
1068 | |
1069 custom_cmd_line_tests = factory_properties.get('custom_cmd_line_tests', []) | |
1070 for test in tests: | |
1071 if M(test, 'memcheck_', factory_properties, timeout): | |
1072 continue | |
1073 if M(test, 'tsan_rv_', factory_properties, timeout): | |
1074 continue | |
1075 if M(test, 'tsan_', factory_properties, timeout): | |
1076 continue | |
1077 if M(test, 'drmemory_full_', factory_properties, timeout): | |
1078 continue | |
1079 if M(test, 'drmemory_light_', factory_properties, timeout): | |
1080 continue | |
1081 if M(test, 'drmemory_pattern_', factory_properties, timeout): | |
1082 continue | |
1083 | |
1084 if test in custom_cmd_line_tests: | |
1085 # This hardcoded path is not pretty but it's better than duplicating | |
1086 # the output-path-finding code that only seems to exist in runtest.py. | |
1087 test_run_script = 'src/out/%s/buildbot_tests.py' % self._target | |
1088 args_list = ['--test', test] | |
1089 if IsPerf(test, factory_properties): | |
1090 self.AddAnnotatedPerfStep(test_name=test, gtest_filter=None, | |
1091 log_type='graphing', | |
1092 factory_properties=factory_properties, | |
1093 cmd_name=test_run_script, | |
1094 cmd_options=args_list, step_name=test, | |
1095 py_script=True) | |
1096 else: | |
1097 cmd = self.GetPythonTestCommand(test_run_script, arg_list=args_list) | |
1098 self.AddTestStep(chromium_step.AnnotatedCommand, test, cmd) | |
1099 else: | |
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) | |
1105 else: | |
1106 self.AddGTestTestStep(test_name=test, | |
1107 factory_properties=factory_properties) | |
1108 | |
1030 def AddWebkitTests(self, factory_properties=None): | 1109 def AddWebkitTests(self, factory_properties=None): |
1031 """Adds a step to the factory to run the WebKit layout tests. | 1110 """Adds a step to the factory to run the WebKit layout tests. |
1032 | 1111 |
1033 Args: | 1112 Args: |
1034 with_pageheap: if True, page-heap checking will be enabled for test_shell | 1113 with_pageheap: if True, page-heap checking will be enabled for test_shell |
1035 test_timeout: buildbot timeout for the test step | 1114 test_timeout: buildbot timeout for the test step |
1036 archive_timeout: buildbot timeout for archiving the test results and | 1115 archive_timeout: buildbot timeout for archiving the test results and |
1037 crashes, if requested | 1116 crashes, if requested |
1038 archive_results: whether to archive the test results | 1117 archive_results: whether to archive the test results |
1039 archive_crashes: whether to archive crash reports resulting from the | 1118 archive_crashes: whether to archive crash reports resulting from the |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1622 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1701 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
1623 | 1702 |
1624 | 1703 |
1625 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1704 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
1626 if not factory_properties or 'gs_bucket' not in factory_properties: | 1705 if not factory_properties or 'gs_bucket' not in factory_properties: |
1627 return (_GetArchiveUrl('snapshots', builder_name), None) | 1706 return (_GetArchiveUrl('snapshots', builder_name), None) |
1628 gs_bucket = factory_properties['gs_bucket'] | 1707 gs_bucket = factory_properties['gs_bucket'] |
1629 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1708 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
1630 gs_bucket) | 1709 gs_bucket) |
1631 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1710 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
OLD | NEW |