Includes library modifications to allow access to AIN_4 (AIN_0 / 5)
mbd_os/tools/buildbot/master.cfg@0:eafc3fd41f75, 2016-09-20 (annotated)
- Committer:
- bryantaylor
- Date:
- Tue Sep 20 21:26:12 2016 +0000
- Revision:
- 0:eafc3fd41f75
hackathon
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bryantaylor | 0:eafc3fd41f75 | 1 | # -*- python -*- |
bryantaylor | 0:eafc3fd41f75 | 2 | # ex: set syntax=python: |
bryantaylor | 0:eafc3fd41f75 | 3 | |
bryantaylor | 0:eafc3fd41f75 | 4 | # This is a sample buildmaster config file. It must be installed as |
bryantaylor | 0:eafc3fd41f75 | 5 | # 'master.cfg' in your buildmaster's base directory. |
bryantaylor | 0:eafc3fd41f75 | 6 | |
bryantaylor | 0:eafc3fd41f75 | 7 | # This is the dictionary that the buildmaster pays attention to. We also use |
bryantaylor | 0:eafc3fd41f75 | 8 | # a shorter alias to save typing. |
bryantaylor | 0:eafc3fd41f75 | 9 | c = BuildmasterConfig = {} |
bryantaylor | 0:eafc3fd41f75 | 10 | |
bryantaylor | 0:eafc3fd41f75 | 11 | ####### BUILDSLAVES |
bryantaylor | 0:eafc3fd41f75 | 12 | |
bryantaylor | 0:eafc3fd41f75 | 13 | # The 'slaves' list defines the set of recognized buildslaves. Each element is |
bryantaylor | 0:eafc3fd41f75 | 14 | # a BuildSlave object, specifying a unique slave name and password. The same |
bryantaylor | 0:eafc3fd41f75 | 15 | # slave name and password must be configured on the slave. |
bryantaylor | 0:eafc3fd41f75 | 16 | from buildbot.buildslave import BuildSlave |
bryantaylor | 0:eafc3fd41f75 | 17 | c['slaves'] = [BuildSlave("example-slave", "pass"), |
bryantaylor | 0:eafc3fd41f75 | 18 | BuildSlave("example-slave-2", "pass"), |
bryantaylor | 0:eafc3fd41f75 | 19 | BuildSlave("example-slave-KL25Z", "pass"), |
bryantaylor | 0:eafc3fd41f75 | 20 | BuildSlave("example-slave-LPC1768", "pass"), |
bryantaylor | 0:eafc3fd41f75 | 21 | BuildSlave("example-slave-LPC11U24", "pass"), |
bryantaylor | 0:eafc3fd41f75 | 22 | ] |
bryantaylor | 0:eafc3fd41f75 | 23 | |
bryantaylor | 0:eafc3fd41f75 | 24 | # 'slavePortnum' defines the TCP port to listen on for connections from slaves. |
bryantaylor | 0:eafc3fd41f75 | 25 | # This must match the value configured into the buildslaves (with their |
bryantaylor | 0:eafc3fd41f75 | 26 | # --master option) |
bryantaylor | 0:eafc3fd41f75 | 27 | c['slavePortnum'] = 9989 |
bryantaylor | 0:eafc3fd41f75 | 28 | |
bryantaylor | 0:eafc3fd41f75 | 29 | ####### OFFICIAL_MBED_LIBRARY_BUILD |
bryantaylor | 0:eafc3fd41f75 | 30 | |
bryantaylor | 0:eafc3fd41f75 | 31 | OFFICIAL_MBED_LIBRARY_BUILD = ( |
bryantaylor | 0:eafc3fd41f75 | 32 | ('LPC1768', ('ARM', 'GCC_ARM', 'GCC_CR', 'IAR')), |
bryantaylor | 0:eafc3fd41f75 | 33 | ('KL05Z', ('ARM', 'uARM', 'GCC_ARM')), |
bryantaylor | 0:eafc3fd41f75 | 34 | ('KL25Z', ('ARM', 'GCC_ARM')), |
bryantaylor | 0:eafc3fd41f75 | 35 | ('LPC11U24', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 36 | ('KL46Z', ('ARM', 'GCC_ARM')), |
bryantaylor | 0:eafc3fd41f75 | 37 | ('LPC4088', ('ARM', 'GCC_ARM', 'GCC_CR')), |
bryantaylor | 0:eafc3fd41f75 | 38 | ('LPC1347', ('ARM',)), |
bryantaylor | 0:eafc3fd41f75 | 39 | ('LPC1549', ('uARM',)), |
bryantaylor | 0:eafc3fd41f75 | 40 | ('LPC2368', ('ARM',)), |
bryantaylor | 0:eafc3fd41f75 | 41 | ('LPC812', ('uARM',)), |
bryantaylor | 0:eafc3fd41f75 | 42 | ('LPC11U35_401', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 43 | ('LPC1114', ('uARM',)), |
bryantaylor | 0:eafc3fd41f75 | 44 | ('NUCLEO_F103RB', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 45 | ('NUCLEO_L152RE', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 46 | ('NUCLEO_F401RE', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 47 | ('NUCLEO_F030R8', ('ARM', 'uARM')), |
bryantaylor | 0:eafc3fd41f75 | 48 | ('UBLOX_C027', ('ARM', 'GCC_ARM', 'GCC_CR', 'IAR')), |
bryantaylor | 0:eafc3fd41f75 | 49 | # ('NRF51822', ('ARM',)), |
bryantaylor | 0:eafc3fd41f75 | 50 | ) |
bryantaylor | 0:eafc3fd41f75 | 51 | |
bryantaylor | 0:eafc3fd41f75 | 52 | # Which hardware platforms are supported for target testing |
bryantaylor | 0:eafc3fd41f75 | 53 | OFFICIAL_MBED_TESTBED_SUPPORTED_HARDWARE = ( |
bryantaylor | 0:eafc3fd41f75 | 54 | # 'KL25Z', |
bryantaylor | 0:eafc3fd41f75 | 55 | # 'LPC1768', |
bryantaylor | 0:eafc3fd41f75 | 56 | # 'LPC11U24', |
bryantaylor | 0:eafc3fd41f75 | 57 | ) |
bryantaylor | 0:eafc3fd41f75 | 58 | |
bryantaylor | 0:eafc3fd41f75 | 59 | ####### CHANGESOURCES |
bryantaylor | 0:eafc3fd41f75 | 60 | |
bryantaylor | 0:eafc3fd41f75 | 61 | # the 'change_source' setting tells the buildmaster how it should find out |
bryantaylor | 0:eafc3fd41f75 | 62 | # about source code changes. Here we point to the buildbot clone of pyflakes. |
bryantaylor | 0:eafc3fd41f75 | 63 | |
bryantaylor | 0:eafc3fd41f75 | 64 | from buildbot.changes.gitpoller import GitPoller |
bryantaylor | 0:eafc3fd41f75 | 65 | c['change_source'] = [] |
bryantaylor | 0:eafc3fd41f75 | 66 | """ |
bryantaylor | 0:eafc3fd41f75 | 67 | c['change_source'].append(GitPoller( |
bryantaylor | 0:eafc3fd41f75 | 68 | 'git://github.com/buildbot/pyflakes.git', |
bryantaylor | 0:eafc3fd41f75 | 69 | workdir='gitpoller-workdir', branch='master', |
bryantaylor | 0:eafc3fd41f75 | 70 | pollinterval=300)) |
bryantaylor | 0:eafc3fd41f75 | 71 | """ |
bryantaylor | 0:eafc3fd41f75 | 72 | ####### SCHEDULERS |
bryantaylor | 0:eafc3fd41f75 | 73 | |
bryantaylor | 0:eafc3fd41f75 | 74 | # Configure the Schedulers, which decide how to react to incoming changes. In this |
bryantaylor | 0:eafc3fd41f75 | 75 | # case, just kick off a 'runtests' build |
bryantaylor | 0:eafc3fd41f75 | 76 | |
bryantaylor | 0:eafc3fd41f75 | 77 | from buildbot.schedulers.basic import SingleBranchScheduler |
bryantaylor | 0:eafc3fd41f75 | 78 | from buildbot.schedulers.forcesched import ForceScheduler |
bryantaylor | 0:eafc3fd41f75 | 79 | from buildbot.changes import filter |
bryantaylor | 0:eafc3fd41f75 | 80 | c['schedulers'] = [] |
bryantaylor | 0:eafc3fd41f75 | 81 | |
bryantaylor | 0:eafc3fd41f75 | 82 | # Create builders to generate one target using all assigned toolchains |
bryantaylor | 0:eafc3fd41f75 | 83 | release_builder_name = "BuildRelease" |
bryantaylor | 0:eafc3fd41f75 | 84 | builder_names = [release_builder_name] |
bryantaylor | 0:eafc3fd41f75 | 85 | for target_name, toolchains in OFFICIAL_MBED_LIBRARY_BUILD: |
bryantaylor | 0:eafc3fd41f75 | 86 | builder_name = "All_TC_%s" % target_name |
bryantaylor | 0:eafc3fd41f75 | 87 | builder_names.append(builder_name) |
bryantaylor | 0:eafc3fd41f75 | 88 | c['schedulers'].append(ForceScheduler(name="force", builderNames=builder_names)) |
bryantaylor | 0:eafc3fd41f75 | 89 | |
bryantaylor | 0:eafc3fd41f75 | 90 | ####### BUILDERS |
bryantaylor | 0:eafc3fd41f75 | 91 | |
bryantaylor | 0:eafc3fd41f75 | 92 | # The 'builders' list defines the Builders, which tell Buildbot how to perform a build: |
bryantaylor | 0:eafc3fd41f75 | 93 | # what steps, and which slaves can execute them. Note that any particular build will |
bryantaylor | 0:eafc3fd41f75 | 94 | # only take place on one slave. |
bryantaylor | 0:eafc3fd41f75 | 95 | |
bryantaylor | 0:eafc3fd41f75 | 96 | from buildbot.process.factory import BuildFactory |
bryantaylor | 0:eafc3fd41f75 | 97 | from buildbot.steps.source.git import Git |
bryantaylor | 0:eafc3fd41f75 | 98 | from buildbot.steps.shell import ShellCommand |
bryantaylor | 0:eafc3fd41f75 | 99 | from buildbot.process.buildstep import LogLineObserver |
bryantaylor | 0:eafc3fd41f75 | 100 | import buildbot.status.results |
bryantaylor | 0:eafc3fd41f75 | 101 | import re |
bryantaylor | 0:eafc3fd41f75 | 102 | import pprint |
bryantaylor | 0:eafc3fd41f75 | 103 | |
bryantaylor | 0:eafc3fd41f75 | 104 | class TestCommand(ShellCommand): |
bryantaylor | 0:eafc3fd41f75 | 105 | failedTestsCount = 0 # FAIL |
bryantaylor | 0:eafc3fd41f75 | 106 | passedTestsCount = 0 # OK |
bryantaylor | 0:eafc3fd41f75 | 107 | errorsTestsCount = 0 # ERROR |
bryantaylor | 0:eafc3fd41f75 | 108 | undefsTestsCount = 0 # UNDEF |
bryantaylor | 0:eafc3fd41f75 | 109 | testsResults = [] |
bryantaylor | 0:eafc3fd41f75 | 110 | |
bryantaylor | 0:eafc3fd41f75 | 111 | def __init__(self, stage=None,module=None, moduleset=None, **kwargs): |
bryantaylor | 0:eafc3fd41f75 | 112 | ShellCommand.__init__(self, **kwargs) |
bryantaylor | 0:eafc3fd41f75 | 113 | self.failedTestsCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 114 | self.passedTestsCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 115 | self.errorsTestsCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 116 | self.tracebackPyCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 117 | self.testsResults = [] |
bryantaylor | 0:eafc3fd41f75 | 118 | testFailuresObserver = UnitTestsObserver () |
bryantaylor | 0:eafc3fd41f75 | 119 | self.addLogObserver('stdio', testFailuresObserver) |
bryantaylor | 0:eafc3fd41f75 | 120 | |
bryantaylor | 0:eafc3fd41f75 | 121 | def createSummary(self, log): |
bryantaylor | 0:eafc3fd41f75 | 122 | if self.failedTestsCount >= 0 or self.passedTestsCount >= 0 or self.errorsTestsCount >= 0 or self.undefsTestsCount >= 0: |
bryantaylor | 0:eafc3fd41f75 | 123 | self.addHTMLLog ('tests summary', self.createTestsSummary()) |
bryantaylor | 0:eafc3fd41f75 | 124 | |
bryantaylor | 0:eafc3fd41f75 | 125 | def getText(self, cmd, results): |
bryantaylor | 0:eafc3fd41f75 | 126 | text = ShellCommand.getText(self, cmd, results) |
bryantaylor | 0:eafc3fd41f75 | 127 | text.append("OK: " + str(self.passedTestsCount)) |
bryantaylor | 0:eafc3fd41f75 | 128 | text.append("FAIL: " + str(self.failedTestsCount)) |
bryantaylor | 0:eafc3fd41f75 | 129 | text.append("ERROR: " + str(self.errorsTestsCount)) |
bryantaylor | 0:eafc3fd41f75 | 130 | text.append("UNDEF: " + str(self.undefsTestsCount)) |
bryantaylor | 0:eafc3fd41f75 | 131 | text.append("Traceback: " + str(self.tracebackPyCount)) |
bryantaylor | 0:eafc3fd41f75 | 132 | return text |
bryantaylor | 0:eafc3fd41f75 | 133 | |
bryantaylor | 0:eafc3fd41f75 | 134 | def evaluateCommand(self, cmd): |
bryantaylor | 0:eafc3fd41f75 | 135 | if self.failedTestsCount > 0: |
bryantaylor | 0:eafc3fd41f75 | 136 | return buildbot.status.results.WARNINGS |
bryantaylor | 0:eafc3fd41f75 | 137 | elif self.errorsTestsCount > 0 or self.undefsTestsCount > 0 or self.tracebackPyCount > 0: |
bryantaylor | 0:eafc3fd41f75 | 138 | return buildbot.status.results.FAILURE |
bryantaylor | 0:eafc3fd41f75 | 139 | return buildbot.status.results.SUCCESS |
bryantaylor | 0:eafc3fd41f75 | 140 | |
bryantaylor | 0:eafc3fd41f75 | 141 | def find_unique_tc_result_value(self, index): |
bryantaylor | 0:eafc3fd41f75 | 142 | """ Get unique values from each row in data parameter """ |
bryantaylor | 0:eafc3fd41f75 | 143 | result = [] |
bryantaylor | 0:eafc3fd41f75 | 144 | for tc_result_list in self.testsResults: |
bryantaylor | 0:eafc3fd41f75 | 145 | if tc_result_list[index] not in result: |
bryantaylor | 0:eafc3fd41f75 | 146 | result.append(tc_result_list[index]) |
bryantaylor | 0:eafc3fd41f75 | 147 | return result |
bryantaylor | 0:eafc3fd41f75 | 148 | |
bryantaylor | 0:eafc3fd41f75 | 149 | def html_view_test_result(self, targets, tests, toolchain): |
bryantaylor | 0:eafc3fd41f75 | 150 | """ Generates simple result table """ |
bryantaylor | 0:eafc3fd41f75 | 151 | COLOR_OK = "LimeGreen" |
bryantaylor | 0:eafc3fd41f75 | 152 | COLOR_FAIL = "LightCoral" |
bryantaylor | 0:eafc3fd41f75 | 153 | COLOR_UNDEF = "LightSlateGray" |
bryantaylor | 0:eafc3fd41f75 | 154 | COLOR_NEUTRAL = "Silver" |
bryantaylor | 0:eafc3fd41f75 | 155 | |
bryantaylor | 0:eafc3fd41f75 | 156 | STATUS_COLORS = { "OK" : COLOR_OK, |
bryantaylor | 0:eafc3fd41f75 | 157 | "FAIL" : COLOR_FAIL, |
bryantaylor | 0:eafc3fd41f75 | 158 | "UNDEF" : COLOR_UNDEF} |
bryantaylor | 0:eafc3fd41f75 | 159 | |
bryantaylor | 0:eafc3fd41f75 | 160 | result = "<table>" |
bryantaylor | 0:eafc3fd41f75 | 161 | result += "<tr valign='center'><td align='center'><b>" + toolchain + "</b></td>" |
bryantaylor | 0:eafc3fd41f75 | 162 | for test in tests: |
bryantaylor | 0:eafc3fd41f75 | 163 | result += "<td align='center'>" + test + "<br></td>" |
bryantaylor | 0:eafc3fd41f75 | 164 | result += "</tr>" |
bryantaylor | 0:eafc3fd41f75 | 165 | |
bryantaylor | 0:eafc3fd41f75 | 166 | for target in targets: |
bryantaylor | 0:eafc3fd41f75 | 167 | result += "<tr><td width='110px'><br>" + target + "<br></td>" |
bryantaylor | 0:eafc3fd41f75 | 168 | for test in tests: |
bryantaylor | 0:eafc3fd41f75 | 169 | for tc_result_list in self.testsResults: |
bryantaylor | 0:eafc3fd41f75 | 170 | if tc_result_list[1] == target and tc_result_list[2] == toolchain and tc_result_list[3] == test: |
bryantaylor | 0:eafc3fd41f75 | 171 | status = tc_result_list[4] |
bryantaylor | 0:eafc3fd41f75 | 172 | bgcolor = STATUS_COLORS[status] |
bryantaylor | 0:eafc3fd41f75 | 173 | result += "<td align='center' bgcolor='" + bgcolor + "'>" + status + "</td>" |
bryantaylor | 0:eafc3fd41f75 | 174 | break; |
bryantaylor | 0:eafc3fd41f75 | 175 | else: |
bryantaylor | 0:eafc3fd41f75 | 176 | result += "<td bgcolor='" + COLOR_NEUTRAL + "'></td>" |
bryantaylor | 0:eafc3fd41f75 | 177 | result += "</tr>" |
bryantaylor | 0:eafc3fd41f75 | 178 | result += "</table>" |
bryantaylor | 0:eafc3fd41f75 | 179 | return result |
bryantaylor | 0:eafc3fd41f75 | 180 | |
bryantaylor | 0:eafc3fd41f75 | 181 | def createTestsSummary (self): |
bryantaylor | 0:eafc3fd41f75 | 182 | targets = self.find_unique_tc_result_value(1) |
bryantaylor | 0:eafc3fd41f75 | 183 | toolchains = self.find_unique_tc_result_value(2) |
bryantaylor | 0:eafc3fd41f75 | 184 | tests = self.find_unique_tc_result_value(3) |
bryantaylor | 0:eafc3fd41f75 | 185 | html_result = "" |
bryantaylor | 0:eafc3fd41f75 | 186 | for toolchain in toolchains: |
bryantaylor | 0:eafc3fd41f75 | 187 | html_result += self.html_view_test_result(targets, tests, toolchain) |
bryantaylor | 0:eafc3fd41f75 | 188 | html_result += "<br>" |
bryantaylor | 0:eafc3fd41f75 | 189 | return html_result |
bryantaylor | 0:eafc3fd41f75 | 190 | |
bryantaylor | 0:eafc3fd41f75 | 191 | |
bryantaylor | 0:eafc3fd41f75 | 192 | class UnitTestsObserver(LogLineObserver): |
bryantaylor | 0:eafc3fd41f75 | 193 | reGroupTestResult = [] |
bryantaylor | 0:eafc3fd41f75 | 194 | reGroupPyResult = [] |
bryantaylor | 0:eafc3fd41f75 | 195 | |
bryantaylor | 0:eafc3fd41f75 | 196 | def __init__(self): |
bryantaylor | 0:eafc3fd41f75 | 197 | LogLineObserver.__init__(self) |
bryantaylor | 0:eafc3fd41f75 | 198 | if len(self.reGroupTestResult) == 0: |
bryantaylor | 0:eafc3fd41f75 | 199 | self.reGroupTestResult.append(re.compile("^(\w+Test)::(\w+)::(\w+)::(\w+)::.* \[(\w+)\] in (\d+\.\d+) of (\d+) sec[\r\n]*$")) |
bryantaylor | 0:eafc3fd41f75 | 200 | |
bryantaylor | 0:eafc3fd41f75 | 201 | def outLineReceived(self, line): |
bryantaylor | 0:eafc3fd41f75 | 202 | matched = False |
bryantaylor | 0:eafc3fd41f75 | 203 | for r in self.reGroupTestResult: |
bryantaylor | 0:eafc3fd41f75 | 204 | result = r.match(line) |
bryantaylor | 0:eafc3fd41f75 | 205 | if result: |
bryantaylor | 0:eafc3fd41f75 | 206 | self.step.testsResults.append(result.groups()) |
bryantaylor | 0:eafc3fd41f75 | 207 | if result.group(5) == 'OK': |
bryantaylor | 0:eafc3fd41f75 | 208 | self.step.passedTestsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 209 | elif result.group(5) == 'FAIL': |
bryantaylor | 0:eafc3fd41f75 | 210 | self.step.failedTestsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 211 | elif result.group(5) == 'UNDEF': |
bryantaylor | 0:eafc3fd41f75 | 212 | self.step.undefsTestsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 213 | elif result.group(5) == 'ERROR': |
bryantaylor | 0:eafc3fd41f75 | 214 | self.step.errorsTestsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 215 | matched = True |
bryantaylor | 0:eafc3fd41f75 | 216 | |
bryantaylor | 0:eafc3fd41f75 | 217 | |
bryantaylor | 0:eafc3fd41f75 | 218 | class BuildCommand(ShellCommand): |
bryantaylor | 0:eafc3fd41f75 | 219 | warningsCount = 0 # [Warning] |
bryantaylor | 0:eafc3fd41f75 | 220 | errorsCount = 0 # [Error] |
bryantaylor | 0:eafc3fd41f75 | 221 | testsResults = [] |
bryantaylor | 0:eafc3fd41f75 | 222 | |
bryantaylor | 0:eafc3fd41f75 | 223 | def __init__(self, stage=None,module=None, moduleset=None, **kwargs): |
bryantaylor | 0:eafc3fd41f75 | 224 | ShellCommand.__init__(self, **kwargs) |
bryantaylor | 0:eafc3fd41f75 | 225 | self.warningsCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 226 | self.errorsCount = 0 |
bryantaylor | 0:eafc3fd41f75 | 227 | self.testsResults = [] |
bryantaylor | 0:eafc3fd41f75 | 228 | buildProcessObserver = BuildObserver () |
bryantaylor | 0:eafc3fd41f75 | 229 | self.addLogObserver('stdio', buildProcessObserver) |
bryantaylor | 0:eafc3fd41f75 | 230 | |
bryantaylor | 0:eafc3fd41f75 | 231 | def createSummary(self, log): |
bryantaylor | 0:eafc3fd41f75 | 232 | if self.warningsCount >= 0 or self.errorsCount >= 0: |
bryantaylor | 0:eafc3fd41f75 | 233 | self.addHTMLLog ('tests summary', self.createTestsSummary()) |
bryantaylor | 0:eafc3fd41f75 | 234 | |
bryantaylor | 0:eafc3fd41f75 | 235 | def getText(self, cmd, results): |
bryantaylor | 0:eafc3fd41f75 | 236 | text = ShellCommand.getText(self, cmd, results) |
bryantaylor | 0:eafc3fd41f75 | 237 | if self.warningsCount > 0 or self.errorsCount > 0: |
bryantaylor | 0:eafc3fd41f75 | 238 | text.append("warnings: " + str(self.warningsCount)) |
bryantaylor | 0:eafc3fd41f75 | 239 | text.append("errors: " + str(self.errorsCount)) |
bryantaylor | 0:eafc3fd41f75 | 240 | return text |
bryantaylor | 0:eafc3fd41f75 | 241 | |
bryantaylor | 0:eafc3fd41f75 | 242 | def evaluateCommand(self, cmd): |
bryantaylor | 0:eafc3fd41f75 | 243 | if self.warningsCount > 0: |
bryantaylor | 0:eafc3fd41f75 | 244 | return buildbot.status.results.WARNINGS |
bryantaylor | 0:eafc3fd41f75 | 245 | elif self.errorsCount > 0: |
bryantaylor | 0:eafc3fd41f75 | 246 | return buildbot.status.results.FAILURE |
bryantaylor | 0:eafc3fd41f75 | 247 | else: |
bryantaylor | 0:eafc3fd41f75 | 248 | return buildbot.status.results.SUCCESS |
bryantaylor | 0:eafc3fd41f75 | 249 | |
bryantaylor | 0:eafc3fd41f75 | 250 | def createTestsSummary (self): |
bryantaylor | 0:eafc3fd41f75 | 251 | # Create a string with your html report and return it |
bryantaylor | 0:eafc3fd41f75 | 252 | html = "<h4>Report</h4><table>" |
bryantaylor | 0:eafc3fd41f75 | 253 | #for result in self.testsResults: |
bryantaylor | 0:eafc3fd41f75 | 254 | html += "</table>" |
bryantaylor | 0:eafc3fd41f75 | 255 | return html |
bryantaylor | 0:eafc3fd41f75 | 256 | |
bryantaylor | 0:eafc3fd41f75 | 257 | class BuildObserver(LogLineObserver): |
bryantaylor | 0:eafc3fd41f75 | 258 | regroupresult = [] |
bryantaylor | 0:eafc3fd41f75 | 259 | |
bryantaylor | 0:eafc3fd41f75 | 260 | def __init__(self): |
bryantaylor | 0:eafc3fd41f75 | 261 | LogLineObserver.__init__(self) |
bryantaylor | 0:eafc3fd41f75 | 262 | if len(self.regroupresult) == 0: |
bryantaylor | 0:eafc3fd41f75 | 263 | self.regroupresult.append(re.compile("^\[([Ww]arning)\] (.*)")) |
bryantaylor | 0:eafc3fd41f75 | 264 | self.regroupresult.append(re.compile("^\[([Ee]rror)\] (.*)")) |
bryantaylor | 0:eafc3fd41f75 | 265 | |
bryantaylor | 0:eafc3fd41f75 | 266 | def outLineReceived(self, line): |
bryantaylor | 0:eafc3fd41f75 | 267 | matched = False |
bryantaylor | 0:eafc3fd41f75 | 268 | for r in self.regroupresult: |
bryantaylor | 0:eafc3fd41f75 | 269 | result = r.match(line) |
bryantaylor | 0:eafc3fd41f75 | 270 | if result: |
bryantaylor | 0:eafc3fd41f75 | 271 | self.step.testsResults.append(result.groups()) |
bryantaylor | 0:eafc3fd41f75 | 272 | if result.group(1) == 'Warning': |
bryantaylor | 0:eafc3fd41f75 | 273 | self.step.warningsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 274 | elif result.group(1) == 'Error': |
bryantaylor | 0:eafc3fd41f75 | 275 | self.step.errorsCount += 1 |
bryantaylor | 0:eafc3fd41f75 | 276 | matched = True |
bryantaylor | 0:eafc3fd41f75 | 277 | #if not matched: |
bryantaylor | 0:eafc3fd41f75 | 278 | # [Future-Dev] Other check... |
bryantaylor | 0:eafc3fd41f75 | 279 | |
bryantaylor | 0:eafc3fd41f75 | 280 | |
bryantaylor | 0:eafc3fd41f75 | 281 | ####### BUILDERS - mbed project |
bryantaylor | 0:eafc3fd41f75 | 282 | git_clone = Git(repourl='https://github.com/mbedmicro/mbed.git', mode='incremental') |
bryantaylor | 0:eafc3fd41f75 | 283 | |
bryantaylor | 0:eafc3fd41f75 | 284 | # create the build factory for mbed and add the steps to it |
bryantaylor | 0:eafc3fd41f75 | 285 | from buildbot.config import BuilderConfig |
bryantaylor | 0:eafc3fd41f75 | 286 | |
bryantaylor | 0:eafc3fd41f75 | 287 | c['builders'] = [] |
bryantaylor | 0:eafc3fd41f75 | 288 | |
bryantaylor | 0:eafc3fd41f75 | 289 | copy_mbed_settings = ShellCommand(name = "copy mbed_settings.py", |
bryantaylor | 0:eafc3fd41f75 | 290 | command = "cp ../mbed_settings.py mbed_settings.py", |
bryantaylor | 0:eafc3fd41f75 | 291 | haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 292 | description = "Copy mbed_settings.py") |
bryantaylor | 0:eafc3fd41f75 | 293 | |
bryantaylor | 0:eafc3fd41f75 | 294 | mbed_build_release = BuildFactory() |
bryantaylor | 0:eafc3fd41f75 | 295 | mbed_build_release.addStep(git_clone) |
bryantaylor | 0:eafc3fd41f75 | 296 | mbed_build_release.addStep(copy_mbed_settings) |
bryantaylor | 0:eafc3fd41f75 | 297 | |
bryantaylor | 0:eafc3fd41f75 | 298 | for target_name, toolchains in OFFICIAL_MBED_LIBRARY_BUILD: |
bryantaylor | 0:eafc3fd41f75 | 299 | builder_name = "All_TC_%s" % target_name |
bryantaylor | 0:eafc3fd41f75 | 300 | mbed_build = BuildFactory() |
bryantaylor | 0:eafc3fd41f75 | 301 | mbed_build.addStep(git_clone) |
bryantaylor | 0:eafc3fd41f75 | 302 | mbed_build.addStep(copy_mbed_settings) |
bryantaylor | 0:eafc3fd41f75 | 303 | # Adding all chains for target |
bryantaylor | 0:eafc3fd41f75 | 304 | for toolchain in toolchains: |
bryantaylor | 0:eafc3fd41f75 | 305 | build_py = BuildCommand(name = "Build %s using %s" % (target_name, toolchain), |
bryantaylor | 0:eafc3fd41f75 | 306 | command = "python tools/build.py -m %s -t %s" % (target_name, toolchain), |
bryantaylor | 0:eafc3fd41f75 | 307 | haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 308 | warnOnWarnings = True, |
bryantaylor | 0:eafc3fd41f75 | 309 | description = "Building %s using %s" % (target_name, toolchain), |
bryantaylor | 0:eafc3fd41f75 | 310 | descriptionDone = "Built %s using %s" % (target_name, toolchain)) |
bryantaylor | 0:eafc3fd41f75 | 311 | |
bryantaylor | 0:eafc3fd41f75 | 312 | mbed_build.addStep(build_py) |
bryantaylor | 0:eafc3fd41f75 | 313 | mbed_build_release.addStep(build_py) # For build release we need all toolchains |
bryantaylor | 0:eafc3fd41f75 | 314 | |
bryantaylor | 0:eafc3fd41f75 | 315 | if target_name in OFFICIAL_MBED_TESTBED_SUPPORTED_HARDWARE: |
bryantaylor | 0:eafc3fd41f75 | 316 | copy_example_test_spec_json = ShellCommand(name = "Copy example_test_spec.json", |
bryantaylor | 0:eafc3fd41f75 | 317 | command = "cp ../example_test_spec.json tools/data/example_test_spec.json", |
bryantaylor | 0:eafc3fd41f75 | 318 | haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 319 | description = "Copy example_test_spec.json") |
bryantaylor | 0:eafc3fd41f75 | 320 | |
bryantaylor | 0:eafc3fd41f75 | 321 | autotest_py = ShellCommand(name = "Running autotest.py for %s" % (target_name), |
bryantaylor | 0:eafc3fd41f75 | 322 | command = "python tools/autotest.py tools/data/example_test_spec.json", |
bryantaylor | 0:eafc3fd41f75 | 323 | haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 324 | description = "Running autotest.py") |
bryantaylor | 0:eafc3fd41f75 | 325 | |
bryantaylor | 0:eafc3fd41f75 | 326 | mbed_build.addStep(copy_example_test_spec_json) |
bryantaylor | 0:eafc3fd41f75 | 327 | mbed_build.addStep(autotest_py) |
bryantaylor | 0:eafc3fd41f75 | 328 | |
bryantaylor | 0:eafc3fd41f75 | 329 | # Add builder with steps for each toolchain |
bryantaylor | 0:eafc3fd41f75 | 330 | c['builders'].append(BuilderConfig(name=builder_name, |
bryantaylor | 0:eafc3fd41f75 | 331 | slavenames=["example-slave-%s" % (target_name)], |
bryantaylor | 0:eafc3fd41f75 | 332 | factory=mbed_build)) |
bryantaylor | 0:eafc3fd41f75 | 333 | else: |
bryantaylor | 0:eafc3fd41f75 | 334 | # Add builder with steps for each toolchain |
bryantaylor | 0:eafc3fd41f75 | 335 | c['builders'].append(BuilderConfig(name=builder_name, |
bryantaylor | 0:eafc3fd41f75 | 336 | slavenames=["example-slave"], |
bryantaylor | 0:eafc3fd41f75 | 337 | factory=mbed_build)) |
bryantaylor | 0:eafc3fd41f75 | 338 | |
bryantaylor | 0:eafc3fd41f75 | 339 | # copy_example_test_spec_json = ShellCommand(name = "Copy example_test_spec.json", |
bryantaylor | 0:eafc3fd41f75 | 340 | # command = "cp ../example_test_spec.json tools/data/example_test_spec.json", |
bryantaylor | 0:eafc3fd41f75 | 341 | # haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 342 | # description = "Copy example_test_spec.json") |
bryantaylor | 0:eafc3fd41f75 | 343 | |
bryantaylor | 0:eafc3fd41f75 | 344 | singletest_py = TestCommand(name = "Running Target Tests", |
bryantaylor | 0:eafc3fd41f75 | 345 | command = "python tools/singletest.py -i tools/test_spec.json -M tools/muts_all.json", |
bryantaylor | 0:eafc3fd41f75 | 346 | haltOnFailure = True, |
bryantaylor | 0:eafc3fd41f75 | 347 | warnOnWarnings = True, |
bryantaylor | 0:eafc3fd41f75 | 348 | description = "Running Target Tests", |
bryantaylor | 0:eafc3fd41f75 | 349 | descriptionDone = "Target Testing Finished") |
bryantaylor | 0:eafc3fd41f75 | 350 | |
bryantaylor | 0:eafc3fd41f75 | 351 | mbed_build_release.addStep(singletest_py) |
bryantaylor | 0:eafc3fd41f75 | 352 | # Release build collects all building toolchains |
bryantaylor | 0:eafc3fd41f75 | 353 | c['builders'].append(BuilderConfig(name=release_builder_name, |
bryantaylor | 0:eafc3fd41f75 | 354 | slavenames=["example-slave"], |
bryantaylor | 0:eafc3fd41f75 | 355 | factory=mbed_build_release)) |
bryantaylor | 0:eafc3fd41f75 | 356 | |
bryantaylor | 0:eafc3fd41f75 | 357 | ####### STATUS TARGETS |
bryantaylor | 0:eafc3fd41f75 | 358 | |
bryantaylor | 0:eafc3fd41f75 | 359 | # 'status' is a list of Status Targets. The results of each build will be |
bryantaylor | 0:eafc3fd41f75 | 360 | # pushed to these targets. buildbot/status/*.py has a variety to choose from, |
bryantaylor | 0:eafc3fd41f75 | 361 | # including web pages, email senders, and IRC bots. |
bryantaylor | 0:eafc3fd41f75 | 362 | |
bryantaylor | 0:eafc3fd41f75 | 363 | c['status'] = [] |
bryantaylor | 0:eafc3fd41f75 | 364 | |
bryantaylor | 0:eafc3fd41f75 | 365 | from buildbot.status import html |
bryantaylor | 0:eafc3fd41f75 | 366 | from buildbot.status.web import authz, auth |
bryantaylor | 0:eafc3fd41f75 | 367 | |
bryantaylor | 0:eafc3fd41f75 | 368 | authz_cfg=authz.Authz( |
bryantaylor | 0:eafc3fd41f75 | 369 | # change any of these to True to enable; see the manual for more |
bryantaylor | 0:eafc3fd41f75 | 370 | # options |
bryantaylor | 0:eafc3fd41f75 | 371 | auth=auth.BasicAuth([("pyflakes","pyflakes")]), |
bryantaylor | 0:eafc3fd41f75 | 372 | gracefulShutdown = False, |
bryantaylor | 0:eafc3fd41f75 | 373 | forceBuild = 'auth', # use this to test your slave once it is set up |
bryantaylor | 0:eafc3fd41f75 | 374 | forceAllBuilds = True, |
bryantaylor | 0:eafc3fd41f75 | 375 | pingBuilder = True, |
bryantaylor | 0:eafc3fd41f75 | 376 | stopBuild = True, |
bryantaylor | 0:eafc3fd41f75 | 377 | stopAllBuilds = True, |
bryantaylor | 0:eafc3fd41f75 | 378 | cancelPendingBuild = True, |
bryantaylor | 0:eafc3fd41f75 | 379 | ) |
bryantaylor | 0:eafc3fd41f75 | 380 | c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg, order_console_by_time=True)) |
bryantaylor | 0:eafc3fd41f75 | 381 | |
bryantaylor | 0:eafc3fd41f75 | 382 | ####### PROJECT IDENTITY |
bryantaylor | 0:eafc3fd41f75 | 383 | |
bryantaylor | 0:eafc3fd41f75 | 384 | # the 'title' string will appear at the top of this buildbot |
bryantaylor | 0:eafc3fd41f75 | 385 | # installation's html.WebStatus home page (linked to the |
bryantaylor | 0:eafc3fd41f75 | 386 | # 'titleURL') and is embedded in the title of the waterfall HTML page. |
bryantaylor | 0:eafc3fd41f75 | 387 | |
bryantaylor | 0:eafc3fd41f75 | 388 | c['title'] = "Green Tea" |
bryantaylor | 0:eafc3fd41f75 | 389 | c['titleURL'] = "" |
bryantaylor | 0:eafc3fd41f75 | 390 | |
bryantaylor | 0:eafc3fd41f75 | 391 | # the 'buildbotURL' string should point to the location where the buildbot's |
bryantaylor | 0:eafc3fd41f75 | 392 | # internal web server (usually the html.WebStatus page) is visible. This |
bryantaylor | 0:eafc3fd41f75 | 393 | # typically uses the port number set in the Waterfall 'status' entry, but |
bryantaylor | 0:eafc3fd41f75 | 394 | # with an externally-visible host name which the buildbot cannot figure out |
bryantaylor | 0:eafc3fd41f75 | 395 | # without some help. |
bryantaylor | 0:eafc3fd41f75 | 396 | |
bryantaylor | 0:eafc3fd41f75 | 397 | c['buildbotURL'] = "http://localhost:8010/" |
bryantaylor | 0:eafc3fd41f75 | 398 | |
bryantaylor | 0:eafc3fd41f75 | 399 | ####### DB URL |
bryantaylor | 0:eafc3fd41f75 | 400 | |
bryantaylor | 0:eafc3fd41f75 | 401 | c['db'] = { |
bryantaylor | 0:eafc3fd41f75 | 402 | # This specifies what database buildbot uses to store its state. You can leave |
bryantaylor | 0:eafc3fd41f75 | 403 | # this at its default for all but the largest installations. |
bryantaylor | 0:eafc3fd41f75 | 404 | 'db_url' : "sqlite:///state.sqlite", |
bryantaylor | 0:eafc3fd41f75 | 405 | # 'db_url' : "mysql://buildbot:123456@localhost/buildbot_mbed?max_idle=300", |
bryantaylor | 0:eafc3fd41f75 | 406 | } |