Conversation
| return { "-g", "--coverage" }; | ||
| case CompilerName::CLANG: | ||
| case CompilerName::CLANGXX: | ||
| return { "-fprofile-instr-generate", "-fcoverage-mapping" }; | ||
| return { "-g", "-fprofile-instr-generate", "-fcoverage-mapping" }; |
There was a problem hiding this comment.
No need to add "-g" option since it is already added in Makefile
|
|
||
|
|
||
| static void addLine(uint32_t lineNumber, bool covered, FileCoverage &fileCoverage) { | ||
| assert(lineNumber > 0); |
There was a problem hiding this comment.
Rather than calling the assert function which causes server to crash, please throw an exception
| std::string pathToReport = ""; | ||
| for (const auto &entry: fs::directory_iterator(coverageReportDirPath.string())) { | ||
| std::regex reg("(calc.).*$"); | ||
| if (std::regex_search(entry.path().string(), reg)) { | ||
| pathToReport = entry.path().string() + "/cov.xml"; | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
Let's extract this block to private method getPathToReport
| target_link_libraries(utbot PUBLIC | ||
| UnitTestBotLib | ||
| loguru | ||
| pugixml ######### |
There was a problem hiding this comment.
No need to link with pugixml again since it is already linked to UnitTestBotLib. The same practice should be applicable to loguru library
| PUBLIC | ||
| gtest | ||
| UnitTestBotLib | ||
| pugixml |
There was a problem hiding this comment.
See the comment related to utbot target
|
|
||
| std::string pathToReport = ""; | ||
| for (const auto &entry: fs::directory_iterator(coverageReportDirPath.string())) { | ||
| std::regex reg("(calc.).*$"); |
There was a problem hiding this comment.
You can avoid building std::regex object every single time and construct the corresponding object just once per program, say, declaring it as a global const static variable
| declareTarget("bin", { FORCE }, { stringFormat("echo %s", coverageInfoBinary) }); | ||
|
|
||
| utbot::RunCommand testRunCommand{ { testExecutablePath.string(), "$(GTEST_FLAGS)" }, | ||
| std::string kcovRunCommand = "kcov " + (projectContext.buildDir.string() + "/report ") + testExecutablePath.string(); |
There was a problem hiding this comment.
Please reuse getKcovReportDir here
No description provided.