<div dir="ltr">On Fri, Feb 1, 2013 at 8:20 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Jan 31, 2013 at 5:44 PM, Daniel Dunbar <<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>> wrote:<br>
> Author: ddunbar<br>
> Date: Thu Jan 31 19:44:23 2013<br>
> New Revision: 174139<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=174139&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=174139&view=rev</a><br>
> Log:<br>
> LitTestCommand: Add back support for max_logs argument.<br>
><br>
> Modified:<br>
> zorg/trunk/zorg/buildbot/commands/LitTestCommand.py<br>
><br>
> Modified: zorg/trunk/zorg/buildbot/commands/LitTestCommand.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/LitTestCommand.py?rev=174139&r1=174138&r2=174139&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/LitTestCommand.py?rev=174139&r1=174138&r2=174139&view=diff</a><br>
> ==============================================================================<br>
> --- zorg/trunk/zorg/buildbot/commands/LitTestCommand.py (original)<br>
> +++ zorg/trunk/zorg/buildbot/commands/LitTestCommand.py Thu Jan 31 19:44:23 2013<br>
> @@ -20,9 +20,11 @@ class LitLogObserver(LogLineObserver):<br>
> # step results.<br>
> failingCodes = set(['FAIL', 'XPASS', 'KPASS', 'UNRESOLVED'])<br>
><br>
> - def __init__(self):<br>
> + def __init__(self, maxLogs=None):<br>
> LogLineObserver.__init__(self)<br>
> self.resultCounts = {}<br>
> + self.maxLogs = maxLogs<br>
> + self.numLogs = 0<br>
<br>
</div>What's the particular motivation for this feature?</blockquote><div><br></div><div style>This is mainly just to protect the buildbot and web UI. In cases where there is a catastrophic failure of some kind, we don't want buildbot to be showing 13k tests and logs in the web UI.</div>
<div style><br></div><div style>The primary goal of the extracted logs is to make it easy for users to jump examine a specific failure. This is substantially less useful as more test failures are present so it makes sense to cap it at some point.</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Lit does the same<br>
thing - logging every failure & it's not terribly usable there, it<br>
seems much more usable in a web UI where you can scroll around a list,<br>
click on the failures, etc. If it's really a problem, shouldn't we<br>
just fix lit to do this instead?<br></blockquote><div><br></div><div style>I don't think it is a problem in the lit console based context.</div><div style><br></div><div style>Again, please don't just drop support for a feature without understanding why it was there.</div>
<div style><br></div><div style> - Daniel</div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
><br>
> # If non-null, a tuple of the last test code and name.<br>
> self.lastTestResult = None<br>
> @@ -48,8 +50,10 @@ class LitLogObserver(LogLineObserver):<br>
> # We have finished getting information for one test, handle it.<br>
> code, name = self.lastTestResult<br>
><br>
> - # If the test failed, add a log entry for it.<br>
> - if code in self.failingCodes:<br>
> + # If the test failed, add a log entry for it (unless we have reached the<br>
> + # max).<br>
> + if code in self.failingCodes and (self.maxLogs is None or<br>
> + self.numLogs < self.maxLogs):<br>
> # If a verbose log was not provided, just add a one line description.<br>
> if self.activeVerboseLog is None:<br>
> self.activeVerboseLog = ['%s: %s' % (code, name)]<br>
> @@ -57,6 +61,7 @@ class LitLogObserver(LogLineObserver):<br>
> # Add the log to the build status.<br>
> self.step.addCompleteLog(name.replace('/', '__'),<br>
> '\n'.join(self.activeVerboseLog))<br>
> + self.numLogs += 1<br>
><br>
> # Reset the current state.<br>
> self.lastTestResult = None<br>
> @@ -112,7 +117,9 @@ class LitTestCommand(Test):<br>
> def __init__(self, ignore=[], flaky=[], max_logs=20,<br>
> *args, **kwargs):<br>
> Test.__init__(self, *args, **kwargs)<br>
> - self.logObserver = LitLogObserver()<br>
> + self.maxLogs = int(max_logs)<br>
> + self.logObserver = LitLogObserver(self.maxLogs)<br>
> + self.addFactoryArguments(max_logs=max_logs)<br>
> self.addLogObserver('stdio', self.logObserver)<br>
><br>
> def evaluateCommand(self, cmd):<br>
> @@ -182,8 +189,8 @@ FAIL: test-three (3 of 3)<br>
> ('test-three', 'FAIL: test-three')])<br>
><br>
> class TestCommand(unittest.TestCase):<br>
> - def parse_log(self, text):<br>
> - cmd = LitTestCommand()<br>
> + def parse_log(self, text, **kwargs):<br>
> + cmd = LitTestCommand(**kwargs)<br>
> cmd.logObserver.step = StepProxy()<br>
> for ln in text.split('\n'):<br>
> cmd.logObserver.outLineReceived(ln)<br>
> @@ -200,5 +207,12 @@ class TestCommand(unittest.TestCase):<br>
> cmd = self.parse_log("""%s: test-one (1 of 1)""" % (failing_code,))<br>
> self.assertEqual(cmd.evaluateCommand(RemoteCommandProxy(0)), FAILURE)<br>
><br>
> + def test_max_logs(self):<br>
> + cmd = self.parse_log("""<br>
> +FAIL: test-one (1 of 2)<br>
> +FAIL: test-two (2 of 2)<br>
> +""", max_logs=1)<br>
> + self.assertEqual(cmd.logObserver.step.logs, [('test-one', 'FAIL: test-one')])<br>
> +<br>
> if __name__ == '__main__':<br>
> unittest.main()<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>