[MERGED] osmo-gsm-tester[master]: Prepend LD_LIBRARY_PATH instead of overwritting it

2017-05-08 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: Prepend LD_LIBRARY_PATH instead of overwritting it
..


Prepend LD_LIBRARY_PATH instead of overwritting it

My current distribution ships a newer libcrypto and libssl which are not
ABI compatible with the ones generated by Jenkins. I had to copy those
libraries locally and use LD_LIBRARY_PATH to be able to run binaries
compiled coming from the jenkins slave. Without this patch I am not
able to run it because it is overwriting the previous variable.

Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
---
M src/osmo_gsm_tester/bts_octphy.py
M src/osmo_gsm_tester/bts_osmotrx.py
M src/osmo_gsm_tester/osmo_nitb.py
M src/osmo_gsm_tester/util.py
4 files changed, 11 insertions(+), 3 deletions(-)

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



diff --git a/src/osmo_gsm_tester/bts_octphy.py 
b/src/osmo_gsm_tester/bts_octphy.py
index 1f36a79..5a73c7d 100644
--- a/src/osmo_gsm_tester/bts_octphy.py
+++ b/src/osmo_gsm_tester/bts_octphy.py
@@ -50,7 +50,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
 
 self.launch_process(OsmoBtsOctphy.BIN_BTS_OCTPHY, '-r', '1', '-c', 
os.path.abspath(self.config_file))
 self.suite_run.poll()
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py 
b/src/osmo_gsm_tester/bts_osmotrx.py
index cadf98f..e62e4e6 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -54,7 +54,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+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...')
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 4cd6055..3ed48b2 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -50,7 +50,9 @@
 lib = inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % inst)
-env = { 'LD_LIBRARY_PATH': lib }
+
+env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
+
 self.dbg(run_dir=self.run_dir, binary=binary, env=env)
 self.process = process.Process(self.name(), self.run_dir,
(binary, '-c',
diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index 335e3ba..9a4e728 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -32,6 +32,12 @@
 import readline
 
 
+def prepend_library_path(path):
+lp = os.getenv('LD_LIBRARY_PATH')
+if not lp:
+return path
+return path + ':' + lp
+
 class listdict:
 'a dict of lists { "a": [1, 2, 3],  "b": [1, 2] }'
 def __getattr__(ld, name):

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


osmo-gsm-tester[master]: Prepend LD_LIBRARY_PATH instead of overwritting it

2017-05-08 Thread Pau Espin Pedrol

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: Prepend LD_LIBRARY_PATH instead of overwritting it

2017-05-08 Thread Pau Espin Pedrol
Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/2539

to look at the new patch set (#2).

Prepend LD_LIBRARY_PATH instead of overwritting it

My current distribution ships a newer libcrypto and libssl which are not
ABI compatible with the ones generated by Jenkins. I had to copy those
libraries locally and use LD_LIBRARY_PATH to be able to run binaries
compiled coming from the jenkins slave. Without this patch I am not
able to run it because it is overwriting the previous variable.

Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
---
M src/osmo_gsm_tester/bts_octphy.py
M src/osmo_gsm_tester/bts_osmotrx.py
M src/osmo_gsm_tester/osmo_nitb.py
M src/osmo_gsm_tester/util.py
4 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/39/2539/2

diff --git a/src/osmo_gsm_tester/bts_octphy.py 
b/src/osmo_gsm_tester/bts_octphy.py
index 1f36a79..5a73c7d 100644
--- a/src/osmo_gsm_tester/bts_octphy.py
+++ b/src/osmo_gsm_tester/bts_octphy.py
@@ -50,7 +50,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
 
 self.launch_process(OsmoBtsOctphy.BIN_BTS_OCTPHY, '-r', '1', '-c', 
os.path.abspath(self.config_file))
 self.suite_run.poll()
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py 
b/src/osmo_gsm_tester/bts_osmotrx.py
index cadf98f..e62e4e6 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -54,7 +54,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+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...')
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 4cd6055..3ed48b2 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -50,7 +50,9 @@
 lib = inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % inst)
-env = { 'LD_LIBRARY_PATH': lib }
+
+env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
+
 self.dbg(run_dir=self.run_dir, binary=binary, env=env)
 self.process = process.Process(self.name(), self.run_dir,
(binary, '-c',
diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index 335e3ba..9a4e728 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -32,6 +32,12 @@
 import readline
 
 
+def prepend_library_path(path):
+lp = os.getenv('LD_LIBRARY_PATH')
+if not lp:
+return path
+return path + ':' + lp
+
 class listdict:
 'a dict of lists { "a": [1, 2, 3],  "b": [1, 2] }'
 def __getattr__(ld, name):

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


osmo-gsm-tester[master]: Prepend LD_LIBRARY_PATH instead of overwritting it

2017-05-08 Thread Neels Hofmeyr

Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/2539/1/src/osmo_gsm_tester/util.py
File src/osmo_gsm_tester/util.py:

Line 38: return lp
if not lp:
return path

1) lp might be ''
2) returning the wrong part :)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


[PATCH] osmo-gsm-tester[master]: Prepend LD_LIBRARY_PATH instead of overwritting it

2017-05-08 Thread Pau Espin Pedrol

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

Prepend LD_LIBRARY_PATH instead of overwritting it

My current distribution ships a newer libcrypto and libssl which are not
ABI compatible with the ones generated by Jenkins. I had to copy those
libraries locally and use LD_LIBRARY_PATH to be able to run binaries
compiled coming from the jenkins slave. Without this patch I am not
able to run it because it is overwriting the previous variable.

Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
---
M src/osmo_gsm_tester/bts_octphy.py
M src/osmo_gsm_tester/bts_osmotrx.py
M src/osmo_gsm_tester/osmo_nitb.py
M src/osmo_gsm_tester/util.py
4 files changed, 11 insertions(+), 3 deletions(-)


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

diff --git a/src/osmo_gsm_tester/bts_octphy.py 
b/src/osmo_gsm_tester/bts_octphy.py
index 1f36a79..5a73c7d 100644
--- a/src/osmo_gsm_tester/bts_octphy.py
+++ b/src/osmo_gsm_tester/bts_octphy.py
@@ -50,7 +50,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
 
 self.launch_process(OsmoBtsOctphy.BIN_BTS_OCTPHY, '-r', '1', '-c', 
os.path.abspath(self.config_file))
 self.suite_run.poll()
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py 
b/src/osmo_gsm_tester/bts_osmotrx.py
index cadf98f..e62e4e6 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -54,7 +54,7 @@
 lib = self.inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % self.inst)
-self.env = { 'LD_LIBRARY_PATH': lib }
+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...')
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 4cd6055..3ed48b2 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -50,7 +50,9 @@
 lib = inst.child('lib')
 if not os.path.isdir(lib):
 raise RuntimeError('No lib/ in %r' % inst)
-env = { 'LD_LIBRARY_PATH': lib }
+
+env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
+
 self.dbg(run_dir=self.run_dir, binary=binary, env=env)
 self.process = process.Process(self.name(), self.run_dir,
(binary, '-c',
diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index 335e3ba..6115c2e 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -32,6 +32,12 @@
 import readline
 
 
+def prepend_library_path(path):
+lp = os.getenv('LD_LIBRARY_PATH')
+if lp is None:
+return lp
+return path + ':' + lp
+
 class listdict:
 'a dict of lists { "a": [1, 2, 3],  "b": [1, 2] }'
 def __getattr__(ld, name):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9b16d13d343616cbf87b9da8a99e3fae48da6bd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol