diff options
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | include/device_proto.h | 12 | ||||
-rw-r--r-- | unittest/conftest.py | 5 |
3 files changed, 21 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 643e630..8259f67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,12 @@ OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" FALSE) IF (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo) + IF(APPLE) + # Issues occur when build with enabled optimizations + set(CMAKE_BUILD_TYPE Debug) + ELSE() + set(CMAKE_BUILD_TYPE RelWithDebInfo) + ENDIF() ENDIF() MESSAGE("${PROJECT_NAME}: Build type: ${CMAKE_BUILD_TYPE}") @@ -118,6 +123,11 @@ IF (NO_LOG) SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG") ENDIF() +OPTION(LOG_VOLATILE_DATA "Log volatile data (debug)" OFF) +IF (LOG_VOLATILE_DATA) + SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "LOG_VOLATILE_DATA") +ENDIF() + file(GLOB LIB_INCLUDES "include/*.h") install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnitrokey) diff --git a/include/device_proto.h b/include/device_proto.h index 0be9ed1..388c721 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -393,12 +393,14 @@ namespace nitrokey { } LOG(std::string("<= ") + - std::string( - commandid_to_string(static_cast<CommandID>(resp.command_id)) - + std::string(" ") - + std::to_string(resp.storage_status.device_status) + std::string( + commandid_to_string(static_cast<CommandID>(resp.command_id)) + + std::string(" ") + + std::to_string(resp.device_status) + + std::string(" ") + + std::to_string(resp.storage_status.device_status) // + std::to_string( status_translate_command(resp.storage_status.device_status)) - ), Loglevel::DEBUG_L1); + ), Loglevel::DEBUG_L1); LOG("Incoming HID packet:", Loglevel::DEBUG); LOG(static_cast<std::string>(resp), Loglevel::DEBUG); diff --git a/unittest/conftest.py b/unittest/conftest.py index ef4539c..a53b005 100644 --- a/unittest/conftest.py +++ b/unittest/conftest.py @@ -36,13 +36,15 @@ def C(request): import os, sys path_build = os.path.join("..", "build") paths = [ + os.environ.get('LIBNK_PATH', None), os.path.join(path_build,"libnitrokey.so"), os.path.join(path_build,"libnitrokey.dylib"), os.path.join(path_build,"libnitrokey.dll"), os.path.join(path_build,"nitrokey.dll"), ] for p in paths: - print(p) + if not p: continue + print("Trying " +p) p = os.path.abspath(p) if os.path.exists(p): print("Found: "+p) @@ -50,7 +52,6 @@ def C(request): break else: print("File does not exist: " + p) - print("Trying another") if not C: print("No library file found") sys.exit(1) |