Title: [259815] trunk/Tools
Revision
259815
Author
aakash_j...@apple.com
Date
2020-04-09 12:42:02 -0700 (Thu, 09 Apr 2020)

Log Message

[ews] Add unit tests to ensure that step names are valid identifier
https://bugs.webkit.org/show_bug.cgi?id=210289

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps_unittest.py:
(TestStepNameShouldBeValidIdentifier):
(TestStepNameShouldBeValidIdentifier.test_step_names_are_valid): unit-test to validate step names.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py (259814 => 259815)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-04-09 19:33:20 UTC (rev 259814)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-04-09 19:42:02 UTC (rev 259815)
@@ -20,6 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import inspect
 import operator
 import os
 import shutil
@@ -29,6 +30,7 @@
 from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY
 from buildbot.test.fake.remotecommand import Expect, ExpectRemoteRef, ExpectShell
 from buildbot.test.util.steps import BuildStepMixin
+from buildbot.util import identifiers as buildbot_identifiers
 from mock import call
 from twisted.internet import error, reactor
 from twisted.python import failure, log
@@ -204,6 +206,17 @@
     return behavior
 
 
+class TestStepNameShouldBeValidIdentifier(BuildStepMixinAdditions, unittest.TestCase):
+    def test_step_names_are_valid(self):
+        import steps
+        build_step_classes = inspect.getmembers(steps, inspect.isclass)
+        for build_step in build_step_classes:
+            if 'name' in vars(build_step[1]):
+                name = build_step[1].name
+                self.assertFalse(' ' in name, 'step name "{}" contain space.'.format(name))
+                self.assertTrue(buildbot_identifiers.ident_re.match(name), 'step name "{}" is not a valid buildbot identifier.'.format(name))
+
+
 class TestCheckStyle(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True

Modified: trunk/Tools/ChangeLog (259814 => 259815)


--- trunk/Tools/ChangeLog	2020-04-09 19:33:20 UTC (rev 259814)
+++ trunk/Tools/ChangeLog	2020-04-09 19:42:02 UTC (rev 259815)
@@ -1,3 +1,14 @@
+2020-04-09  Aakash Jain  <aakash_j...@apple.com>
+
+        [ews] Add unit tests to ensure that step names are valid identifier
+        https://bugs.webkit.org/show_bug.cgi?id=210289
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps_unittest.py:
+        (TestStepNameShouldBeValidIdentifier):
+        (TestStepNameShouldBeValidIdentifier.test_step_names_are_valid): unit-test to validate step names.
+
 2020-04-09  Jonathan Bedard  <jbed...@apple.com>
 
         Buildbot: Force crash log submission after each test run
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to