Browse Source

[2856] Delete the mapped file after the test completes

Mukund Sivaraman 12 years ago
parent
commit
7c6999a010
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/lib/python/isc/memmgr/tests/builder_tests.py

+ 8 - 0
src/lib/python/isc/memmgr/tests/builder_tests.py

@@ -56,6 +56,7 @@ class TestMemorySegmentBuilder(unittest.TestCase):
 
     def setUp(self):
         self._create_builder_thread()
+        self.__mapped_file_path = None
 
     def tearDown(self):
         # It's the tests' responsibility to stop and join the builder
@@ -65,6 +66,10 @@ class TestMemorySegmentBuilder(unittest.TestCase):
         self._master_sock.close()
         self._builder_sock.close()
 
+        if self.__mapped_file_path is not None:
+            if os.path.exists(self.__mapped_file_path):
+                os.unlink(self.__mapped_file_path)
+
     def test_bad_command(self):
         """Tests what happens when a bad command is passed to the
         MemorySegmentBuilder.
@@ -163,6 +168,9 @@ class TestMemorySegmentBuilder(unittest.TestCase):
         self.assertIsNone(sgmt_info.get_reset_param(SegmentInfo.READER))
         self.assertIsNotNone(sgmt_info.get_reset_param(SegmentInfo.WRITER))
 
+        param = sgmt_info.get_reset_param(SegmentInfo.WRITER)
+        self.__mapped_file_path = param['mapped-file']
+
         self._builder_thread.start()
 
         # Now that the builder thread is running, send it the "load"