Skip to content

Don't create files outside of project and add skipping flags #643

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
Sep 19, 2023
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
17 changes: 16 additions & 1 deletion server/src/KleeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,21 @@ static std::string getUTBotClangCompilerPath(fs::path clientCompilerPath) {
}
}

static const std::unordered_set <std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = {
static const std::unordered_set<std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = {
"--coverage",
"-lgcov",
"-ftest-coverage",
"-fprofile-abs-path",
"-fprofile-dir",
"-fprofile-generate",
"-fprofile-info-section",
"-fprofile-note",
"-fprofile-prefix-path",
"-fprofile-prefix-map",
"-fprofile-update",
"-fprofile-filter-files",
"-fprofile-exclude-files",
"-fprofile-reproducible",
"-fbranch-target-load-optimize",
"-fcx-fortran-rules",
"-fipa-cp-clone",
Expand All @@ -114,6 +126,9 @@ static const std::unordered_set <std::string> UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE
"-fno-tree-sinkclang-10",
"-fpredictive-commoning",
"-fprofile-dir",
"-fprofile-arcs",
"-p",
"-pg",
"-freschedule-modulo-scheduled-loops",
"-fsched2-use-superblocks",
"-fsel-sched-reschedule-pipelined",
Expand Down
2 changes: 1 addition & 1 deletion server/src/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Paths {
}

fs::path getCCJsonFileFullPath(const std::string &filename, const fs::path &directory) {
fs::path path1 = fs::path(filename);
fs::path path1(filename);
fs::path path2 = fs::weakly_canonical(directory / path1);
return fs::exists(path2) ? path2 : path1;
}
Expand Down
14 changes: 12 additions & 2 deletions server/src/building/ProjectBuildDatabse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ ProjectBuildDatabase::ProjectBuildDatabase(fs::path _buildCommandsJsonPath,
fillTargetInfoParents();
createClangCompileCommandsJson();
} catch (const std::exception &e) {
LOG_S(ERROR) << e.what();
return;
}
}
Expand Down Expand Up @@ -90,8 +91,17 @@ void ProjectBuildDatabase::initObjects(const nlohmann::json &compileCommandsJson
continue;
}

fs::path kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, projectContext.projectPath,
Paths::getUTBotFiles(projectContext));
fs::path kleeFilePathTemplate;
if (Paths::isSubPathOf(projectContext.projectPath, sourceFile)) {
kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, projectContext.projectPath,
Paths::getUTBotFiles(projectContext));
} else {
LOG_S(WARNING)
<< "Source file " << sourceFile << " outside of project root " << projectContext.projectPath;
kleeFilePathTemplate = Paths::createNewDirForFile(sourceFile, fs::path("/"),
Paths::getUTBotFiles(projectContext) / "outside_of_project");
}

fs::path kleeFile = Paths::addSuffix(kleeFilePathTemplate, "_klee");
objectInfo->kleeFilesInfo = std::make_shared<KleeFilesInfo>(kleeFile);

Expand Down