BIND 10 trac642, updated. 6e9d04eafe8928e1e428727f0fe164ff744b3c1b Refactor tests to have a single test for all fatal signals.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Apr 18 12:20:37 UTC 2011


The branch, trac642 has been updated
       via  6e9d04eafe8928e1e428727f0fe164ff744b3c1b (commit)
      from  cccbf507b0cd1dd8fd9540ce2fe36587c78fbb06 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6e9d04eafe8928e1e428727f0fe164ff744b3c1b
Author: Shane Kerr <shane at isc.org>
Date:   Thu Apr 14 16:16:20 2011 +0200

    Refactor tests to have a single test for all fatal signals.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bind10/README                  |    1 +
 src/bin/bind10/tests/bind10_test.py.in |   71 +++++++++++--------------------
 2 files changed, 26 insertions(+), 46 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/README b/src/bin/bind10/README
index e1d2d89..1ac3a87 100644
--- a/src/bin/bind10/README
+++ b/src/bin/bind10/README
@@ -7,6 +7,7 @@ Files:
   bind10.py.in     - used to make bind10.py with proper Python paths
   bob.spec         - defines the options and commands
   run_bind10.sh.in - use to make run_bind10.sh with proper Python paths
+  bind10.xml       - used to build the bind10.8 man page
 
 The "tests" directory contains unit tests for the application.
 
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index be3f48b..fc4a863 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -608,74 +608,53 @@ class TestSignalHandling(unittest.TestCase):
     # In these tests, we swap out the BoB in the bind10 class with our own. 
     # This allows us to run our setup code without actually starting 
     # the whole system.
-    def setUp(self):
+    def bossSetUp(self):
         self.save_bob_class = bind10.BoB
         bind10.BoB = MockBob
         self.wakeup_pipe = os.pipe()
 
-    def tearDown(self):
+    def bossTearDown(self):
         os.close(self.wakeup_pipe[0])
         os.close(self.wakeup_pipe[1])
         bind10.BoB = self.save_bob_class
 
-    def test_sighup(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGHUP)
-        self.assertFalse(bind10.boss_of_bind.runnable)
+    def test_fatal_signals(self):
+        signals = [signal.SIGHUP, 
+                   signal.SIGINT, 
+                   signal.SIGTERM, 
+                   signal.SIGUSR1, 
+                   signal.SIGUSR2,]
+        if hasattr(signal, 'SIGXCPU'):
+            signals.append(signal.SIGXCPU)
+        if hasattr(signal, 'SIGXFSZ'):
+            signals.append(signal.SIGXFSZ)
+        print(signals)
+        for sig in signals:
+            self.bossSetUp()
+            bind10.setup(self.wakeup_pipe)
+            self.assertTrue(bind10.boss_of_bind.runnable)
+            os.kill(os.getpid(), sig)
+            self.assertFalse(bind10.boss_of_bind.runnable)
+            self.bossTearDown()
 
     def test_sighup_nohup(self):
         # simulate the behavior of the "nohup" command
+        self.bossSetUp()
         signal.signal(signal.SIGHUP, signal.SIG_IGN)
         bind10.setup(self.wakeup_pipe)
         self.assertTrue(bind10.boss_of_bind.runnable)
         os.kill(os.getpid(), signal.SIGHUP)
         self.assertTrue(bind10.boss_of_bind.runnable)
-
-    def test_sigint(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGINT)
-        self.assertFalse(bind10.boss_of_bind.runnable)
-
-    def test_sigterm(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGTERM)
-        self.assertFalse(bind10.boss_of_bind.runnable)
+        self.bossTearDown()
 
     def test_sigpipe(self):
-        # SIGPIPE gets ignored
+        # verify that SIGPIPE gets ignored
+        self.bossSetUp()
         bind10.setup(self.wakeup_pipe)
         self.assertTrue(bind10.boss_of_bind.runnable)
         os.kill(os.getpid(), signal.SIGPIPE)
         self.assertTrue(bind10.boss_of_bind.runnable)
-
-    def test_sigusr1(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGUSR1)
-        self.assertFalse(bind10.boss_of_bind.runnable)
-
-    def test_sigusr2(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGUSR2)
-        self.assertFalse(bind10.boss_of_bind.runnable)
-
-    @unittest.skipUnless(hasattr(signal, 'SIGXCPU'), "no SIGXCPU on this OS")
-    def test_sigxcpu(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGXCPU)
-        self.assertFalse(bind10.boss_of_bind.runnable)
-
-    @unittest.skipUnless(hasattr(signal, 'SIGXFSZ'), "no SIGXFSZ on this OS")
-    def test_sigxfsz(self):
-        bind10.setup(self.wakeup_pipe)
-        self.assertTrue(bind10.boss_of_bind.runnable)
-        os.kill(os.getpid(), signal.SIGXFSZ)
-        self.assertFalse(bind10.boss_of_bind.runnable)
+        self.bossTearDown()
 
 if __name__ == '__main__':
     unittest.main()




More information about the bind10-changes mailing list