Change in osmo-gsm-tester[master]: ms_driver: Consult the suite to get the binaries

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:43 UTC 2018


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


Change subject: ms_driver: Consult the suite to get the binaries
......................................................................

ms_driver: Consult the suite to get the binaries

Change-Id: I7fbb04cf67fe21378aacefcf1a15533d20d10d49
---
M src/osmo_gsm_tester/ms_driver.py
1 file changed, 29 insertions(+), 2 deletions(-)



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

diff --git a/src/osmo_gsm_tester/ms_driver.py b/src/osmo_gsm_tester/ms_driver.py
index f9ad559..492c5eb 100644
--- a/src/osmo_gsm_tester/ms_driver.py
+++ b/src/osmo_gsm_tester/ms_driver.py
@@ -74,6 +74,33 @@
             self.event_server_sk_tmp_dir = tempfile.mkdtemp('', 'ogteventserversk')
         return os.path.join(self.event_server_sk_tmp_dir, 'osmo_ms_driver.unix')
 
+    def build_binary_options(self):
+        """Builds an instance of BinaryOptions.
+
+        Populates the BinaryOptions by searching the virtphy and mobile
+        application within the trial directory.
+        """
+
+        # Get the base directory for the virtphy/mobile application
+        inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmocom-bb')))
+
+        # Assume these are dynamically linked and verify there is a lib dir.
+        lib = inst.child('lib')
+        if not os.path.isdir(lib):
+            raise RuntimeError('No lib/ in %r' % inst)
+        env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
+
+        def check_and_return_binary(name):
+            """Checks the binary exists and returns the path."""
+            binary = inst.child('bin', name)
+            if not os.path.isfile(name):
+                raise RuntimeError('Binary missing: %r' % binary)
+            return binary
+
+        virtphy = check_and_return_binary('virtphy')
+        mobile = check_and_return_binary('mobile')
+        return BinaryOptions(virtphy, mobile, env)
+
     def configure(self):
         """
         Configures the subscribers, tests and registration server. Needs to be
@@ -83,10 +110,10 @@
 
         self._ev_server = EventServer("ev_server", event_server_path)
         self._ev_server.listen(self._loop)
-        options = BinaryOptions("virtphy", "mobile", None)
+        options = self.build_binary_options()
         self._test_case = MassUpdateLocationTest("mass", options, self._num_ms, self._cdf,
                                                  self._ev_server,
-                                                 util.Dir(self.event_server_sk_tmp_dir))
+                                                 util.Dir(self.suite_run.get_test_run_dir()))
 
         # TODO: We should pass subscribers down to the test and not get it from
         # there.

-- 
To view, visit https://gerrit.osmocom.org/11599
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: I7fbb04cf67fe21378aacefcf1a15533d20d10d49
Gerrit-Change-Number: 11599
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/4bf77602/attachment.htm>


More information about the gerrit-log mailing list