Sometimes when controller process cleanup happens concurrently with testbed teardown...
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 3 May 2011 11:05:55 +0000 (13:05 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 3 May 2011 11:05:55 +0000 (13:05 +0200)
Just catch them and retry, sidestepping the issue. Proper synchronization is not easy, and not worth the amount of work for mere testing.

test/core/integration.py
test/testbeds/netns/execute.py
test/testbeds/netns/integration.py
test/testbeds/ns3/execute.py
test/testbeds/ns3/execute2.py
test/testbeds/ns3/integration.py
test/testbeds/planetlab/execute.py
test/testbeds/planetlab/integration.py
test/util/server.py

index d58dc86..3618c87 100755 (executable)
@@ -25,7 +25,12 @@ class ExecuteTestCase(unittest.TestCase):
         self.root_dir = tempfile.mkdtemp()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
     def make_testbed(self, exp_desc, testbed_id, testbed_version):
         provider = FactoriesProvider(testbed_id, testbed_version)
index 319de37..d37d84f 100755 (executable)
@@ -164,7 +164,12 @@ class NetnsExecuteTestCase(unittest.TestCase):
         instance.shutdown()
         
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()
index 16f336c..a18cdb0 100755 (executable)
@@ -187,7 +187,12 @@ class NetnsIntegrationTestCase(unittest.TestCase):
         controller.shutdown()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()
index ffefbfc..be7a432 100755 (executable)
@@ -78,7 +78,12 @@ class Ns3ExecuteTestCase(unittest.TestCase):
         instance.shutdown()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()
index 1a24e70..52ac526 100755 (executable)
@@ -114,7 +114,12 @@ class Ns3ExecuteTestCase(unittest.TestCase):
         instance.shutdown()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()
index 61df6ae..f0926da 100755 (executable)
@@ -152,7 +152,12 @@ class Ns3IntegrationTestCase(unittest.TestCase):
         controller.shutdown()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()
index 4d0fa75..627e256 100755 (executable)
@@ -17,7 +17,12 @@ class PlanetLabExecuteTestCase(unittest.TestCase):
         self.root_dir = tempfile.mkdtemp()
         
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
     def make_instance(self):
         testbed_version = "01"
index e7e34d3..0edcb1e 100755 (executable)
@@ -18,7 +18,12 @@ class PlanetLabIntegrationTestCase(unittest.TestCase):
         self.root_dir = tempfile.mkdtemp()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
     def make_experiment_desc(self):
         testbed_id = "planetlab"
index f1bdd1c..7e4c6f1 100755 (executable)
@@ -9,6 +9,7 @@ import sys
 import tempfile
 import test_util
 import unittest
+import time
 
 class ServerTestCase(unittest.TestCase):
     def setUp(self):
@@ -161,7 +162,12 @@ class ServerTestCase(unittest.TestCase):
         self.assertEqual(reply, "Stopping server")
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()