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
Sat Nov 24 12:42:34 UTC 2018


Holger Freyther has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/ms_driver.py b/src/osmo_gsm_tester/ms_driver.py
index 36ba713..634370f 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()),
                                                  suite_run=self._suite_run)
 
         # TODO: We should pass subscribers down to the test and not get it from

-- 
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: merged
Gerrit-Change-Id: I7fbb04cf67fe21378aacefcf1a15533d20d10d49
Gerrit-Change-Number: 11599
Gerrit-PatchSet: 4
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181124/283a225a/attachment.htm>


More information about the gerrit-log mailing list