diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-02-03 16:13:22 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-02-06 20:21:27 +0000 |
commit | 835b9fbdc933878a744cd6ba1c77942610f4fe06 (patch) | |
tree | da7286c8a8f00106eb92bf53701c8711b20612ff /CMakeLists.txt | |
parent | feaefbcbb3ab5bd3fe7dc963d6f963669673fadc (diff) |
Improve stability of crypto_memcmp test.
Also reduce number of people in conference to 5, because on Circle CI the
test times out trying to connect more than 6 or 7 people. The persistent
conferences PR will improve this so we can set it much higher then.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 542f151d..8cd5bae6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -429,7 +429,49 @@ install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox) | |||
429 | 429 | ||
430 | ################################################################################ | 430 | ################################################################################ |
431 | # | 431 | # |
432 | # :: Automated regression tests | 432 | # :: Unit tests: no networking, just pure function calls. |
433 | # | ||
434 | ################################################################################ | ||
435 | |||
436 | # Compile the GTest library. | ||
437 | # | ||
438 | if(EXISTS "/usr/src/gtest/src/gtest-all.cc") | ||
439 | add_library(gtest | ||
440 | /usr/src/gtest/src/gtest-all.cc | ||
441 | /usr/src/gtest/src/gtest_main.cc) | ||
442 | target_include_directories(gtest PRIVATE /usr/src/gtest) | ||
443 | check_cxx_compiler_flag("-w" HAVE_CXX_W QUIET) | ||
444 | check_cxx_compiler_flag("-Wno-global-constructors" HAVE_CXX_W_NO_GLOBAL_CONSTRUCTORS QUIET) | ||
445 | check_cxx_compiler_flag("-Wno-zero-as-null-pointer-constant" HAVE_CXX_W_NO_ZERO_AS_NULL_POINTER_CONSTANT QUIET) | ||
446 | if(HAVE_CXX_W) | ||
447 | set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w") | ||
448 | endif() | ||
449 | set(HAVE_GTEST TRUE) | ||
450 | endif() | ||
451 | |||
452 | function(unit_test subdir target) | ||
453 | if(HAVE_GTEST) | ||
454 | add_executable(unit_${target}_test ${subdir}/${target}_test.cpp) | ||
455 | target_link_modules(unit_${target}_test ${toxcore_SUBLIBS} gtest) | ||
456 | set(gtest_CFLAGS "") | ||
457 | if(HAVE_CXX_W_NO_GLOBAL_CONSTRUCTORS) | ||
458 | set(gtest_CFLAGS "${gtest_CFLAGS} -Wno-global-constructors") | ||
459 | endif() | ||
460 | if(HAVE_CXX_W_NO_ZERO_AS_NULL_POINTER_CONSTANT) | ||
461 | set(gtest_CFLAGS "${gtest_CFLAGS} -Wno-zero-as-null-pointer-constant") | ||
462 | endif() | ||
463 | set_target_properties(unit_${target}_test PROPERTIES COMPILE_FLAGS "${gtest_CFLAGS}") | ||
464 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} unit_${target}_test) | ||
465 | endif() | ||
466 | endfunction() | ||
467 | |||
468 | # The actual unit tests follow. | ||
469 | # | ||
470 | unit_test(toxcore crypto_core) | ||
471 | |||
472 | ################################################################################ | ||
473 | # | ||
474 | # :: Automated regression tests: create a tox network and run integration tests | ||
433 | # | 475 | # |
434 | ################################################################################ | 476 | ################################################################################ |
435 | 477 | ||