Changeset 90650 in webkit


Ignore:
Timestamp:
Jul 8, 2011 12:05:17 PM (13 years ago)
Author:
Adam Roben
Message:

Teach buildbot to figure out how many webkitpy/webkitperl tests failed

Fixes <http://webkit.org/b/64192> It's hard to tell how many test-webkitpy/test-webkitperl
tests failed when looking at build.webkit.org

Reviewed by Eric Seidel.

  • BuildSlaveSupport/build.webkit.org-config/master.cfg:

(TestWithFailureCount): New class that represents a test build step which has an associated
failure count. Eventually we should move more of our test classes to deriving from this.
(TestWithFailureCount.countFailures): Method for subclasses to override to say how many
failures occurred.

(TestWithFailureCount.commandComplete):
(TestWithFailureCount.evaluateCommand):
(TestWithFailureCount.getText):
(TestWithFailureCount.getText2):
These were all based on RunGtkAPITests.

(RunPythonTests): Changed to inherit from TestWithFailureCount.
(RunPythonTests.countFailures): Parses the test-webkitpy output looking for the count of
failures.
(RunPerlTests): Changed to inherit from TestWithFailureCount.
(RunPerlTests.countFailures): Parses the test-webkitperl output looking for the count of
failures.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg

    r90310 r90650  
    332332        return shell.Test.start(self)
    333333
    334 class RunPythonTests(shell.Test):
     334
     335class TestWithFailureCount(shell.Test):
     336    failedTestsFormatString = "%d tests failed"
     337
     338    def countFailures(self, cmd):
     339        return 0
     340
     341    def commandComplete(self, cmd):
     342        shell.Test.commandComplete(self, cmd)
     343        self.failedTestCount = self.countFailures(cmd)
     344
     345    def evaluateCommand(self, cmd):
     346        if self.failedTestCount:
     347            return FAILURE
     348
     349        if cmd.rc != 0:
     350            return FAILURE
     351
     352        return SUCCESS
     353
     354    def getText(self, cmd, results):
     355        return self.getText2(cmd, results)
     356
     357    def getText2(self, cmd, results):
     358        if results != SUCCESS and self.failedTestCount:
     359            return [self.failedTestsFormatString % self.failedTestCount]
     360
     361        return [self.name]
     362
     363
     364class RunPythonTests(TestWithFailureCount):
    335365    name = "webkitpy-test"
    336366    description = ["python-tests running"]
    337367    descriptionDone = ["python-tests"]
    338368    command = ["python", "./Tools/Scripts/test-webkitpy"]
    339 
    340 
    341 class RunPerlTests(shell.Test):
     369    failedTestsFormatString = "%d python tests failed"
     370
     371    def countFailures(self, cmd):
     372        logText = cmd.logs['stdio'].getText()
     373        # We're looking for the line that looks like this: FAILED (failures=2, errors=1)
     374        regex = re.compile(r'^FAILED \((?P<counts>[^)]+)\)')
     375        for line in logText.splitlines():
     376            match = regex.match(line)
     377            if not match:
     378                continue
     379            return sum(int(component.split('=')[1]) for component in match.group('counts').split(', '))
     380        return 0
     381
     382
     383class RunPerlTests(TestWithFailureCount):
    342384    name = "webkitperl-test"
    343385    description = ["perl-tests running"]
    344386    descriptionDone = ["perl-tests"]
    345387    command = ["perl", "./Tools/Scripts/test-webkitperl"]
     388    failedTestsFormatString = "%d perl tests failed"
     389
     390    def countFailures(self, cmd):
     391        logText = cmd.logs['stdio'].getText()
     392        # We're looking for the line that looks like this: Failed 2/19 test programs. 5/363 subtests failed.
     393        regex = re.compile(r'^Failed \d+/\d+ test programs\. (?P<count>\d+)/\d+ subtests failed\.')
     394        for line in logText.splitlines():
     395            match = regex.match(line)
     396            if not match:
     397                continue
     398            return int(match.group('count'))
     399        return 0
    346400
    347401
  • trunk/Tools/ChangeLog

    r90648 r90650  
     12011-07-08  Adam Roben  <aroben@apple.com>
     2
     3        Teach buildbot to figure out how many webkitpy/webkitperl tests failed
     4
     5        Fixes <http://webkit.org/b/64192> It's hard to tell how many test-webkitpy/test-webkitperl
     6        tests failed when looking at build.webkit.org
     7
     8        Reviewed by Eric Seidel.
     9
     10        * BuildSlaveSupport/build.webkit.org-config/master.cfg:
     11        (TestWithFailureCount): New class that represents a test build step which has an associated
     12        failure count. Eventually we should move more of our test classes to deriving from this.
     13        (TestWithFailureCount.countFailures): Method for subclasses to override to say how many
     14        failures occurred.
     15
     16        (TestWithFailureCount.commandComplete):
     17        (TestWithFailureCount.evaluateCommand):
     18        (TestWithFailureCount.getText):
     19        (TestWithFailureCount.getText2):
     20        These were all based on RunGtkAPITests.
     21
     22        (RunPythonTests): Changed to inherit from TestWithFailureCount.
     23        (RunPythonTests.countFailures): Parses the test-webkitpy output looking for the count of
     24        failures.
     25        (RunPerlTests): Changed to inherit from TestWithFailureCount.
     26        (RunPerlTests.countFailures): Parses the test-webkitperl output looking for the count of
     27        failures.
     28
    1292011-07-08  Adam Roben  <aroben@apple.com>
    230
Note: See TracChangeset for help on using the changeset viewer.