Skip to content

Commit 2de5b52

Browse files
authored
No tests generated for function calling function from another module (#518)
1 parent 4682e25 commit 2de5b52

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

server/src/Server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Status Server::TestsGenServiceImpl::ProcessBaseTestRequest(BaseTestGen &testGen,
257257
auto generator = std::make_shared<KleeGenerator>(&testGen, typesHandler, pathSubstitution);
258258

259259
ReturnTypesFetcher returnTypesFetcher{&testGen};
260-
returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getSourceFiles());
260+
returnTypesFetcher.fetch(testGen.progressWriter, synchronizer.getTargetSourceFiles());
261261
LOG_S(DEBUG) << "Temporary build directory path: " << testGen.serverBuildDir;
262262
generator->buildKleeFiles(testGen.tests, lineInfo);
263263
generator->handleFailedFunctions(testGen.tests);

server/src/Synchronizer.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool Synchronizer::isProbablyOutdated(const fs::path &srcFilePath) const {
6565
}
6666

6767
CollectionUtils::FileSet Synchronizer::getOutdatedSourcePaths() const {
68-
return CollectionUtils::filterOut(getSourceFiles(), [this](fs::path const &sourcePath) {
68+
return CollectionUtils::filterOut(getTargetSourceFiles(), [this](fs::path const &sourcePath) {
6969
return !isProbablyOutdated(sourcePath);
7070
});
7171
}
@@ -161,6 +161,7 @@ void Synchronizer::synchronizeStubs(StubSet &outdatedStubs,
161161

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

166167
auto sourceToHeaderRewriter =
@@ -197,7 +198,7 @@ Synchronizer::createStubsCompilationDatabase(StubSet &stubFiles,
197198

198199
void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedSourcePaths) const {
199200
auto sourceFilesNeedToRegenerateWrappers = outdatedSourcePaths;
200-
for (fs::path const &sourceFilePath : getSourceFiles()) {
201+
for (fs::path const &sourceFilePath : getTargetSourceFiles()) {
201202
if (!CollectionUtils::contains(sourceFilesNeedToRegenerateWrappers, sourceFilePath)) {
202203
auto wrapperFilePath =
203204
Paths::getWrapperFilePath(testGen->projectContext, sourceFilePath);
@@ -217,10 +218,14 @@ void Synchronizer::synchronizeWrappers(const CollectionUtils::FileSet &outdatedS
217218
});
218219
}
219220

220-
const CollectionUtils::FileSet &Synchronizer::getSourceFiles() const {
221+
const CollectionUtils::FileSet &Synchronizer::getTargetSourceFiles() const {
221222
return testGen->getTargetBuildDatabase()->compilationDatabase->getAllFiles();
222223
}
223224

225+
const CollectionUtils::FileSet &Synchronizer::getProjectSourceFiles() const {
226+
return testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles();
227+
}
228+
224229
StubSet Synchronizer::getStubsFiles() const {
225230
return getStubSetFromSources(testGen->getProjectBuildDatabase()->compilationDatabase->getAllFiles());
226231
}
@@ -233,7 +238,7 @@ void Synchronizer::prepareDirectory(const fs::path &stubDirectory) {
233238
if (!Paths::isHeaderFile(stubPath)) {
234239
fs::path sourcePath =
235240
Paths::stubPathToSourcePath(testGen->projectContext, stubPath);
236-
if (!CollectionUtils::contains(getSourceFiles(), sourcePath)) {
241+
if (!CollectionUtils::contains(getProjectSourceFiles(), sourcePath)) {
237242
LOG_S(DEBUG) << "Found extra file in stub directory: " << stubPath
238243
<< ". Removing it.";
239244
fs::remove(stubPath);

server/src/Synchronizer.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class Synchronizer {
5656

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

59-
[[nodiscard]] const CollectionUtils::FileSet &getSourceFiles() const;
59+
[[nodiscard]] const CollectionUtils::FileSet &getTargetSourceFiles() const;
60+
[[nodiscard]] const CollectionUtils::FileSet &getProjectSourceFiles() const;
6061
[[nodiscard]] std::unordered_set<StubOperator, HashUtils::StubHash> getStubsFiles() const;
6162
};
6263

0 commit comments

Comments
 (0)