From 5fbbd8a6ea51c81419b29ccfd133b4a9789fd638 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Fri, 8 Apr 2016 09:50:44 +0100 Subject: Rename KLEE command line options from * ``-replay-out`` to ``-replay-ktest-file`` * ``-replay-out-dir`` to ``-replay-ktest-dir`` and also rename * help descriptions * global variables corresponding to these options. * Names used in ``KleeHandler``, ``Interpreter``, ``Executor`` and in KLEE's ``main()`` function. The old name for the options/code was very unhelpful as it wasn't obvious that "out" files are ``.ktest`` files unless you examine KLEE's source code. --- tools/klee/main.cpp | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'tools') 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 - 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 - 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 ReplayPathFile("replay-path", @@ -265,8 +265,8 @@ public: static void loadPathFile(std::string name, std::vector &buffer); - static void getOutFiles(std::string path, - std::vector &results); + static void getKTestFilesInDir(std::string directoryPath, + std::vector &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 &results) { +void KleeHandler::getKTestFilesInDir(std::string directoryPath, + std::vector &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 outFiles = ReplayOutFile; + std::vector kTestFiles = ReplayKTestFile; for (std::vector::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 kTests; for (std::vector::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::iterator it = SeedOutDir.begin(), ie = SeedOutDir.end(); it != ie; ++it) { - std::vector outFiles; - KleeHandler::getOutFiles(*it, outFiles); + std::vector kTestFiles; + KleeHandler::getKTestFilesInDir(*it, kTestFiles); for (std::vector::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); } -- cgit 1.4.1