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
This commit is contained in:
parent
5adb5c7405
commit
4773853cb0
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue