summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-15 16:20:07 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-18 07:58:52 +0000
commit4773853cb06cd1be72e458320b8aab763aa354ce (patch)
tree325fdbfce138fd8f636850d685bcc989226d09ac
parent5adb5c74050678eb57a4561e56864ee1a33b5cfb (diff)
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
-rwxr-xr-xcontrib/jenkins-build-osmo-bts-trx.sh1
-rwxr-xr-xcontrib/jenkins-build-osmo-trx.sh9
-rw-r--r--src/osmo_gsm_tester/bts_osmotrx.py52
3 files changed, 50 insertions, 12 deletions
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 @@ have_repo openbsc
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 @@ class OsmoBtsTrx(log.Origin):
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,27 +53,23 @@ class OsmoBtsTrx(log.Origin):
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))
run_dir = self.run_dir.new_dir(binary_name)
@@ -120,4 +115,39 @@ class OsmoBtsTrx(log.Origin):
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