Skip to content

Commit

Permalink
[feature](coverage): refresh the coverage file before exiting the pro…
Browse files Browse the repository at this point in the history
…gram
  • Loading branch information
feifeifeimoon committed Dec 20, 2023
1 parent 8f175f9 commit 586f324
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ set(BUILD_SHARED_LIBS OFF)

option(ENABLE_CLANG_COVERAGE "coverage option" OFF)
if (ENABLE_CLANG_COVERAGE AND ENABLE_CLANG_COVERAGE STREQUAL ON AND COMPILER_CLANG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping -DLLVM_PROFILE")
endif ()

if (${MAKE_TEST} STREQUAL "ON")
Expand Down
7 changes: 6 additions & 1 deletion be/src/service/doris_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static void help(const char*);

extern "C" {
void __lsan_do_leak_check();
int __llvm_profile_write_file();
}

namespace doris {
Expand Down Expand Up @@ -549,7 +550,11 @@ int main(int argc, char** argv) {
#endif
sleep(10);
}

LOG(INFO) << "Doris main exiting.";
#if defined(LLVM_PROFILE)
__llvm_profile_write_file();
LOG(INFO) << "Flush profile file.";
#endif
doris::TabletSchemaCache::stop_and_join();
http_service.stop();
brpc_service.join();
Expand Down

0 comments on commit 586f324

Please sign in to comment.