about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2009-05-29 21:25:51 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2009-05-29 21:25:51 +0000
commit489f3d421c525123baabd021da9a546b4f100d80 (patch)
tree0716679716258ea8d4b303a2bcc69eab289761c4
parent4fa061a181f05c6c06de0185bee7f322b5ef0db9 (diff)
downloadklee-489f3d421c525123baabd021da9a546b4f100d80.tar.gz
Changed .ktest header from BOUT\n to KTEST. Old .bout files can still be read.
Increased KTEST version.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72592 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Basic/KTest.cpp10
-rwxr-xr-xtools/ktest-tool/ktest-tool4
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/Basic/KTest.cpp b/lib/Basic/KTest.cpp
index d17916f5..0e8c545c 100644
--- a/lib/Basic/KTest.cpp
+++ b/lib/Basic/KTest.cpp
@@ -13,9 +13,12 @@
 #include <string.h>
 #include <stdio.h>
 
-#define KTEST_MAGIC "BOUT\n"
+#define KTEST_VERSION 3
 #define KTEST_MAGIC_SIZE 5
-#define KTEST_VERSION 2
+#define KTEST_MAGIC "KTEST"
+
+// for compatibility reasons
+#define BOUT_MAGIC "BOUT\n"
 
 /***/
 
@@ -70,7 +73,8 @@ static int kTest_checkHeader(FILE *f) {
   char header[KTEST_MAGIC_SIZE];
   if (fread(header, KTEST_MAGIC_SIZE, 1, f)!=1)
     return 0;
-  if (memcmp(header, KTEST_MAGIC, KTEST_MAGIC_SIZE))
+  if (memcmp(header, KTEST_MAGIC, KTEST_MAGIC_SIZE) &&
+      memcmp(header, BOUT_MAGIC, KTEST_MAGIC_SIZE))
     return 0;
   return 1;
 }
diff --git a/tools/ktest-tool/ktest-tool b/tools/ktest-tool/ktest-tool
index e06a9faf..a7a3abf1 100755
--- a/tools/ktest-tool/ktest-tool
+++ b/tools/ktest-tool/ktest-tool
@@ -4,7 +4,7 @@ import os
 import struct
 import sys
 
-version_no=2
+version_no=3
 
 class KTestError(Exception):
     pass
@@ -18,7 +18,7 @@ class KTest:
             
         f = open(path,'rb')
         hdr = f.read(5)
-        if len(hdr)!=5 or hdr!='BOUT\n':
+        if len(hdr)!=5 or (hdr!='KTEST' and hdr != "BOUT\n"):
             raise KTestError,'unrecognized file'
         version, = struct.unpack('>i', f.read(4))
         if version > version_no: