[Buildbot-commits] buildbot/buildbot/test test_vc.py,1.51,1.52

Brian Warner warner at users.sourceforge.net
Sun May 7 00:20:24 UTC 2006


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

Modified Files:
	test_vc.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-522
Creator:  Brian Warner <warner at lothar.com>

add a test-patch-only testcase to isolate a windows failure

	* buildbot/test/test_vc.py
	(Patch.testPatch): add a test which runs 'patch' with less
	overhead than the full VCBase.do_patch sequence, to try to isolate
	a windows test failure. This one uses slave.commands.ShellCommand
	and 'patch', but none of the VC code.


Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- test_vc.py	6 May 2006 23:51:27 -0000	1.51
+++ test_vc.py	7 May 2006 00:20:22 -0000	1.52
@@ -14,7 +14,7 @@
 #log.startLogging(sys.stderr)
 
 from buildbot import master, interfaces
-from buildbot.slave import bot
+from buildbot.slave import bot, commands
 from buildbot.slave.commands import rmdirRecursive
 from buildbot.status.builder import SUCCESS, FAILURE
 from buildbot.process import step, base
@@ -2036,3 +2036,35 @@
         b = base.Build([r])
         s = step.SVN(svnurl="dummy", workdir=None, build=b)
         self.failUnlessEqual(s.computeSourceRevision(b.allChanges()), 67)
+
+class Patch(VCBase, unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        pass
+
+    def testPatch(self):
+        # invoke 'patch' all by itself, to see if it works the way we think
+        # it should. This is intended to ferret out some windows test
+        # failures.
+        self.workdir = os.path.join("test_vc", "testPatch")
+        self.populate(self.workdir)
+        patch = which("patch")[0]
+
+        command = [patch, "-p0"]
+        class FakeBuilder:
+            usePTY = False
+            def sendUpdate(self, status):
+                pass
+        c = commands.ShellCommand(FakeBuilder(), command, self.workdir,
+                                  sendRC=False, stdin=p0_diff)
+        d = c.start()
+        d.addCallback(self._testPatch_1)
+        return maybeWait(d)
+
+    def _testPatch_1(self, res):
+        # make sure the file actually got patched
+        subdir_c = os.path.join(self.workdir, "subdir", "subdir.c")
+        data = open(subdir_c, "r").read()
+        self.failUnlessIn("Hello patched subdir.\\n", data)





More information about the Commits mailing list