Add master.cfg unittest to help migration - pass BuildStep instances instead of Build...
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 08:27:02 +0000 (08:27 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 08:27:02 +0000 (08:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89564

Reviewed by Tony Chang.

* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
(BuildStepsConstructorTest):
(BuildStepsConstructorTest.generateTests):
(BuildStepsConstructorTest.createTest):
(BuildStepsConstructorTest.createTest.doTest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py
Tools/ChangeLog

index 101451f..813ff22 100755 (executable)
@@ -328,6 +328,29 @@ Tests that timed out:
 """)
 
 
+class BuildStepsConstructorTest(unittest.TestCase):
+    # "Passing a BuildStep subclass to factory.addStep is deprecated. Please pass a BuildStep instance instead.  Support will be dropped in v0.8.7."
+    # It checks if all builder's all buildsteps can be insantiated after migration.
+    # https://bugs.webkit.org/show_bug.cgi?id=89001
+    # http://buildbot.net/buildbot/docs/0.8.6p1/manual/customization.html#writing-buildstep-constructors
+
+    @staticmethod
+    def generateTests():
+        for builderNumber, builder in enumerate(c['builders']):
+            for stepNumber, step in enumerate(builder['factory'].steps):
+                builderName = builder['name'].encode('ascii', 'ignore')
+                setattr(BuildStepsConstructorTest, 'test_builder%02d_step%02d' % (builderNumber, stepNumber), BuildStepsConstructorTest.createTest(builderName, step))
+
+    @staticmethod
+    def createTest(builderName, step):
+        def doTest(self):
+            try:
+                buildStepFactory, kwargs = step
+                buildStepFactory(**kwargs)
+            except TypeError as e:
+                buildStepName = str(buildStepFactory).split('.')[-1]
+                self.fail("Error during instantiation %s buildstep for %s builder: %s\n" % (buildStepName, builderName, e))
+        return doTest
 
 # FIXME: We should run this file as part of test-webkitpy.
 # Unfortunately test-webkitpy currently requires that unittests
@@ -336,4 +359,5 @@ Tests that timed out:
 # so for now this is a stand-alone test harness.
 if __name__ == '__main__':
     BuildBotConfigLoader().load_config('master.cfg')
+    BuildStepsConstructorTest.generateTests()
     unittest.main()
index 4a49786..23a9019 100644 (file)
@@ -1,3 +1,16 @@
+2012-06-27  Csaba Osztrogonác  <ossy@webkit.org>
+
+        Add master.cfg unittest to help migration - pass BuildStep instances instead of BuildStep subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=89564
+
+        Reviewed by Tony Chang.
+
+        * BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
+        (BuildStepsConstructorTest):
+        (BuildStepsConstructorTest.generateTests):
+        (BuildStepsConstructorTest.createTest):
+        (BuildStepsConstructorTest.createTest.doTest):
+
 2012-06-26  Mark Hahnenberg  <mhahnenberg@apple.com>
 
         Add support for preciseTime() to WebKitTestRunner