Skip to content

Commit de94ec6

Browse files
author
Vladislav Kalugin
committed
Fixing generations for files that included in two targets
1 parent ad2f0dc commit de94ec6

File tree

17 files changed

+444
-114
lines changed

17 files changed

+444
-114
lines changed

server/src/KleeGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ std::vector<fs::path> KleeGenerator::buildKleeFiles(const tests::TestsMap &tests
245245
return;
246246
}
247247
kleePrinter.srcLanguage = Paths::getSourceLanguage(filename);
248-
auto includeFlags = { StringUtils::stringFormat("-I%s",
248+
std::vector<std::string> includeFlags = { StringUtils::stringFormat("-I%s",
249249
Paths::getFlagsDir(projectContext)) };
250250
auto buildDirPath =
251251
buildDatabase->getClientCompilationUnitInfo(filename)->getDirectory();

server/src/Paths.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Paths {
2828
CollectionUtils::FileSet filtered =
2929
CollectionUtils::filterOut(paths, [&dirPaths, &filter](const fs::path &path) {
3030
return !std::any_of(dirPaths.begin(), dirPaths.end(), [&](const fs::path &dirPath) {
31-
return path.parent_path() == dirPath && fs::exists(path) && filter(path);
31+
return isSubPathOf(dirPath, path) && fs::exists(path) && filter(path);
3232
});
3333
});
3434
return filtered;

server/src/Server.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@ Status Server::TestsGenServiceImpl::ProcessBaseTestRequest(BaseTestGen &testGen,
209209
Synchronizer synchronizer(&testGen, &stubGen, &sizeContext);
210210
synchronizer.synchronize(typesHandler);
211211

212-
if(testGen.settingsContext.useStubs) {
213-
testsWriter->writeStubs(testGen.synchronizedStubs);
214-
}
215-
216212
std::shared_ptr<LineInfo> lineInfo = nullptr;
217213
auto lineTestGen = dynamic_cast<LineTestGen *>(&testGen);
218214

server/src/building/BaseCommand.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include "tasks/ShellExecTask.h"
88
#include "utils/CollectionUtils.h"
99
#include "utils/StringUtils.h"
10+
#include "utils/path/FileSystemPath.h"
1011

1112
#include "loguru.h"
1213

1314
#include <algorithm>
14-
#include "utils/path/FileSystemPath.h"
1515
#include <iterator>
1616
#include <set>
1717
#include <utility>
@@ -21,6 +21,7 @@ namespace utbot {
2121
: commandLine(std::move(commandLine)), directory(std::move(directory)) {
2222
initOptimizationLevel();
2323
}
24+
2425
BaseCommand::BaseCommand(std::vector<std::string> commandLine, fs::path directory)
2526
: commandLine(commandLine.begin(), commandLine.end()), directory(std::move(directory)) {
2627
initOptimizationLevel();

server/src/building/Linker.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,13 @@ Result<Linker::LinkResult> Linker::linkWholeTarget(const fs::path &target) {
151151
insideFolder = false;
152152
}
153153
}
154-
if (testGen.buildDatabase->isFirstObjectFileForSource(objectFile) &&
155-
!CollectionUtils::contains(testedFiles, objectInfo->getSourcePath()) &&
156-
insideFolder) {
157-
filesToLink.insert(
158-
{ objectFile, objectInfo->kleeFilesInfo->getKleeBitcodeFile() });
154+
if (!CollectionUtils::contains(testedFiles, objectInfo->getSourcePath()) && insideFolder) {
155+
fs::path bitcodeFile = objectInfo->kleeFilesInfo->getKleeBitcodeFile();
156+
filesToLink.emplace(objectFile, std::move(bitcodeFile));
159157
} else {
158+
fs::path bitcodeFile = testGen.buildDatabase->getBitcodeForSource(objectInfo->getSourcePath());
160159
siblingObjectsToBuild.insert(objectInfo->getOutputFile());
161-
fs::path bitcodeFile =
162-
testGen.buildDatabase->getBitcodeForSource(objectInfo->getSourcePath());
163-
filesToLink.emplace(objectFile, bitcodeFile);
160+
filesToLink.emplace(objectFile, std::move(bitcodeFile));
164161
}
165162
}
166163

@@ -669,7 +666,7 @@ Linker::getLinkActionsForExecutable(fs::path const &workingDir,
669666
CollectionUtils::MapFileTo<fs::path> const &dependencies,
670667
BuildDatabase::TargetInfo const &linkUnitInfo,
671668
fs::path const &output) {
672-
669+
673670
using namespace DynamicLibraryUtils;
674671

675672
auto commands = CollectionUtils::transform(

server/test/framework/Server_Tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,10 +1520,10 @@ namespace {
15201520
}
15211521
};
15221522

1523-
const std::vector<ProjectInfo> testRelativeDirs = { { fs::path("executable"), 3 },
1524-
{ fs::path("static_library"), 3 },
1525-
{ fs::path("shared_library"), 3 },
1526-
{ fs::path("timeout"), 1 } };
1523+
const std::vector<ProjectInfo> testRelativeDirs = { { fs::path("executable"), 6 },
1524+
{ fs::path("static_library"), 6 },
1525+
{ fs::path("shared_library"), 6 },
1526+
{ fs::path("timeout"), 2 } };
15271527

15281528
INSTANTIATE_TEST_SUITE_P(
15291529
DifferentCompilersAndSuites,

0 commit comments

Comments
 (0)