scripts/trace: add build/lib to LD_LIBRARY_PATH before starting

It makes it more convinient for a user to start the script, as it's no
longer necessary to update the library path manually.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I0dbeb54cad2585a50162c91f48c5ef199fa133b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9440
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
Konrad Sztyber 2021-09-02 13:55:04 +02:00 committed by Tomasz Zawadzki
parent 5d5d9cbb3e
commit bc71c2e6d7

View File

@ -591,4 +591,14 @@ def main(argv):
if __name__ == '__main__':
main(sys.argv[1:])
# In order for the changes to LD_LIBRARY_PATH to be visible to the loader,
# they need to be applied before starting a process, so we need to
# re-execute the script after updating it.
if os.environ.get('SPDK_BPF_TRACE_PY') is None:
rootdir = f'{os.path.dirname(__file__)}/../..'
os.environ['LD_LIBRARY_PATH'] = ':'.join([os.environ.get('LD_LIBRARY_PATH', ''),
f'{rootdir}/build/lib'])
os.environ['SPDK_BPF_TRACE_PY'] = '1'
os.execv(sys.argv[0], sys.argv)
else:
main(sys.argv[1:])