diff options
author | Damjan Marion <damarion@cisco.com> | 2021-09-30 20:04:14 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-10-05 16:44:32 +0000 |
commit | 5546e43f7943d6edff6c6587ed4e7233e8002e28 (patch) | |
tree | 16b4a8ce7a63c4cf1ce7f367b0d0f1d9268f2849 /test/test_vcl.py | |
parent | efd967faff168d037066b6e6824d2a579adbef93 (diff) |
build: don't hardcode triplet, allow specifying custom lib dir
Type: fix
Change-Id: I33f364fda88914f88f9b976cb83e6d3ff466f0bb
Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Diffstat (limited to 'test/test_vcl.py')
-rwxr-xr-x | test/test_vcl.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/test_vcl.py b/test/test_vcl.py index 68322651eb8..50d36d5317d 100755 --- a/test/test_vcl.py +++ b/test/test_vcl.py @@ -5,6 +5,7 @@ import unittest import os import subprocess import signal +import glob from framework import VppTestCase, VppTestRunner, running_extended_tests, \ Worker from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto @@ -26,20 +27,33 @@ _have_iperf3 = have_app(iperf3) class VCLAppWorker(Worker): """ VCL Test Application Worker """ + libname = "libvcl_ldpreload.so" + + class LibraryNotFound(Exception): + pass + def __init__(self, build_dir, appname, executable_args, logger, env=None, role=None, *args, **kwargs): self.role = role + vpp_install_path = os.getenv('VPP_INSTALL_PATH') + + vcl_ldpreload_glob = "{}/**/{}".format(vpp_install_path, self.libname) + vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True) + + if len(vcl_ldpreload_so) < 1: + raise LibraryNotFound("cannot locate library: {}".format( + self.libname)) + + vcl_ldpreload_so = vcl_ldpreload_so[0] + if env is None: env = {} - vcl_lib_dir = "%s/vpp/lib" % build_dir if "iperf" in appname: app = appname - env.update({'LD_PRELOAD': - "%s/libvcl_ldpreload.so" % vcl_lib_dir}) + env.update({'LD_PRELOAD': vcl_ldpreload_so}) elif "sock" in appname: app = "%s/vpp/bin/%s" % (build_dir, appname) - env.update({'LD_PRELOAD': - "%s/libvcl_ldpreload.so" % vcl_lib_dir}) + env.update({'LD_PRELOAD': vcl_ldpreload_so}) else: app = "%s/vpp/bin/%s" % (build_dir, appname) self.args = [app] + executable_args |