open-license-manager / licensecc

Software licensing, copy protection in C++. It has few dependencies and it's cross-platform.
http://open-license-manager.github.io/licensecc/
BSD 3-Clause "New" or "Revised" License
975 stars 310 forks source link

Tests failing if specify a project name (cmake -DLCC_PROJECT_NAME=...) #77

Closed nyue closed 4 years ago

nyue commented 4 years ago

Ubuntu 18.04

I noticed the following compilation warning

[ 47%] Building CXX object src/library/os/CMakeFiles/os.dir/linux/network.cpp.o In file included from /usr/include/string.h:494:0, from /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/src/library/os/linux/network.cpp:28: In function ‘char* strncpy(char*, const char*, size_t)’, inlined from ‘FUNCTION_RETURN license::os::getAdapterInfos(std::vector<license::os::OsAdapterInfo>&)’ at /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/src/library/os/linux/network.cpp:71:11: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:71: warning: ‘char* __builtin___strncpy_chk(char*, const char*, long unsigned int, long unsigned int)’: specified bound 1025 exceeds the size 1024 of the destination [-Wstringop-overflow=] return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); ^ [ 48%] Building CXX object src/library/os/CMakeFiles/os.dir/linux/os_linux.cpp.o

Running tests... Test project /home/nyue/projects/Open-License-Manager/OLM/build Start 1: test_license 1/16 Test #1: test_license ..................... Passed 0.01 sec Start 2: test_command-line 2/16 Test #2: test_command-line ................ Passed 0.04 sec Start 3: test_project 3/16 Test #3: test_project ..................... Passed 0.06 sec Start 4: test_cryptohelper 4/16 Test #4: test_cryptohelper ................ Passed 0.05 sec Start 5: test_os_linux 5/16 Test #5: test_os_linux .................... Passed 0.00 sec Start 6: test_license_reader 6/16 Test #6: test_license_reader .............. Passed 0.01 sec Start 7: test_license_locator 7/16 Test #7: test_license_locator ............. Passed 0.01 sec Start 8: test_event_registry 8/16 Test #8: test_event_registry .............. Passed 0.00 sec Start 9: test_network 9/16 Test #9: test_network .....................Failed 0.00 sec Start 10: test_execution_environment 10/16 Test #10: test_execution_environment ....... Passed 0.00 sec Start 11: test_hw_identifier 11/16 Test #11: test_hw_identifier ............... Passed 0.00 sec Start 12: test_crack 12/16 Test #12: test_crack .......................Failed 0.01 sec Start 13: test_date 13/16 Test #13: test_date ........................Failed 0.02 sec Start 14: test_it_hw_identifier 14/16 Test #14: test_it_hw_identifier ............Failed 0.02 sec Start 15: test_standard_license 15/16 Test #15: test_standard_license ............***Failed 0.02 sec Start 16: test_signature_verifier 16/16 Test #16: test_signature_verifier .......... Passed 0.02 sec

69% tests passed, 5 tests failed out of 16

Total Test time (real) = 0.30 sec

The following tests FAILED: 9 - test_network (Failed) 12 - test_crack (Failed) 13 - test_date (Failed) 14 - test_it_hw_identifier (Failed) 15 - test_standard_license (Failed) Errors while running CTest Makefile:151: recipe for target 'test' failed make: *** [test] Error 8

*** buffer overflow detected ***: /home/nyue/projects/Open-License-Manager/OLM/build/test/library/os/test_network terminated *** buffer overflow detected ***: /home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_it_hw_identifier terminated *** buffer overflow detected ***: /home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_it_hw_identifier terminated

gcontini commented 4 years ago

I guess it's related to your environment, because tests are running fine on travis. Can you send me the output of :

ifconfig

can you define the preprocessor macro _DEBUG and send me the output of the test?

also try to execute each failing test one by one and see the output.

nyue commented 4 years ago

OS : Ubuntu 18.04 LTS GCC : 7.5.0

Build warnings

[ 47%] Building CXX object src/library/os/CMakeFiles/os.dir/linux/network.cpp.o
cd /home/nyue/projects/Open-License-Manager/OLM/build/src/library/os && /usr/bin/c++   -I/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/include/licensecc/CleanSlate -I/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/include  -D_DEBUG -O3 -DNDEBUG   -std=gnu++11 -o CMakeFiles/os.dir/linux/network.cpp.o -c /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/src/library/os/linux/network.cpp
In file included from /usr/include/string.h:494:0,
                 from /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/src/library/os/linux/network.cpp:28:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘FUNCTION_RETURN license::os::getAdapterInfos(std::vector<license::os::OsAdapterInfo>&)’ at /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/src/library/os/linux/network.cpp:71:11:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:71: warning: ‘char* __builtin___strncpy_chk(char*, const char*, long unsigned int, long unsigned int)’: specified bound 1025 exceeds the size 1024 of the destination [-Wstringop-overflow=]
   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
                                                                       ^

ifconfig

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.10  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::a8e3:6b9a:629d:c8ba  prefixlen 64  scopeid 0x20<link>
        ether 2c:41:38:aa:07:be  txqueuelen 1000  (Ethernet)
        RX packets 206852  bytes 217979403 (217.9 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 97725  bytes 14333798 (14.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xfb000000-fb020000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6765  bytes 645494 (645.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6765  bytes 645494 (645.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Individual failing tests

test/functional/test_crack

Running 1 test case...
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "test_bad_magic_number": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATE]
EventReg[step:3,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_crack.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:8,sev:2ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic]]

test/functional/test_date

Running 2 test cases...
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/not_expired.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate -e 2050-10-10
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "license_not_expired": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATEvalid-to2050-10-10]
EventReg[step:3,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_date.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/not_expired.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/not_expired.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/not_expired.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/not_expired.lic]]
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate -e 2013-10-10
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "license_expired": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATEvalid-to2013-10-10]
EventReg[step:3,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_date.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic][ev:7,sev:2ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/expired.lic]]

*** 2 failures are detected in the test module "test_date"

test/functional/test_it_hw_identifier

Running 4 test cases...
Identifier:AFKr-lQl8-a2M=
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate -s AFKr-lQl8-a2M=
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "volid_lic_file": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATEclient-signatureAFKr-lQl8-a2M=]
EventReg[step:4,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_it_hw_identifier.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic][ev:0,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volid_lic_file.lic]]
Identifier:AHJv-b3QA-AAA=
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate -s AHJv-b3QA-AAA=
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "volume_name_lic_file": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATEclient-signatureAHJv-b3QA-AAA=]
EventReg[step:4,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_it_hw_identifier.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic][ev:0,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/volume_name_lic_file.lic]]
*** buffer overflow detected ***: ./test/functional/test_it_hw_identifier terminated
unknown location(0): fatal error: in "strategy_mac_address": signal: SIGABRT (application abort requested)
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/hw_identifier_it_test.cpp(72): last checkpoint: "strategy_mac_address" test entry
*** buffer overflow detected ***: ./test/functional/test_it_hw_identifier terminated
unknown location(0): fatal error: in "strategy_ip_address": signal: SIGABRT (application abort requested)
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/hw_identifier_it_test.cpp(83): last checkpoint: "strategy_ip_address" test entry

*** 4 failures are detected in the test module "integration_test_hw_identifier"

test/functional/test_standard_license

Running 2 test cases...
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "test_generic_license_read_file": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATE]
EventReg[step:3,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_standard_license.lic][ev:100,sev:0ref:ExternalDefinition][ev:100,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:101,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:102,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic][ev:103,sev:0ref:/home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license.lic]]
executing :/home/nyue/projects/Open-License-Manager/OLM/build/extern/license-generator/src/license_generator/lccgen license issue --primary-key /home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/projects/CleanSlate/private_key.rsa --output-file-name /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate/licenses/standard_license1.lic --project-folder /home/nyue/projects/Open-License-Manager/OLM/build/Testing/Temporary/CleanSlate
base64not recognized value error
License written 
/home/nyue/projects/Open-License-Manager/OLM/Open-License-Manager_git/test/functional/generate-license.cpp(56): error: in "test_read_license_data": check sectionSize > 0 has failed [-1 <= 0]
license to sign [CLEANSLATE]
EventReg[step:3,events:{[ev:1,sev:1ref:/home/nyue/projects/Open-License-Manager/OLM/build/test/functional/test_standard_license.lic][ev:100,sev:0ref:ExternalDefinition][ev:102,sev:0ref:ExternalDefinition][ev:103,sev:0ref:ExternalDefinition]]

*** 2 failures are detected in the test module "test_standard_license"
gcontini commented 4 years ago

Found it. Thanks so much for reporting. The problem appears if you specify a project name at the project configuration step... if you leave the default tests are OK. Maybe is just some test configuration. I'll fix it anyway.