[llvm-commits] [klee] r72592 - in /klee/trunk: lib/Basic/KTest.cpp tools/ktest-tool/ktest-tool
Cristian Cadar
cristic at cs.stanford.edu
Fri May 29 14:25:52 PDT 2009
Author: cristic
Date: Fri May 29 16:25:51 2009
New Revision: 72592
URL: http://llvm.org/viewvc/llvm-project?rev=72592&view=rev
Log:
Changed .ktest header from BOUT\n to KTEST. Old .bout files can still be read.
Increased KTEST version.
Modified:
klee/trunk/lib/Basic/KTest.cpp
klee/trunk/tools/ktest-tool/ktest-tool
Modified: klee/trunk/lib/Basic/KTest.cpp
URL: http://llvm.org/viewvc/llvm-project/klee/trunk/lib/Basic/KTest.cpp?rev=72592&r1=72591&r2=72592&view=diff
==============================================================================
--- klee/trunk/lib/Basic/KTest.cpp (original)
+++ klee/trunk/lib/Basic/KTest.cpp Fri May 29 16:25:51 2009
@@ -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 @@
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;
}
Modified: klee/trunk/tools/ktest-tool/ktest-tool
URL: http://llvm.org/viewvc/llvm-project/klee/trunk/tools/ktest-tool/ktest-tool?rev=72592&r1=72591&r2=72592&view=diff
==============================================================================
--- klee/trunk/tools/ktest-tool/ktest-tool (original)
+++ klee/trunk/tools/ktest-tool/ktest-tool Fri May 29 16:25:51 2009
@@ -4,7 +4,7 @@
import struct
import sys
-version_no=2
+version_no=3
class KTestError(Exception):
pass
@@ -18,7 +18,7 @@
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:
More information about the llvm-commits
mailing list