Skip to content

[BUG] SARIF report is not recognized by github #352 #353

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
Jul 27, 2022
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/KleeRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void KleeRunner::runKlee(const std::vector<tests::TestMethod> &testMethods,
fileToMethods[method.sourceFilePath].push_back(method);
}

nlohmann::json sarifResults;
nlohmann::json sarifResults = nlohmann::json::array();

std::function<void(tests::Tests &tests)> prepareTests = [&](tests::Tests &tests) {
fs::path filePath = tests.sourceFilePath;
Expand Down
5 changes: 3 additions & 2 deletions server/src/SARIFGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace sarif {
}
++p;
}
if (foundStartFragment && p == path.end()) {
if (p == path.end()) {
while (s != src.end()) {
relToProject = relToProject / *s;
++s;
Expand Down Expand Up @@ -77,6 +77,7 @@ namespace sarif {
const fs::path &relPathInProject = getInProjectPath(projectContext.projectPath, srcPath);
const fs::path &fullPathInProject = projectContext.projectPath / relPathInProject;
if (Paths::isSubPathOf(projectContext.buildDir, fullPathInProject)) {
LOG_S(DEBUG) << "Full path " << fullPathInProject << " is in build - skip it";
continue;
}
if (!relPathInProject.empty() && fs::exists(fullPathInProject)) {
Expand Down Expand Up @@ -119,7 +120,7 @@ namespace sarif {
codeFlowsLocations["locations"].push_back(locationWrapper);
} else {
// the rest is the KLEE calls that are not applicable for navigation
LOG_S(INFO) << "Skip path in stack frame :" << srcPath;
LOG_S(DEBUG) << "Skip path in stack frame :" << srcPath;
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions server/src/streams/tests/CLITestsWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ void CLITestsWriter::writeTestsWithProgress(tests::TestsMap &testMap,
LOG_S(INFO) << "total test files generated: " << totalTestsCounter;
}

void CLITestsWriter::writeReport(const std::string &content,
const std::string &message,
const fs::path &pathToStore) const {
TestsWriter::writeReport(content, message, pathToStore);
LOG_S(INFO) << message;
}

bool CLITestsWriter::writeTestFile(const tests::Tests &tests, const fs::path &testDirPath) {
fs::path testFilePath = testDirPath / tests.relativeFileDir / tests.testFilename;
FileSystemUtils::writeToFile(testFilePath, tests.code);
Expand Down
4 changes: 4 additions & 0 deletions server/src/streams/tests/CLITestsWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class CLITestsWriter : public TestsWriter {
std::function<void(tests::Tests &)> &&prepareTests,
std::function<void()> &&prepareTotal) override;

void writeReport(const std::string &content,
const std::string &message,
const fs::path &pathToStore) const override;

private:
static bool writeTestFile(const tests::Tests &tests, const fs::path &testDirPath);
};
Expand Down