[ews-build] Add unit tests for CleanWorkingDirectory
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 17:58:21 +0000 (17:58 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 17:58:21 +0000 (17:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197195

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/steps_unittest.py:
(TestCleanWorkingDirectory):
(TestCleanWorkingDirectory.test_success):
(TestCleanWorkingDirectory.test_failure):

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

Tools/BuildSlaveSupport/ews-build/steps_unittest.py
Tools/ChangeLog

index cd9f563..98a3146 100644 (file)
@@ -834,6 +834,38 @@ class TestRunWebKit1Tests(BuildStepMixinAdditions, unittest.TestCase):
         return self.runStep()
 
 
+class TestCleanWorkingDirectory(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(CleanWorkingDirectory())
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['Tools/Scripts/clean-webkit'],
+                        )
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Cleaned working directory')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(CleanWorkingDirectory())
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['Tools/Scripts/clean-webkit'],
+                        )
+            + ExpectShell.log('stdio', stdout='Unexpected failure.')
+            + 2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='Cleaned working directory (failure)')
+        return self.runStep()
+
+
 class TestArchiveBuiltProduct(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True
index a15c36d..34ec15e 100644 (file)
@@ -1,5 +1,17 @@
 2019-04-23  Aakash Jain  <aakash_jain@apple.com>
 
+        [ews-build] Add unit tests for CleanWorkingDirectory
+        https://bugs.webkit.org/show_bug.cgi?id=197195
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-build/steps_unittest.py:
+        (TestCleanWorkingDirectory):
+        (TestCleanWorkingDirectory.test_success):
+        (TestCleanWorkingDirectory.test_failure):
+
+2019-04-23  Aakash Jain  <aakash_jain@apple.com>
+
         [ews-build] Use explicit imports instead of wildcard imports
         https://bugs.webkit.org/show_bug.cgi?id=197194