Skip to content

Fix coverage generation #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions server/src/printers/NativeMakefilePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ namespace printer {
fs::path testExecutablePath = getTestExecutablePath(sourcePath);

auto rootLinkUnitInfo = buildDatabase->getClientLinkUnitInfo(rootPath);
declareTarget("bin", { FORCE }, { stringFormat("echo %s", sharedOutput.value()) });

fs::path coverageInfoBinary = sharedOutput.value();
if (!Paths::isLibraryFile(coverageInfoBinary)) {
coverageInfoBinary = testExecutablePath.string();
}

declareTarget("bin", { FORCE }, { stringFormat("echo %s", coverageInfoBinary) });

utbot::RunCommand testRunCommand{ { testExecutablePath.string(), "$(GTEST_FLAGS)" },
buildDirectory };
Expand Down Expand Up @@ -406,7 +412,7 @@ namespace printer {
fs::path recompiledFile =
Paths::getRecompiledFile(projectContext, linkUnitInfo->getOutput());
if (isExecutable) {
recompiledFile = Paths::isObjectFile(Paths::addExtension(recompiledFile, ".o")) ?
recompiledFile = Paths::isObjectFile(recompiledFile) ?
recompiledFile : Paths::addExtension(recompiledFile, ".o");
} else if (Paths::isSharedLibraryFile(unitFile)) {
recompiledFile = getSharedLibrary(linkUnitInfo->getOutput());
Expand Down