Change in osmo-gsm-tester[master]: ms_driver: Switch to process.Process from subprocess

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/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Mon Nov 5 06:51:42 UTC 2018


Holger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/11597


Change subject: ms_driver: Switch to process.Process from subprocess
......................................................................

ms_driver: Switch to process.Process from subprocess

Use a single tmp/rundir for all these instances. In the next step
we can create separate directories.

Change-Id: Icf4d4e161ac4283a63ed4e0745b375e7e6a25004
---
M src/osmo_ms_driver/__main__.py
M src/osmo_ms_driver/starter.py
2 files changed, 10 insertions(+), 12 deletions(-)



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

diff --git a/src/osmo_ms_driver/__main__.py b/src/osmo_ms_driver/__main__.py
index 265ce47..0e3611b 100644
--- a/src/osmo_ms_driver/__main__.py
+++ b/src/osmo_ms_driver/__main__.py
@@ -83,7 +83,7 @@
     ev_server.listen(loop)
 
     # Just a single test for now.
-    options = BinaryOptions("virtphy", "mobile", None)
+    options = BinaryOptions("virtphy", "mobile", os.environ)
     test = MassUpdateLocationTest("lu_test", options, args.num_ms, cdf, ev_server, tmp_dir)
     atexit.register(test.stop_all)
 
diff --git a/src/osmo_ms_driver/starter.py b/src/osmo_ms_driver/starter.py
index 2ffb33a..4611cd6 100644
--- a/src/osmo_ms_driver/starter.py
+++ b/src/osmo_ms_driver/starter.py
@@ -16,17 +16,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from osmo_gsm_tester import log, template
+from osmo_gsm_tester import log, process, template
 
 import collections
 import os
 import os.path
-import subprocess
 import time
 
-_devnull = open(os.devnull, 'w')
-#_devnull = open('/dev/stdout', 'w')
-
 BinaryOptions = collections.namedtuple("BinaryOptions", ["virtphy", "mobile", "env"])
 
 class Launcher(log.Origin):
@@ -53,10 +49,11 @@
         if len(self._phy_filename.encode()) > 107:
             raise log.Error('Path for unix socket is longer than max allowed len for unix socket path (107):', self._phy_filename)
 
-        self.log("Starting virtphy process")
+        self.log("Starting virtphy")
         args = [self._binary, "--l1ctl-sock=" + self._phy_filename]
-        self.log(' '.join(args))
-        self._vphy_proc = subprocess.Popen(args, stderr=_devnull, stdout=_devnull, env=self._env)
+        self._vphy_proc = process.Process(self.name(), self._tmp_dir,
+                                          args, env=self._env)
+        self._vphy_proc.launch()
 
     def verify_ready(self):
         while True:
@@ -120,11 +117,12 @@
         lua_filename = self.write_lua_cfg()
         mob_filename = self.write_mob_cfg(lua_filename, self._phy_filename)
 
-        self.log("Starting process")
+        self.log("Starting mobile")
         # Let the kernel pick an unused port for the VTY.
         args = [self._binary, "-c", mob_filename, "--vty-port=0"]
-        self.log(' '.join(args))
-        self._omob_proc = subprocess.Popen(args, stderr=_devnull, stdout=_devnull, env=self._env)
+        self._omob_proc = process.Process(self.name(), self._tmp_dir,
+                                          args, env=self._env)
+        self._omob_proc.launch()
 
     def kill(self):
         """Clean up things."""

-- 
To view, visit https://gerrit.osmocom.org/11597
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf4d4e161ac4283a63ed4e0745b375e7e6a25004
Gerrit-Change-Number: 11597
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181105/9ae9d92f/attachment.htm>


More information about the gerrit-log mailing list