# HG changeset patch # User John W. Eaton # Date 1528838087 0 # Node ID 97e7b7963dc9d367dffe3a1ef6ab77f7b5a78015 # Parent 4ad92f00bca5b59bce7c01df7016fca21c3e002d make test log filtering work again diff -r 4ad92f00bca5 -r 97e7b7963dc9 master.cfg --- a/master.cfg Tue Jun 05 12:38:50 2018 +0000 +++ b/master.cfg Tue Jun 12 21:14:47 2018 +0000 @@ -257,42 +257,63 @@ warningPattern = ":[0-9][0-9]*:[0-9][0-9]*:warning: ") import re +from buildbot.process import logobserver from buildbot.process.results import SUCCESS from buildbot.process.results import FAILURE from buildbot.process.results import WARNINGS +class octave_test_observer (logobserver.LogLineObserver): + + def __init__ (self, warningPattern): + logobserver.LogLineObserver.__init__ (self) + if warningPattern: + self.warningPattern = re.compile (warningPattern) + else: + self.warningPattern = None + self.rc = SUCCESS + self.total = 0 + self.failed = 0 + self.warnings = 0 + self.complete = False + + testsRe = re.compile (r"^ (PASS|FAIL|REGRESSION|XFAIL|SKIP).*(\d+)") + + def outLineReceived (self, line): + if self.warningPattern.match (line): + self.warnings += 1 + mo = self.testsRe.search (line) + if mo: + type = mo.group(1) + count = int (mo.group(2)) + self.total += num + if type == "FAIL" or type == "REGRESSION": + if count > 0: + self.rc = FAILURE + self.failed += count + + class octave_test (Test): + def __init__ (self, *args, **kwargs): + Test.__init__ (self, *args, **kwargs) + self.observer = octave_test_observer (warningPattern = self.warningPattern) + self.addLogObserver ('stdio', self.observer) + def evaluateCommand (self, cmd): - rc = SUCCESS - if cmd.didFail (): - rc = FAILURE - - ## FIXME: return WARNINGS if there are skipped tests? - ## FIXME: should probably search for the "^Summary:$" line just - ## before the PASS/FAIL totals. - - logtext = "".join(self.getLog('stdio').readlines()) - - m = re.search (r"^ *FAIL +([0-9]+) *$", logtext, - flags = re.MULTILINE) + if self.observer.total: + passed = self.observer.total - self.observer.failed - ## There should always be a line with FAIL, so m should always be a - ## valid match object. But if it is not, then that is also a - ## failure because there must be something wrong with the log file. - if not m or int (m.group (1)) != 0: - rc = FAILURE - else: - m = re.search (r"^ *REGRESSION +([0-9]+) *$", logtext, - flags = re.MULTILINE) - ## If REGRESSION does not appear in the output, then there were none. - ## If it is present, then there should be some regressions, but we'll - ## check anyway. - if m and int (m.group (1)) != 0: - rc = FAILURE + self.setTestResults (total = self.observer.total, + failed = self.observer.failed, + passed = passed, + warnings = self.observer.warnings) + rc = self.observer.rc + if rc == SUCCESS and self.observer.warnings: + rc = WARNINGS return rc + def mk_octave_test_step (nice = 0, xvfb = True): if xvfb: cmd = ["xvfb-run", "-a", "-s", "-screen 0 640x480x24"] @@ -302,6 +323,7 @@ test_cmd = build_cmd_list (cmd, nice = nice) return octave_test (command = test_cmd, workdir = "build", env = build_env) + def mk_octave_factory (nice, configure_opts, compile_opts, branch, xvfb = True): factory = BuildFactory () @@ -315,6 +337,7 @@ return factory + def mk_gcc_factory (nice, compile_opts, branch): return mk_octave_factory (nice, [], compile_opts, branch)