@@ -56,6 +56,7 @@ option(TONLIB_ENABLE_JNI "Use \"ON\" to enable JNI-compatible TonLib API.")
5656option (TON_USE_ASAN "Use \" ON\" to enable AddressSanitizer." OFF )
5757option (TON_USE_TSAN "Use \" ON\" to enable ThreadSanitizer." OFF )
5858option (TON_USE_UBSAN "Use \" ON\" to enable UndefinedBehaviorSanitizer." OFF )
59+ option (TON_USE_COVERAGE "Use \" ON\" to enable code coverage with gcov." OFF )
5960set (TON_ARCH "native" CACHE STRING "Architecture, will be passed to -march=" )
6061
6162option (TON_PRINT_BACKTRACE_ON_CRASH "Attempt to print a backtrace when a fatal signal is caught" ON )
@@ -251,7 +252,7 @@ elseif (CLANG OR GCC)
251252 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL" )
252253 endif ()
253254 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
254- if (NOT TON_USE_ASAN AND NOT TON_USE_TSAN AND NOT MEMPROF)
255+ if (NOT TON_USE_ASAN AND NOT TON_USE_TSAN AND NOT TON_USE_COVERAGE AND NOT MEMPROF)
255256 if (NOT USE_EMSCRIPTEN)
256257 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--exclude-libs,ALL" )
257258 endif ()
@@ -337,6 +338,18 @@ endif()
337338if (TON_USE_UBSAN)
338339 add_cxx_compiler_flag("-fsanitize=undefined" )
339340endif ()
341+ if (TON_USE_COVERAGE)
342+ add_cxx_compiler_flag("-fprofile-arcs" )
343+ add_cxx_compiler_flag("-ftest-coverage" )
344+ add_cxx_compiler_flag("--coverage" )
345+ add_cxx_compiler_flag("-O0" )
346+ add_cxx_compiler_flag("-g" )
347+ add_cxx_compiler_flag("-fno-inline" )
348+ add_cxx_compiler_flag("-fno-inline-small-functions" )
349+ add_cxx_compiler_flag("-fno-default-inline" )
350+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage --coverage" )
351+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage --coverage" )
352+ endif ()
340353#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
341354#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
342355#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
@@ -554,6 +567,7 @@ add_test(test-cells test-cells ${TEST_OPTIONS})
554567add_test (test -smartcont test -smartcont)
555568add_test (test -net test -net)
556569add_test (test -actors test -tdactor)
570+ add_test (test -actors-coro tdactor/test /test -coro)
557571add_test (test -emulator test -emulator)
558572
559573#BEGIN tonlib
0 commit comments