about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2009-05-23 02:42:09 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2009-05-23 02:42:09 +0000
commit266cc79f26aa8df4718f2309808f77a5426f266c (patch)
tree640584c9eec64bb834a5452ff908145e4c5c8362 /tools
parentac6570f762e6520a4458d53963beb5bd4578a2f0 (diff)
downloadklee-266cc79f26aa8df4718f2309808f77a5426f266c.tar.gz
Changed bout to ktest. Kept "BOUT\n" as the header of test files, for backward compatibility. Also changed KLEE_RUNTEST to KTEST_FILE. Updated tutorial-1.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72312 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gen-random-bout/gen-random-bout.cpp16
-rw-r--r--tools/klee/main.cpp38
2 files changed, 27 insertions, 27 deletions
diff --git a/tools/gen-random-bout/gen-random-bout.cpp b/tools/gen-random-bout/gen-random-bout.cpp
index 044c3d24..0a65bda2 100644
--- a/tools/gen-random-bout/gen-random-bout.cpp
+++ b/tools/gen-random-bout/gen-random-bout.cpp
@@ -7,7 +7,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "klee/Internal/ADT/BOut.h"
+#include "klee/Internal/ADT/KTest.h"
 
 // --sym-args 0 1 10 --sym-args 0 2 2 --sym-files 1 8 --sym-stdout
 static int getint(char *i) {
@@ -19,9 +19,9 @@ static int getint(char *i) {
 }
 
 #define MAX 64
-static void push_obj(BOut *b, const char *name, unsigned non_zero_bytes, 
+static void push_obj(KTest *b, const char *name, unsigned non_zero_bytes, 
                      unsigned total_bytes) {
-  BOutObject *o = &b->objects[b->numObjects++];
+  KTestObject *o = &b->objects[b->numObjects++];
   assert(b->numObjects < MAX);
 
   o->name = strdup(name);
@@ -37,8 +37,8 @@ static void push_obj(BOut *b, const char *name, unsigned non_zero_bytes,
 }
 
 
-static void push_range(BOut *b, const char *name, unsigned value) {
-  BOutObject *o = &b->objects[b->numObjects++];
+static void push_range(KTest *b, const char *name, unsigned value) {
+  KTestObject *o = &b->objects[b->numObjects++];
   assert(b->numObjects < MAX);
 
   o->name = strdup(name);
@@ -65,14 +65,14 @@ int main(int argc, char *argv[]) {
     srandom(seed);
   else srandom(time(NULL) * getpid());
 
-  BOut b;
+  KTest b;
   b.numArgs = argc;
   b.args = argv;
   b.symArgvs = 0;
   b.symArgvLen = 0;
 
   b.numObjects = 0;
-  b.objects = (BOutObject *)malloc(MAX * sizeof *b.objects);
+  b.objects = (KTestObject *)malloc(MAX * sizeof *b.objects);
 
   for(i = 2; i < (unsigned)argc; i++) {
     if(strcmp(argv[i], "--sym-args") == 0) {
@@ -118,7 +118,7 @@ int main(int argc, char *argv[]) {
     }
   }
 
-  if (!bOut_toFile(&b, "file.bout"))
+  if (!kTest_toFile(&b, "file.bout"))
     assert(0);
   return 0;
 }
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 0a070452..97911759 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -8,7 +8,7 @@
 #include "klee/Interpreter.h"
 #include "klee/Statistics.h"
 #include "klee/Config/config.h"
-#include "klee/Internal/ADT/BOut.h"
+#include "klee/Internal/ADT/KTest.h"
 #include "klee/Internal/ADT/TreeStream.h"
 #include "klee/Internal/Support/ModuleUtil.h"
 #include "klee/Internal/System/Time.h"
@@ -385,16 +385,16 @@ void KleeHandler::processTestCase(const ExecutionState &state,
     unsigned id = ++m_testIndex;
 
     if (success) {
-      BOut b;      
+      KTest b;      
       b.numArgs = m_argc;
       b.args = m_argv;
       b.symArgvs = 0;
       b.symArgvLen = 0;
       b.numObjects = out.size();
-      b.objects = new BOutObject[b.numObjects];
+      b.objects = new KTestObject[b.numObjects];
       assert(b.objects);
       for (unsigned i=0; i<b.numObjects; i++) {
-        BOutObject *o = &b.objects[i];
+        KTestObject *o = &b.objects[i];
         o->name = const_cast<char*>(out[i].first.c_str());
         o->numBytes = out[i].second.size();
         o->bytes = new unsigned char[o->numBytes];
@@ -402,7 +402,7 @@ void KleeHandler::processTestCase(const ExecutionState &state,
         std::copy(out[i].second.begin(), out[i].second.end(), o->bytes);
       }
       
-      if (!bOut_toFile(&b, getTestFilename("bout", id).c_str())) {
+      if (!kTest_toFile(&b, getTestFilename("ktest", id).c_str())) {
         klee_warning("unable to write output test case, losing it");
       }
       
@@ -1274,13 +1274,13 @@ int main(int argc, char **argv, char **envp) {
            it = ReplayOutDir.begin(), ie = ReplayOutDir.end();
          it != ie; ++it)
       KleeHandler::getOutFiles(*it, outFiles);    
-    std::vector<BOut*> bOuts;
+    std::vector<KTest*> kTests;
     for (std::vector<std::string>::iterator
            it = outFiles.begin(), ie = outFiles.end();
          it != ie; ++it) {
-      BOut *out = bOut_fromFile(it->c_str());
+      KTest *out = kTest_fromFile(it->c_str());
       if (out) {
-        bOuts.push_back(out);
+        kTests.push_back(out);
       } else {
         llvm::cerr << "KLEE: unable to open: " << *it << "\n";
       }
@@ -1294,28 +1294,28 @@ int main(int argc, char **argv, char **envp) {
     }
 
     unsigned i=0;
-    for (std::vector<BOut*>::iterator
-           it = bOuts.begin(), ie = bOuts.end();
+    for (std::vector<KTest*>::iterator
+           it = kTests.begin(), ie = kTests.end();
          it != ie; ++it) {
-      BOut *out = *it;
+      KTest *out = *it;
       interpreter->setReplayOut(out);
-      llvm::cerr << "KLEE: replaying: " << *it << " (" << bOut_numBytes(out) << " bytes)"
+      llvm::cerr << "KLEE: replaying: " << *it << " (" << kTest_numBytes(out) << " bytes)"
                  << " (" << ++i << "/" << outFiles.size() << ")\n";
       // XXX should put envp in .bout ?
       interpreter->runFunctionAsMain(mainFn, out->numArgs, out->args, pEnvp);
       if (interrupted) break;
     }
     interpreter->setReplayOut(0);
-    while (!bOuts.empty()) {
-      bOut_free(bOuts.back());
-      bOuts.pop_back();
+    while (!kTests.empty()) {
+      kTest_free(kTests.back());
+      kTests.pop_back();
     }
   } else {
-    std::vector<BOut *> seeds;
+    std::vector<KTest *> seeds;
     for (std::vector<std::string>::iterator
            it = SeedOutFile.begin(), ie = SeedOutFile.end();
          it != ie; ++it) {
-      BOut *out = bOut_fromFile(it->c_str());
+      KTest *out = kTest_fromFile(it->c_str());
       if (!out) {
         llvm::cerr << "KLEE: unable to open: " << *it << "\n";
         exit(1);
@@ -1330,7 +1330,7 @@ int main(int argc, char **argv, char **envp) {
       for (std::vector<std::string>::iterator
              it2 = outFiles.begin(), ie = outFiles.end();
            it2 != ie; ++it2) {
-        BOut *out = bOut_fromFile(it2->c_str());
+        KTest *out = kTest_fromFile(it2->c_str());
         if (!out) {
           llvm::cerr << "KLEE: unable to open: " << *it2 << "\n";
           exit(1);
@@ -1356,7 +1356,7 @@ int main(int argc, char **argv, char **envp) {
     interpreter->runFunctionAsMain(mainFn, pArgc, pArgv, pEnvp);
 
     while (!seeds.empty()) {
-      bOut_free(seeds.back());
+      kTest_free(seeds.back());
       seeds.pop_back();
     }
   }