From 0316694202de043dd4eeaccd61f4b7b19959e024 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Oct 2017 17:22:51 +0200 Subject: Make Debug build by default on MacOS Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 643e630..a22380a 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}") -- cgit v1.2.1 From 5cf9322ea5215b238364e5caac9e0e176522c4a8 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Oct 2017 15:33:16 +0200 Subject: Switch logging volatile data Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a22380a..8259f67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,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) -- cgit v1.2.1 From 97f965ebad4e15912e401ecb8bf2b259e093d91b Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Oct 2017 15:34:19 +0200 Subject: Show proper device status code Signed-off-by: Szczepan Zalega --- include/device_proto.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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(resp.command_id)) - + std::string(" ") - + std::to_string(resp.storage_status.device_status) + std::string( + commandid_to_string(static_cast(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(resp), Loglevel::DEBUG); -- cgit v1.2.1 From 1a446933032beca0b1c5764acf23940ceb7a43ab Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Oct 2017 15:35:19 +0200 Subject: Allow to use library path in tests from environment variable Signed-off-by: Szczepan Zalega --- unittest/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) -- cgit v1.2.1