Skip to content

Commit acb5313

Browse files
authored
Don't create files outside of project and add skipping flags (#643)
1 parent 56bbd54 commit acb5313

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

server/src/KleeGenerator.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,21 @@ static std::string getUTBotClangCompilerPath(fs::path clientCompilerPath) {
9797
}
9898
}
9999

100-
static const std::unordered_set <std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = {
100+
static const std::unordered_set<std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = {
101101
"--coverage",
102102
"-lgcov",
103+
"-ftest-coverage",
104+
"-fprofile-abs-path",
105+
"-fprofile-dir",
106+
"-fprofile-generate",
107+
"-fprofile-info-section",
108+
"-fprofile-note",
109+
"-fprofile-prefix-path",
110+
"-fprofile-prefix-map",
111+
"-fprofile-update",
112+
"-fprofile-filter-files",
113+
"-fprofile-exclude-files",
114+
"-fprofile-reproducible",
103115
"-fbranch-target-load-optimize",
104116
"-fcx-fortran-rules",
105117
"-fipa-cp-clone",
@@ -114,6 +126,9 @@ static const std::unordered_set <std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE
114126
"-fno-tree-sinkclang-10",
115127
"-fpredictive-commoning",
116128
"-fprofile-dir",
129+
"-fprofile-arcs",
130+
"-p",
131+
"-pg",
117132
"-freschedule-modulo-scheduled-loops",
118133
"-fsched2-use-superblocks",
119134
"-fsel-sched-reschedule-pipelined",

server/src/Paths.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace Paths {
114114
}
115115

116116
fs::path getCCJsonFileFullPath(const std::string &filename, const fs::path &directory) {
117-
fs::path path1 = fs::path(filename);
117+
fs::path path1(filename);
118118
fs::path path2 = fs::weakly_canonical(directory / path1);
119119
return fs::exists(path2) ? path2 : path1;
120120
}

server/src/building/ProjectBuildDatabse.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ ProjectBuildDatabase::ProjectBuildDatabase(fs::path _buildCommandsJsonPath,
5151
fillTargetInfoParents();
5252
createClangCompileCommandsJson();
5353
} catch (const std::exception &e) {
54+
LOG_S(ERROR) << e.what();
5455
return;
5556
}
5657
}
@@ -90,8 +91,17 @@ void ProjectBuildDatabase::initObjects(const nlohmann::json &compileCommandsJson
9091
continue;
9192
}
9293

93-
fs::path kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, projectContext.projectPath,
94-
Paths::getUTBotFiles(projectContext));
94+
fs::path kleeFilePathTemplate;
95+
if (Paths::isSubPathOf(projectContext.projectPath, sourceFile)) {
96+
kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, projectContext.projectPath,
97+
Paths::getUTBotFiles(projectContext));
98+
} else {
99+
LOG_S(WARNING)
100+
<< "Source file " << sourceFile << " outside of project root " << projectContext.projectPath;
101+
kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, fs::path("/"),
102+
Paths::getUTBotFiles(projectContext) / "outside_of_project");
103+
}
104+
95105
fs::path kleeFile = Paths::addSuffix(kleeFilePathTemplate, "_klee");
96106
objectInfo->kleeFilesInfo = std::make_shared<KleeFilesInfo>(kleeFile);
97107

0 commit comments

Comments
 (0)