aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 33d62d4d..e34dd52d 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -179,14 +179,14 @@ namespace {
"the bytes, not necessarily making them concrete."));
cl::list<std::string>
- ReplayOutFile("replay-out",
- cl::desc("Specify an out file to replay"),
- cl::value_desc("out file"));
+ ReplayKTestFile("replay-ktest-file",
+ cl::desc("Specify a ktest file to use for replay"),
+ cl::value_desc("ktest file"));
cl::list<std::string>
- ReplayOutDir("replay-out-dir",
- cl::desc("Specify a directory to replay .out files from"),
- cl::value_desc("output directory"));
+ ReplayKTestDir("replay-ktest-dir",
+ cl::desc("Specify a directory to replay ktest files from"),
+ cl::value_desc("output directory"));
cl::opt<std::string>
ReplayPathFile("replay-path",
@@ -265,8 +265,8 @@ public:
static void loadPathFile(std::string name,
std::vector<bool> &buffer);
- static void getOutFiles(std::string path,
- std::vector<std::string> &results);
+ static void getKTestFilesInDir(std::string directoryPath,
+ std::vector<std::string> &results);
static std::string getRunTimeLibraryPath(const char *argv0);
};
@@ -562,14 +562,15 @@ void KleeHandler::loadPathFile(std::string name,
}
}
-void KleeHandler::getOutFiles(std::string path,
- std::vector<std::string> &results) {
+void KleeHandler::getKTestFilesInDir(std::string directoryPath,
+ std::vector<std::string> &results) {
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
error_code ec;
#else
std::error_code ec;
#endif
- for (llvm::sys::fs::directory_iterator i(path,ec),e; i!=e && !ec; i.increment(ec)){
+ for (llvm::sys::fs::directory_iterator i(directoryPath, ec), e; i != e && !ec;
+ i.increment(ec)) {
std::string f = (*i).path();
if (f.substr(f.size()-6,f.size()) == ".ktest") {
results.push_back(f);
@@ -577,8 +578,8 @@ void KleeHandler::getOutFiles(std::string path,
}
if (ec) {
- llvm::errs() << "ERROR: unable to read output directory: " << path << ": "
- << ec.message() << "\n";
+ llvm::errs() << "ERROR: unable to read output directory: " << directoryPath
+ << ": " << ec.message() << "\n";
exit(1);
}
}
@@ -1402,18 +1403,18 @@ int main(int argc, char **argv, char **envp) {
infoFile << buf;
infoFile.flush();
- if (!ReplayOutDir.empty() || !ReplayOutFile.empty()) {
+ if (!ReplayKTestDir.empty() || !ReplayKTestFile.empty()) {
assert(SeedOutFile.empty());
assert(SeedOutDir.empty());
- std::vector<std::string> outFiles = ReplayOutFile;
+ std::vector<std::string> kTestFiles = ReplayKTestFile;
for (std::vector<std::string>::iterator
- it = ReplayOutDir.begin(), ie = ReplayOutDir.end();
+ it = ReplayKTestDir.begin(), ie = ReplayKTestDir.end();
it != ie; ++it)
- KleeHandler::getOutFiles(*it, outFiles);
+ KleeHandler::getKTestFilesInDir(*it, kTestFiles);
std::vector<KTest*> kTests;
for (std::vector<std::string>::iterator
- it = outFiles.begin(), ie = outFiles.end();
+ it = kTestFiles.begin(), ie = kTestFiles.end();
it != ie; ++it) {
KTest *out = kTest_fromFile(it->c_str());
if (out) {
@@ -1435,15 +1436,15 @@ int main(int argc, char **argv, char **envp) {
it = kTests.begin(), ie = kTests.end();
it != ie; ++it) {
KTest *out = *it;
- interpreter->setReplayOut(out);
+ interpreter->setReplayKTest(out);
llvm::errs() << "KLEE: replaying: " << *it << " (" << kTest_numBytes(out)
<< " bytes)"
- << " (" << ++i << "/" << outFiles.size() << ")\n";
+ << " (" << ++i << "/" << kTestFiles.size() << ")\n";
// XXX should put envp in .ktest ?
interpreter->runFunctionAsMain(mainFn, out->numArgs, out->args, pEnvp);
if (interrupted) break;
}
- interpreter->setReplayOut(0);
+ interpreter->setReplayKTest(0);
while (!kTests.empty()) {
kTest_free(kTests.back());
kTests.pop_back();
@@ -1463,10 +1464,10 @@ int main(int argc, char **argv, char **envp) {
for (std::vector<std::string>::iterator
it = SeedOutDir.begin(), ie = SeedOutDir.end();
it != ie; ++it) {
- std::vector<std::string> outFiles;
- KleeHandler::getOutFiles(*it, outFiles);
+ std::vector<std::string> kTestFiles;
+ KleeHandler::getKTestFilesInDir(*it, kTestFiles);
for (std::vector<std::string>::iterator
- it2 = outFiles.begin(), ie = outFiles.end();
+ it2 = kTestFiles.begin(), ie = kTestFiles.end();
it2 != ie; ++it2) {
KTest *out = kTest_fromFile(it2->c_str());
if (!out) {
@@ -1475,7 +1476,7 @@ int main(int argc, char **argv, char **envp) {
}
seeds.push_back(out);
}
- if (outFiles.empty()) {
+ if (kTestFiles.empty()) {
llvm::errs() << "KLEE: seeds directory is empty: " << *it << "\n";
exit(1);
}