diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-10-05 12:39:30 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-10-05 23:56:10 +0200 |
commit | 47d1c496084fd0974e20bc6c0694456f71391f8a (patch) | |
tree | 67e5d40ff428eacf7105d2219d908443dd284eb1 /script | |
parent | 95c6c9b69bcc7bed3a733a355dfa502b7aebd92b (diff) | |
download | samba-47d1c496084fd0974e20bc6c0694456f71391f8a.tar.gz samba-47d1c496084fd0974e20bc6c0694456f71391f8a.tar.bz2 samba-47d1c496084fd0974e20bc6c0694456f71391f8a.zip |
land: Print out failed test in case of subunit failures.
Diffstat (limited to 'script')
-rwxr-xr-x | script/land.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/script/land.py b/script/land.py index e04cd3a877..a92fa44f64 100755 --- a/script/land.py +++ b/script/land.py @@ -147,7 +147,7 @@ class TreeStageBuilder(object): @property def failure_reason(self): - return "failed '%s' with exit code %d" % (self.command, self.exitcode) + raise NotImplementedError(self.failure_reason) @property def failed(self): @@ -162,6 +162,10 @@ class PlainTreeStageBuilder(TreeStageBuilder): stdout=self.tree.stdout, stderr=self.tree.stderr, stdin=self.stdin) + @property + def failure_reason(self): + return "failed '%s' with exit code %d" % (self.command, self.exitcode) + class AbortingTestResult(subunithelper.TestsuiteEnabledTestResult): @@ -176,12 +180,27 @@ class AbortingTestResult(subunithelper.TestsuiteEnabledTestResult): self.stage.proc.terminate() +class FailureTrackingTestResult(subunithelper.TestsuiteEnabledTestResult): + + def __init__(self, stage): + super(AbortingTestResult, self).__init__() + self.stage = stage + + def addError(self, test, details=None): + if self.stage.failed_test is None: + self.stage.failed_test = ("error", test) + + def addFailure(self, test, details=None): + if self.stage.failed_test is None: + self.stage.failed_test = ("failure", test) + + class SubunitTreeStageBuilder(TreeStageBuilder): def __init__(self, tree, name, command, fail_quickly=False): super(SubunitTreeStageBuilder, self).__init__(tree, name, command, fail_quickly) - self.failed_tests = [] + self.failed_test = None self.subunit_path = os.path.join(gitroot, "%s.%s.subunit" % (self.tree.tag, self.name)) self.tree.logfiles.append( @@ -190,7 +209,8 @@ class SubunitTreeStageBuilder(TreeStageBuilder): self.subunit = open(self.subunit_path, 'w') formatter = subunithelper.PlainFormatter(False, True, {}) - clients = [formatter, subunit.TestProtocolClient(self.subunit)] + clients = [formatter, subunit.TestProtocolClient(self.subunit), + FailureTrackingTestResult(self)] if fail_quickly: clients.append(AbortingTestResult(self)) self.subunit_server = subunit.TestProtocolServer( @@ -225,6 +245,13 @@ class SubunitTreeStageBuilder(TreeStageBuilder): self.subunit.close() return self.exitcode + @property + def failure_reason(self): + if self.failed_test: + return "failed '%s' with %s in test %s" (self.command, self.failed_test[0], self.failed_test[1]) + else: + return "failed '%s' with exit code %d in unknown test" % (self.command, self.exitcode) + class TreeBuilder(object): '''handle build of one directory''' |