Skip to content

Commit 2ef9600

Browse files
committed
[refactoring] changed klee out directories for interactive mode
1 parent 0e59302 commit 2ef9600

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

server/src/KleeRunner.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,20 @@ void KleeRunner::runKlee(const std::vector<tests::TestMethod> &testMethods,
9393
std::move(writeFunctor));
9494
}
9595

96-
fs::path KleeRunner::getKleeMethodOutFile(const TestMethod &method) {
96+
fs::path KleeRunner::getKleeMethodOutDir(const TestMethod &method) {
9797
fs::path kleeOutDir = Paths::getKleeOutDir(projectTmpPath);
9898
fs::path relative =
9999
Paths::removeExtension(fs::relative(method.sourceFilePath, projectContext.projectPath));
100100
return kleeOutDir / relative / ("klee_out_" + method.methodName);
101101
}
102102

103+
fs::path KleeRunner::getKleeFileOutDir(const fs::path &filepath) {
104+
fs::path kleeOutDir = Paths::getKleeOutDir(projectTmpPath);
105+
fs::path relative = Paths::removeExtension(fs::relative(filepath, projectContext.projectPath));
106+
return kleeOutDir / relative / ("klee_out_" + Paths::removeExtension(filepath.filename()).string());
107+
}
108+
109+
103110
namespace {
104111
void clearUnusedData(const fs::path &kleeDir) {
105112
fs::remove(kleeDir / "assembly.ll");
@@ -198,7 +205,7 @@ void KleeRunner::processBatchWithoutInteractive(MethodKtests &ktestChunk,
198205

199206
std::string entryPoint = KleeUtils::entryPointFunction(tests, testMethod.methodName, true);
200207
std::string entryPointFlag = StringUtils::stringFormat("--entry-point=%s", entryPoint);
201-
auto kleeOut = getKleeMethodOutFile(testMethod);
208+
auto kleeOut = getKleeMethodOutDir(testMethod);
202209
fs::create_directories(kleeOut.parent_path());
203210
std::string outputDir = "--output-dir=" + kleeOut.string();
204211
std::vector<std::string> argvData = { "klee",
@@ -259,7 +266,7 @@ void KleeRunner::processBatchWithInteractive(const std::vector<tests::TestMethod
259266
TestMethod testMethod = testMethods[0];
260267
std::string entryPoint = KleeUtils::entryPointFunction(tests, testMethod.methodName, true);
261268
std::string entryPointFlag = StringUtils::stringFormat("--entry-point=%s", entryPoint);
262-
auto kleeOut = getKleeMethodOutFile(testMethod);
269+
auto kleeOut = getKleeFileOutDir(tests.sourceFilePath);
263270
fs::create_directories(kleeOut.parent_path());
264271

265272
fs::path entrypoints = kleeOut.parent_path() / "entrypoints.txt";

server/src/KleeRunner.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class KleeRunner {
4949
void processBatchWithInteractive(const std::vector<tests::TestMethod> &testMethods,
5050
tests::Tests &tests,
5151
std::vector<tests::MethodKtests> &ktests);
52-
fs::path getKleeMethodOutFile(const tests::TestMethod &method);
52+
fs::path getKleeMethodOutDir(const tests::TestMethod &method);
53+
fs::path getKleeFileOutDir(const fs::path &filepath);
5354
};
5455

5556

0 commit comments

Comments
 (0)