[PATCH] osmo-gsm-tester[master]: Unuse resources after every test

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Jun 14 12:54:36 UTC 2017


Review at  https://gerrit.osmocom.org/2914

Unuse resources after every test

There was a bug in put_all method. Nobody was using it until now and
this test starts using it so it fixes it too.

The process list is also cleaned 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
---
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/suite.py
2 files changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/14/2914/1

diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index dbfc4e0..5ad6ba6 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -508,9 +508,10 @@
                     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:
+            for my_item in item_list:
                 if my_item.get(USED_KEY):
                     my_item.pop(USED_KEY)
 
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index f30333e..979c30f 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -237,6 +237,9 @@
                     test.set_skip()
                     continue
                 test.run()
+                self.stop_processes()
+                self.objects_cleanup()
+                self.reserved_resources.put_all()
         except Exception:
             log.log_exn()
         except BaseException as e:
@@ -288,6 +291,7 @@
             return
         for process in self._processes:
             process.terminate()
+        self._processes = None
 
     def free_resources(self):
         if self.reserved_resources is None:

-- 
To view, visit https://gerrit.osmocom.org/2914
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee12866045145544076c6c18786e1a54f18fc293
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list