aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-06-13 18:07:57 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-17 17:01:20 +0000
commit1dd2955cb1db5f0de196051b59cecaeb7e711e49 (patch)
tree7488994cc310d0dca43411236ad0a968b54776fb
parentd091233934d5b0336205421b86bc75d5032b4d7d (diff)
Unuse resources after every test
Fix bug in put_all(). That method was unused before this commit. Clean the process list after the processes are stopped, otherwise the suite eventually fails with a 'process terminated prematurely' error. Before it was not necessary because it was not reused (a new suite run was created). Change-Id: Iee12866045145544076c6c18786e1a54f18fc293
-rw-r--r--src/osmo_gsm_tester/resource.py8
-rw-r--r--src/osmo_gsm_tester/suite.py9
2 files changed, 9 insertions, 8 deletions
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index dbfc4e0..8eec71e 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -508,11 +508,11 @@ class ReservedResources(log.Origin):
my_item.pop(USED_KEY)
def put_all(self):
+ if not self.reserved:
+ return
for key, item_list in self.reserved.items():
- my_list = self.get(key)
- for my_item in my_list:
- if my_item.get(USED_KEY):
- my_item.pop(USED_KEY)
+ for item in item_list:
+ item.pop(USED_KEY, None)
def free(self):
if self.reserved:
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index c78c9fc..f4b9260 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -256,6 +256,9 @@ class SuiteRun(log.Origin):
continue
self.current_test = test
test.run()
+ self.stop_processes()
+ self.objects_cleanup()
+ self.reserved_resources.put_all()
except Exception:
log.log_exn()
except BaseException as e:
@@ -303,10 +306,8 @@ class SuiteRun(log.Origin):
self._processes.insert(0, process)
def stop_processes(self):
- if not self._processes:
- return
- for process in self._processes:
- process.terminate()
+ while self._processes:
+ self._processes.pop().terminate()
def free_resources(self):
if self.reserved_resources is None: