Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion server/src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Status Server::TestsGenServiceImpl::ProcessBaseTestRequest(BaseTestGen &testGen,
auto generator = std::make_shared<KleeGenerator>(&testGen, typesHandler, pathSubstitution);

ReturnTypesFetcher returnTypesFetcher{&testGen};
returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getSourceFiles());
returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getTargetSourceFiles());
LOG_S(DEBUG) << "Temporary build directory path: " << testGen.serverBuildDir;
generator->buildKleeFiles(testGen.tests, lineInfo);
generator->handleFailedFunctions(testGen.tests);
Expand Down
13 changes: 9 additions & 4 deletions server/src/Synchronizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool Synchronizer::isProbablyOutdated(const fs::path &srcFilePath) const {
}

CollectionUtils::FileSet Synchronizer::getOutdatedSourcePaths() const {
return CollectionUtils::filterOut(getSourceFiles(), [this](fs::path const &sourcePath) {
return CollectionUtils::filterOut(getTargetSourceFiles(), [this](fs::path const &sourcePath) {
return !isProbablyOutdated(sourcePath);
});
}
Expand Down Expand Up @@ -161,6 +161,7 @@ void Synchronizer::synchronizeStubs(StubSet &outdatedStubs,

fs::path ccJsonStubDirPath =
Paths::getUTBotBuildDir(testGen->projectContext) / "stubs_build_files";
// todo: is it needed?
auto stubsCdb = createStubsCompilationDatabase(stubFiles, ccJsonStubDirPath);

auto sourceToHeaderRewriter =
Expand Down Expand Up @@ -197,7 +198,7 @@ Synchronizer::createStubsCompilationDatabase(StubSet &stubFiles,

void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedSourcePaths) const {
auto sourceFilesNeedToRegenerateWrappers = outdatedSourcePaths;
for (fs::path const &sourceFilePath : getSourceFiles()) {
for (fs::path const &sourceFilePath : getTargetSourceFiles()) {
if (!CollectionUtils::contains(sourceFilesNeedToRegenerateWrappers, sourceFilePath)) {
auto wrapperFilePath =
Paths::getWrapperFilePath(testGen->projectContext, sourceFilePath);
Expand All @@ -217,10 +218,14 @@ void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedS
});
}

const CollectionUtils::FileSet &Synchronizer::getSourceFiles() const {
const CollectionUtils::FileSet &Synchronizer::getTargetSourceFiles() const {
return testGen->getTargetBuildDatabase()->compilationDatabase->getAllFiles();
}

const CollectionUtils::FileSet &Synchronizer::getProjectSourceFiles() const {
return testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles();
}

StubSet Synchronizer::getStubsFiles() const {
return getStubSetFromSources(testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles());
}
Expand All @@ -233,7 +238,7 @@ void Synchronizer::prepareDirectory(const fs::path &stubDirectory) {
if (!Paths::isHeaderFile(stubPath)) {
fs::path sourcePath =
Paths::stubPathToSourcePath(testGen->projectContext, stubPath);
if (!CollectionUtils::contains(getSourceFiles(), sourcePath)) {
if (!CollectionUtils::contains(getProjectSourceFiles(), sourcePath)) {
LOG_S(DEBUG) << "Found extra file in stub directory: " << stubPath
<< ". Removing it.";
fs::remove(stubPath);
Expand Down
3 changes: 2 additions & 1 deletion server/src/Synchronizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class Synchronizer {

void synchronize(const types::TypesHandler &typesHandler);

[[nodiscard]] const CollectionUtils::FileSet &getSourceFiles() const;
[[nodiscard]] const CollectionUtils::FileSet &getTargetSourceFiles() const;
[[nodiscard]] const CollectionUtils::FileSet &getProjectSourceFiles() const;
[[nodiscard]] std::unordered_set<StubOperator, HashUtils::StubHash> getStubsFiles() const;
};

Expand Down