Title: [121328] trunk/Tools
Revision
121328
Author
o...@webkit.org
Date
2012-06-27 01:27:02 -0700 (Wed, 27 Jun 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py (121327 => 121328)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py	2012-06-27 07:48:24 UTC (rev 121327)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py	2012-06-27 08:27:02 UTC (rev 121328)
@@ -328,7 +328,30 @@
 """)
 
 
+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
 # be located in a directory with a valid module name.
@@ -336,4 +359,5 @@
 # so for now this is a stand-alone test harness.
 if __name__ == '__main__':
     BuildBotConfigLoader().load_config('master.cfg')
+    BuildStepsConstructorTest.generateTests()
     unittest.main()

Modified: trunk/Tools/ChangeLog (121327 => 121328)


--- trunk/Tools/ChangeLog	2012-06-27 07:48:24 UTC (rev 121327)
+++ trunk/Tools/ChangeLog	2012-06-27 08:27:02 UTC (rev 121328)
@@ -1,3 +1,16 @@
+2012-06-27  Csaba Osztrogonác  <o...@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  <mhahnenb...@apple.com>
 
         Add support for preciseTime() to WebKitTestRunner
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to