Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

master.cfg 16KB

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