Skip to content

Commit 48ec07f

Browse files
author
Samat Gaynutdinov
committed
fix for lcov generation for c/cpp
1 parent c9abeca commit 48ec07f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/src/printers/NativeMakefilePrinter.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,13 @@ namespace printer {
354354
fs::path testExecutablePath = getTestExecutablePath(sourcePath);
355355

356356
auto rootLinkUnitInfo = buildDatabase->getClientLinkUnitInfo(rootPath);
357-
declareTarget("bin", { FORCE }, { stringFormat("echo %s", sharedOutput.value()) });
357+
358+
fs::path coverageInfoBinary = sharedOutput.value();
359+
if (!Paths::isLibraryFile(coverageInfoBinary)) {
360+
coverageInfoBinary = testExecutablePath.string();
361+
}
362+
363+
declareTarget("bin", { FORCE }, { stringFormat("echo %s", coverageInfoBinary) });
358364

359365
utbot::RunCommand testRunCommand{ { testExecutablePath.string(), "$(GTEST_FLAGS)" },
360366
buildDirectory };
@@ -406,7 +412,7 @@ namespace printer {
406412
fs::path recompiledFile =
407413
Paths::getRecompiledFile(projectContext, linkUnitInfo->getOutput());
408414
if (isExecutable) {
409-
recompiledFile = Paths::isObjectFile(Paths::addExtension(recompiledFile, ".o")) ?
415+
recompiledFile = Paths::isObjectFile(recompiledFile) ?
410416
recompiledFile : Paths::addExtension(recompiledFile, ".o");
411417
} else if (Paths::isSharedLibraryFile(unitFile)) {
412418
recompiledFile = getSharedLibrary(linkUnitInfo->getOutput());

0 commit comments

Comments
 (0)