[Buildbot-commits] buildbot/buildbot/test test_status.py,1.11,1.12

Brian Warner warner at users.sourceforge.net
Thu Nov 11 19:31:17 UTC 2004


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/buildbot/test

Modified Files:
	test_status.py 
Log Message:
* buildbot/status/builder.py (LogFile.addEntry): Merge string
chunks together, up to 10kb per chunk. This ought to cut down on
the CPU-burning overhead of large log files. Thanks to Alexander
Staubo for spotting the problem.
* buildbot/test/test_status.py (Log): tests for same


Index: test_status.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_status.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test_status.py	11 Nov 2004 00:43:48 -0000	1.11
+++ test_status.py	11 Nov 2004 19:31:06 -0000	1.12
@@ -235,3 +235,48 @@
         self.failUnlessEqual(t.getResults(), builder.SUCCESS)
         self.failUnlessEqual(t.getText(), ["passed"])
         self.failUnlessEqual(t.getLogs(), {'output': ""})
+
+class Log(unittest.TestCase):
+    def testAdd(self):
+        l = builder.LogFile(None)
+        l.name = "compile"
+        l.step = 13
+        self.failUnlessEqual(l.getName(), "compile")
+        self.failUnlessEqual(l.getStep(), 13)
+        l.addHeader("HEADER\n")
+        l.addStdout("Some text\n")
+        l.addStderr("Some error\n")
+        l.addStdout("Some more text\n")
+        self.failUnlessEqual(l.getText(),
+                             "Some text\nSome error\nSome more text\n")
+        self.failUnlessEqual(l.getTextWithHeaders(),
+                             "HEADER\n" +
+                             "Some text\nSome error\nSome more text\n")
+        self.failUnlessEqual(len(l.getChunks()), 4)
+
+    def testMerge(self):
+        l = builder.LogFile(None)
+        l.addHeader("HEADER\n")
+        l.addStdout("Some text\n")
+        l.addStdout("Some more text\n")
+        l.addStdout("more\n")
+        self.failUnlessEqual(l.getText(),
+                             "Some text\nSome more text\nmore\n")
+        self.failUnlessEqual(l.getTextWithHeaders(),
+                             "HEADER\n" +
+                             "Some text\nSome more text\nmore\n")
+        self.failUnlessEqual(len(l.getChunks()), 2)
+
+    def testStubify(self):
+        l = builder.LogFile(None)
+        l.name = "compile"
+        l.step = 13
+        l.addHeader("HEADER\n")
+        l.addStdout("Some text\n")
+        l.addStdout("Some more text\n")
+        l.addStdout("more\n")
+        stub = l.stubify()
+        self.failUnless(components.implements(stub,
+                                              interfaces.IStatusLogStub))
+        self.failUnlessEqual(stub.getName(), l.getName())
+        self.failUnlessEqual(stub.getStep(), l.getStep())





More information about the Commits mailing list