summaryrefslogtreecommitdiff
path: root/unittest/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/conftest.py')
-rw-r--r--unittest/conftest.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/unittest/conftest.py b/unittest/conftest.py
index 88bf7d0..67b45aa 100644
--- a/unittest/conftest.py
+++ b/unittest/conftest.py
@@ -22,14 +22,30 @@ def C(request):
a = iter(declarations)
for declaration in a:
- if declaration.startswith('extern') and not '"C"' in declaration:
- declaration = declaration.replace('extern', '').strip()
+ if declaration.startswith('NK_C_API'):
+ declaration = declaration.replace('NK_C_API', '').strip()
while not ';' in declaration:
declaration += (next(a)).strip()
print(declaration)
ffi.cdef(declaration, override=True)
- C = ffi.dlopen("../build/libnitrokey.so")
+ C = None
+ import os, sys
+ path_build = os.path.join("..", "build")
+ paths = [ os.path.join(path_build,"libnitrokey-log.so"),
+ os.path.join(path_build,"libnitrokey.so")]
+ for p in paths:
+ print p
+ if os.path.exists(p):
+ C = ffi.dlopen(p)
+ break
+ else:
+ print("File does not exist: " + p)
+ print("Trying another")
+ if not C:
+ print("No library file found")
+ sys.exit(1)
+
C.NK_set_debug(False)
nk_login = C.NK_login_auto()
if nk_login != 1: