[Buildbot-commits] buildbot/buildbot/test test_vc.py,1.17,1.18

Brian Warner warner at users.sourceforge.net
Thu Oct 28 07:27:10 UTC 2004


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

Modified Files:
	test_vc.py 
Log Message:
* buildbot/slave/commands.py (SourceBase): refactor subclasses to
have separate doVCUpdate/doVCFull methods. Catch an update failure
and respond by clobbering the source directory and re-trying. This
will handle local changes (like replacing a file with a directory)
that will cause CVS and SVN updates to fail.
* buildbot/test/test_vc.py (SetupMixin.do_vc): test the same


Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- test_vc.py	30 Sep 2004 07:13:32 -0000	1.17
+++ test_vc.py	28 Oct 2004 07:27:07 -0000	1.18
@@ -221,7 +221,7 @@
     def shouldNotExist(self, d, f):
         self.failIf(os.path.exists(os.path.join(d, f)))
 
-    def do_vc(self, vctype, args, metadir=None):
+    def do_vc(self, vctype, args, metadir=None, testRetry=True):
         m = self.master
         vcdir = os.path.join(self.slavebase, "vc-dir", "source")
         workdir = os.path.join(self.slavebase, "vc-dir", "build")
@@ -258,6 +258,18 @@
         self.doBuild() # update rebuild leaves new files
         self.shouldExist(workdir, "newfile")
 
+        if testRetry:
+            # certain local changes will prevent an update from working. The
+            # most common is to replace a file with a directory, or vice
+            # versa. The slave code should spot the failure and do a
+            # clobber/retry.
+            os.unlink(os.path.join(workdir, "good.c"))
+            os.mkdir(os.path.join(workdir, "good.c"))
+            self.touch(os.path.join(workdir, "good.c"), "foo")
+
+            self.doBuild() # update, but must clobber to handle the error
+            self.shouldNotExist(workdir, "newfile")
+
         self.loadConfig(config % 'copy')
         self.doBuild() # copy rebuild clobbers new files
         if metadir:
@@ -311,8 +323,13 @@
             raise unittest.SkipTest("Darcs is not installed")
         self.do_vc("step.Darcs", {
             'repourl': RepositoryPath_URI + "/Darcs-Repository",
-            })
-        # Darcs has a metadir="_darcs", but it does not have an 'export' mode
+            },
+                   testRetry=False)
+        # Darcs has a metadir="_darcs", but it does not have an 'export'
+        # mode
+
+        # TODO: testRetry has the same problem with Darcs as it does for
+        # Arch
 
     def testArch(self):
         if not have_arch:
@@ -320,8 +337,16 @@
         self.do_vc("step.Arch", {
             'url': RepositoryPath + "/Arch-Repository",
             'version': "testvc--mainline--1",
-            })
-        # Arch has a metadir="{arch}", but it does not have an 'export' mode
+            },
+                   testRetry=False)
+        # Arch has a metadir="{arch}", but it does not have an 'export' mode.
+
+        # the current testRetry=True logic doesn't have the desired effect:
+        # "update" is a no-op because arch knows that the repository hasn't
+        # changed. Other VC systems will re-checkout missing files on
+        # update, arch just leaves the tree untouched. TODO: come up with
+        # some better test logic, probably involving a copy of the
+        # repository that has a few changes checked in.
 
         # TODO: run 'tla register-archive -d test at buildbot.sf.net--testvc1'
         # to get rid of the leftover archive this leaves in the user's 'tla
@@ -336,7 +361,7 @@
             raise unittest.SkipTest("Darcs is not installed")
         self.do_vc("step.Darcs", {
             'repourl': Repository_HTTP % self.httpPort + "/Darcs-Repository",
-            })
+            }, testRetry=False)
         # Darcs has a metadir="_darcs", but it does not have an 'export' mode
 
     def testArchHTTP(self):
@@ -345,7 +370,7 @@
         self.do_vc("step.Arch", {
             'url': Repository_HTTP % self.httpPort + "/Arch-Repository",
             'version': "testvc--mainline--1",
-            })
+            }, testRetry=False)
 
 class Patch(SignalMixin, SetupMixin, unittest.TestCase):
 





More information about the Commits mailing list