Skip to content

Commit db0fdcf

Browse files
Samat Gaynutdinovantipeon
authored andcommitted
fix for lcov generation for c/cpp
1 parent db439f4 commit db0fdcf

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
@@ -355,7 +355,13 @@ namespace printer {
355355
fs::path testExecutablePath = getTestExecutablePath(sourcePath);
356356

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

360366
utbot::RunCommand testRunCommand{ { testExecutablePath.string(), "$(GTEST_FLAGS)" },
361367
buildDirectory };
@@ -407,7 +413,7 @@ namespace printer {
407413
fs::path recompiledFile =
408414
Paths::getRecompiledFile(projectContext, linkUnitInfo->getOutput());
409415
if (isExecutable) {
410-
recompiledFile = Paths::isObjectFile(Paths::addExtension(recompiledFile, ".o")) ?
416+
recompiledFile = Paths::isObjectFile(recompiledFile) ?
411417
recompiledFile : Paths::addExtension(recompiledFile, ".o");
412418
} else if (Paths::isSharedLibraryFile(unitFile)) {
413419
recompiledFile = getSharedLibrary(linkUnitInfo->getOutput());

0 commit comments

Comments
 (0)