Mercurial > octave-buildbot
comparison master.cfg @ 1:97e7b7963dc9
make test log filtering work again
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 12 Jun 2018 21:14:47 +0000 |
parents | 4ad92f00bca5 |
children | f77e7e92cc95 |
comparison
equal
deleted
inserted
replaced
0:4ad92f00bca5 | 1:97e7b7963dc9 |
---|---|
255 make_cmd = build_cmd_list (["make", "V=1"], nice = nice, opts = opts) | 255 make_cmd = build_cmd_list (["make", "V=1"], nice = nice, opts = opts) |
256 return Compile (command = make_cmd, workdir = "build", env = build_env, | 256 return Compile (command = make_cmd, workdir = "build", env = build_env, |
257 warningPattern = ":[0-9][0-9]*:[0-9][0-9]*:warning: ") | 257 warningPattern = ":[0-9][0-9]*:[0-9][0-9]*:warning: ") |
258 | 258 |
259 import re | 259 import re |
260 from buildbot.process import logobserver | |
260 from buildbot.process.results import SUCCESS | 261 from buildbot.process.results import SUCCESS |
261 from buildbot.process.results import FAILURE | 262 from buildbot.process.results import FAILURE |
262 from buildbot.process.results import WARNINGS | 263 from buildbot.process.results import WARNINGS |
263 | 264 |
265 class octave_test_observer (logobserver.LogLineObserver): | |
266 | |
267 def __init__ (self, warningPattern): | |
268 logobserver.LogLineObserver.__init__ (self) | |
269 if warningPattern: | |
270 self.warningPattern = re.compile (warningPattern) | |
271 else: | |
272 self.warningPattern = None | |
273 self.rc = SUCCESS | |
274 self.total = 0 | |
275 self.failed = 0 | |
276 self.warnings = 0 | |
277 self.complete = False | |
278 | |
279 testsRe = re.compile (r"^ (PASS|FAIL|REGRESSION|XFAIL|SKIP).*(\d+)") | |
280 | |
281 def outLineReceived (self, line): | |
282 if self.warningPattern.match (line): | |
283 self.warnings += 1 | |
284 mo = self.testsRe.search (line) | |
285 if mo: | |
286 type = mo.group(1) | |
287 count = int (mo.group(2)) | |
288 self.total += num | |
289 if type == "FAIL" or type == "REGRESSION": | |
290 if count > 0: | |
291 self.rc = FAILURE | |
292 self.failed += count | |
293 | |
294 | |
264 class octave_test (Test): | 295 class octave_test (Test): |
265 | 296 |
297 def __init__ (self, *args, **kwargs): | |
298 Test.__init__ (self, *args, **kwargs) | |
299 self.observer = octave_test_observer (warningPattern = self.warningPattern) | |
300 self.addLogObserver ('stdio', self.observer) | |
301 | |
266 def evaluateCommand (self, cmd): | 302 def evaluateCommand (self, cmd): |
267 rc = SUCCESS | 303 if self.observer.total: |
268 if cmd.didFail (): | 304 passed = self.observer.total - self.observer.failed |
269 rc = FAILURE | 305 |
270 | 306 self.setTestResults (total = self.observer.total, |
271 ## FIXME: return WARNINGS if there are skipped tests? | 307 failed = self.observer.failed, |
272 ## FIXME: should probably search for the "^Summary:$" line just | 308 passed = passed, |
273 ## before the PASS/FAIL totals. | 309 warnings = self.observer.warnings) |
274 | 310 |
275 logtext = "".join(self.getLog('stdio').readlines()) | 311 rc = self.observer.rc |
276 | 312 if rc == SUCCESS and self.observer.warnings: |
277 m = re.search (r"^ *FAIL +([0-9]+) *$", logtext, | 313 rc = WARNINGS |
278 flags = re.MULTILINE) | |
279 | |
280 ## There should always be a line with FAIL, so m should always be a | |
281 ## valid match object. But if it is not, then that is also a | |
282 ## failure because there must be something wrong with the log file. | |
283 if not m or int (m.group (1)) != 0: | |
284 rc = FAILURE | |
285 else: | |
286 m = re.search (r"^ *REGRESSION +([0-9]+) *$", logtext, | |
287 flags = re.MULTILINE) | |
288 ## If REGRESSION does not appear in the output, then there were none. | |
289 ## If it is present, then there should be some regressions, but we'll | |
290 ## check anyway. | |
291 if m and int (m.group (1)) != 0: | |
292 rc = FAILURE | |
293 | |
294 return rc | 314 return rc |
315 | |
295 | 316 |
296 def mk_octave_test_step (nice = 0, xvfb = True): | 317 def mk_octave_test_step (nice = 0, xvfb = True): |
297 if xvfb: | 318 if xvfb: |
298 cmd = ["xvfb-run", "-a", "-s", "-screen 0 640x480x24"] | 319 cmd = ["xvfb-run", "-a", "-s", "-screen 0 640x480x24"] |
299 else: | 320 else: |
300 cmd = [] | 321 cmd = [] |
301 cmd.extend (["make", "V=1", "check"]) | 322 cmd.extend (["make", "V=1", "check"]) |
302 test_cmd = build_cmd_list (cmd, nice = nice) | 323 test_cmd = build_cmd_list (cmd, nice = nice) |
303 return octave_test (command = test_cmd, workdir = "build", env = build_env) | 324 return octave_test (command = test_cmd, workdir = "build", env = build_env) |
304 | 325 |
326 | |
305 def mk_octave_factory (nice, configure_opts, compile_opts, branch, xvfb = True): | 327 def mk_octave_factory (nice, configure_opts, compile_opts, branch, xvfb = True): |
306 factory = BuildFactory () | 328 factory = BuildFactory () |
307 | 329 |
308 factory.addStep (mk_octave_hg_update_step (octave_hg_repo, branch)) | 330 factory.addStep (mk_octave_hg_update_step (octave_hg_repo, branch)) |
309 factory.addStep (mk_octave_bootstrap_step (nice = nice)) | 331 factory.addStep (mk_octave_bootstrap_step (nice = nice)) |
312 factory.addStep (mk_octave_configure_step (nice = nice, opts = configure_opts)) | 334 factory.addStep (mk_octave_configure_step (nice = nice, opts = configure_opts)) |
313 factory.addStep (mk_octave_compile_step (nice = nice, opts = compile_opts)) | 335 factory.addStep (mk_octave_compile_step (nice = nice, opts = compile_opts)) |
314 factory.addStep (mk_octave_test_step (nice = nice, xvfb = xvfb)) | 336 factory.addStep (mk_octave_test_step (nice = nice, xvfb = xvfb)) |
315 | 337 |
316 return factory | 338 return factory |
339 | |
317 | 340 |
318 def mk_gcc_factory (nice, compile_opts, branch): | 341 def mk_gcc_factory (nice, compile_opts, branch): |
319 return mk_octave_factory (nice, [], compile_opts, branch) | 342 return mk_octave_factory (nice, [], compile_opts, branch) |
320 | 343 |
321 | 344 |