[PATCH] osmo-gsm-tester[master]: osmo-bts-trx: wait for osmo-trx to launch before proceeding

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun May 7 00:54:27 UTC 2017


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

osmo-bts-trx: wait for osmo-trx to launch before proceeding

Change-Id: I34feaf27b245f34a47f04cfacebdd19537eed44f
---
M src/osmo_gsm_tester/bts_osmotrx.py
1 file changed, 11 insertions(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index 2ea0f0b..cadf98f 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -26,6 +26,7 @@
     run_dir = None
     inst = None
     env = None
+    proc_trx = None
 
     BIN_TRX = 'osmo-trx'
     BIN_BTS_TRX = 'osmo-bts-trx'
@@ -55,10 +56,18 @@
             raise RuntimeError('No lib/ in %r' % self.inst)
         self.env = { 'LD_LIBRARY_PATH': lib }
 
-        self.launch_process(OsmoBtsTrx.BIN_TRX, '-x')
+        self.proc_trx = self.launch_process(OsmoBtsTrx.BIN_TRX, '-x')
+        self.log('Waiting for osmo-trx to start up...')
+        self.suite_run.wait(self.trx_ready)
+        self.proc_trx.log(self.proc_trx.get_stdout_tail(1))
         self.launch_process(OsmoBtsTrx.BIN_BTS_TRX, '-r', '1', '-c', os.path.abspath(self.config_file))
         #self.launch_process(OsmoBtsTrx.BIN_PCU, '-r', '1')
         self.suite_run.poll()
+
+    def trx_ready(self):
+        if not self.proc_trx or not self.proc_trx.is_running:
+            return False
+        return '-- Transceiver active with' in (self.proc_trx.get_stdout() or '')
 
     def launch_process(self, binary_name, *args):
         binary = os.path.abspath(self.inst.child('bin', binary_name))
@@ -70,6 +79,7 @@
                                env=self.env)
         self.suite_run.remember_to_stop(proc)
         proc.launch()
+        return proc
 
     def configure(self):
         if self.nitb is None:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34feaf27b245f34a47f04cfacebdd19537eed44f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list