[PATCH] osmo-gsm-tester[master]: Split osmo-trx from osmo-bts-trx

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
Tue Aug 15 15:11:06 UTC 2017


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

Split osmo-trx from osmo-bts-trx

In the future, some environments/products may come with a trx interface
pre-installed. Start work to easily disable launching it.

Change-Id: I556c3e2ba16753393c7e70800c533a18122daeaa
---
M contrib/jenkins-build-osmo-bts-trx.sh
A contrib/jenkins-build-osmo-trx.sh
M src/osmo_gsm_tester/bts_osmotrx.py
3 files changed, 50 insertions(+), 12 deletions(-)


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

diff --git a/contrib/jenkins-build-osmo-bts-trx.sh b/contrib/jenkins-build-osmo-bts-trx.sh
index c4bdcaf..8664a08 100755
--- a/contrib/jenkins-build-osmo-bts-trx.sh
+++ b/contrib/jenkins-build-osmo-bts-trx.sh
@@ -9,7 +9,6 @@
 
 build_repo libosmocore --disable-doxygen
 build_repo libosmo-abis
-build_repo osmo-trx --without-sse
 build_repo osmo-bts --enable-trx --with-openbsc=$base/openbsc/openbsc/include
 
 create_bin_tgz
diff --git a/contrib/jenkins-build-osmo-trx.sh b/contrib/jenkins-build-osmo-trx.sh
new file mode 100755
index 0000000..7d2a5b6
--- /dev/null
+++ b/contrib/jenkins-build-osmo-trx.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e -x
+base="$PWD"
+name="osmo-trx"
+. "$(dirname "$0")/jenkins-build-common.sh"
+
+build_repo osmo-trx --without-sse
+
+create_bin_tgz
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index d8675cb..7496ce8 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -27,9 +27,8 @@
     run_dir = None
     inst = None
     env = None
-    proc_trx = None
+    trx = None
 
-    BIN_TRX = 'osmo-trx'
     BIN_BTS_TRX = 'osmo-bts-trx'
     BIN_PCU = 'osmo-pcu'
 
@@ -54,26 +53,22 @@
         self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name()))
         self.configure()
 
+        self.trx = OsmoTrx(self.suite_run)
+        self.trx.start()
+        self.log('Waiting for osmo-trx to start up...')
+        event_loop.wait(self, self.trx.trx_ready)
+
         self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst(OsmoBtsTrx.BIN_BTS_TRX)))
         lib = self.inst.child('lib')
         if not os.path.isdir(lib):
             raise RuntimeError('No lib/ in %r' % self.inst)
         self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
 
-        self.proc_trx = self.launch_process(OsmoBtsTrx.BIN_TRX, '-x')
-        self.log('Waiting for osmo-trx to start up...')
-        event_loop.wait(self, 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),
                             '-i', self.bsc.addr())
         #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))
@@ -120,4 +115,39 @@
     def set_bsc(self, bsc):
         self.bsc = bsc
 
+class OsmoTrx(log.Origin):
+    suite_run = None
+    run_dir = None
+    inst = None
+    env = None
+    proc_trx = None
+
+    BIN_TRX = 'osmo-trx'
+
+    def __init__(self, suite_run):
+        super().__init__(log.C_RUN, OsmoTrx.BIN_TRX)
+        self.suite_run = suite_run
+        self.env = {}
+
+    def start(self):
+        self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name()))
+        self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst(OsmoTrx.BIN_TRX)))
+        self.proc_trx = self.launch_process(OsmoTrx.BIN_TRX, '-x')
+
+    def launch_process(self, binary_name, *args):
+        binary = os.path.abspath(self.inst.child('bin', binary_name))
+        run_dir = self.run_dir.new_dir(binary_name)
+        if not os.path.isfile(binary):
+            raise RuntimeError('Binary missing: %r' % binary)
+        proc = process.Process(binary_name, run_dir,
+                               (binary,) + args,
+                               env=self.env)
+        self.suite_run.remember_to_stop(proc)
+        proc.launch()
+        return proc
+
+    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 '')
 # vim: expandtab tabstop=4 shiftwidth=4

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I556c3e2ba16753393c7e70800c533a18122daeaa
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