From 59178eef01cd8c9afce039c3402f88c03ee4058f Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Wed, 3 Apr 2019 12:28:15 +0200 Subject: [PATCH] Make libocf.so loading CWD independent Signed-off-by: Jan Musial --- tests/functional/pyocf/ocf.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/functional/pyocf/ocf.py b/tests/functional/pyocf/ocf.py index 27b5001..5108604 100644 --- a/tests/functional/pyocf/ocf.py +++ b/tests/functional/pyocf/ocf.py @@ -3,6 +3,8 @@ # SPDX-License-Identifier: BSD-3-Clause-Clear # from ctypes import c_void_p, cdll +import inspect +import os lib = None @@ -13,7 +15,12 @@ class OcfLib: @classmethod def getInstance(cls): if cls.__lib__ is None: - lib = cdll.LoadLibrary("./pyocf/libocf.so") + lib = cdll.LoadLibrary( + os.path.join( + os.path.dirname(inspect.getfile(inspect.currentframe())), + "libocf.so", + ) + ) lib.ocf_volume_get_uuid.restype = c_void_p lib.ocf_volume_get_uuid.argtypes = [c_void_p]