diff --git a/server/src/KleeRunner.cpp b/server/src/KleeRunner.cpp index 3c3443e7..1ceb40e2 100644 --- a/server/src/KleeRunner.cpp +++ b/server/src/KleeRunner.cpp @@ -45,7 +45,7 @@ void KleeRunner::runKlee(const std::vector &testMethods, fileToMethods[method.sourceFilePath].push_back(method); } - nlohmann::json sarifResults; + nlohmann::json sarifResults = nlohmann::json::array(); std::function prepareTests = [&](tests::Tests &tests) { fs::path filePath = tests.sourceFilePath; diff --git a/server/src/SARIFGenerator.cpp b/server/src/SARIFGenerator.cpp index 437a2b59..790a50dc 100644 --- a/server/src/SARIFGenerator.cpp +++ b/server/src/SARIFGenerator.cpp @@ -35,7 +35,7 @@ namespace sarif { } ++p; } - if (foundStartFragment && p == path.end()) { + if (p == path.end()) { while (s != src.end()) { relToProject = relToProject / *s; ++s; @@ -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)) { @@ -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; } } } diff --git a/server/src/streams/tests/CLITestsWriter.cpp b/server/src/streams/tests/CLITestsWriter.cpp index a7ff301e..285500fc 100644 --- a/server/src/streams/tests/CLITestsWriter.cpp +++ b/server/src/streams/tests/CLITestsWriter.cpp @@ -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); diff --git a/server/src/streams/tests/CLITestsWriter.h b/server/src/streams/tests/CLITestsWriter.h index e784c693..a5b176ab 100644 --- a/server/src/streams/tests/CLITestsWriter.h +++ b/server/src/streams/tests/CLITestsWriter.h @@ -16,6 +16,10 @@ class CLITestsWriter : public TestsWriter { std::function &&prepareTests, std::function &&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); };