Add handling of reduced test cases (traverse lines trimmed), and add all the test...
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 17 Jul 2009 05:21:55 +0000 (14:51 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 17 Jul 2009 05:21:55 +0000 (14:51 +0930)
13 files changed:
ccan/tdb/tools/Makefile
ccan/tdb/tools/keywords.c
ccan/tdb/tools/keywords.gperf
ccan/tdb/tools/replay_trace.c
ccan/tdb/tools/tests/1-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/2-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/3-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/4-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/5-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/6-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/7-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/8-torture.trace.tar.bz2 [new file with mode: 0644]
ccan/tdb/tools/tests/9-torture.trace.tar.bz2 [new file with mode: 0644]

index 49e13732cf950f5bdd49c9d77f1398aa4f021371..d52b9f376f708d3baf6e88b5343c0a4119d77517 100644 (file)
@@ -10,5 +10,20 @@ replay_trace: replay_trace.c keywords.c
 keywords.c: keywords.gperf
        gperf $< > $@
 
+check: replay_trace
+       @rm -f *.reduced_trace
+       @set -e; for f in tests/*.trace.tar.bz2; do             \
+               tar xvfj $$f;                                   \
+               ./replay_trace replay.tdb *.reduced_trace;      \
+               rm -f *.reduced_trace;                          \
+       done
+
+# Usage: make mytest.trace.tar.bz2 TRACEFILES=*.trace
+%.trace.tar.bz2: $(patsubst %.trace,%.reduced_trace,$(wildcard $(TRACEFILES)))
+       tar cvfj $@ $^
+
+%.reduced_trace: %.trace
+       @sed 's/\(^[0-9]* traverse\) .*/\1fn/' < $^ > $@
+
 clean:
        rm -f replay_trace tdbtorture tdbdump *.o
index 9c0ee87f362356290e94cc9fd46b52f6c4eac36a..461a61e7df156f8a916bc069613f3d3694240177 100644 (file)
@@ -61,10 +61,10 @@ hash_keyword (register const char *str, register unsigned int len)
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
-      51, 51, 51, 51, 51, 51, 51, 15, 51, 25,
-       5,  0, 10,  0,  0, 51, 51,  0,  0,  0,
-      15, 51, 15, 51, 51,  0,  5,  0, 51,  0,
-      51, 15, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 20, 51, 25,
+       5,  0,  0,  5,  5, 51, 51,  0,  0,  0,
+      20, 51, 20, 51, 51,  0,  5,  0, 51,  0,
+      51,  5, 51, 51, 51, 51, 51, 51, 51, 51,
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
       51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
@@ -93,7 +93,7 @@ find_keyword (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 32,
+      TOTAL_KEYWORDS = 33,
       MIN_WORD_LENGTH = 8,
       MAX_WORD_LENGTH = 25,
       MIN_HASH_VALUE = 8,
@@ -115,17 +115,18 @@ find_keyword (register const char *str, register unsigned int len)
       {"tdb_wipe_all", OP_TDB_WIPE_ALL, op_add_nothing,},
 #line 20 "keywords.gperf"
       {"tdb_unlockall", OP_TDB_UNLOCKALL, op_add_nothing,},
-#line 35 "keywords.gperf"
-      {"tdb_get_seqnum", OP_TDB_GET_SEQNUM, op_add_seqnum,},
 #line 47 "keywords.gperf"
+      {"tdb_fetch", OP_TDB_FETCH, op_add_key_data,},
+#line 48 "keywords.gperf"
       {"tdb_delete", OP_TDB_DELETE, op_add_key_ret,},
 #line 17 "keywords.gperf"
       {"tdb_lockall_mark", OP_TDB_LOCKALL_MARK, op_add_nothing,},
-      {""},
+#line 45 "keywords.gperf"
+      {"tdb_firstkey", OP_TDB_FIRSTKEY, op_add_key,},
 #line 18 "keywords.gperf"
       {"tdb_lockall_unmark", OP_TDB_LOCKALL_UNMARK, op_add_nothing,},
-#line 46 "keywords.gperf"
-      {"tdb_fetch", OP_TDB_FETCH, op_add_key_data,},
+#line 35 "keywords.gperf"
+      {"tdb_get_seqnum", OP_TDB_GET_SEQNUM, op_add_seqnum,},
 #line 19 "keywords.gperf"
       {"tdb_lockall_nonblock", OP_TDB_LOCKALL_NONBLOCK, op_add_nothing,},
 #line 21 "keywords.gperf"
@@ -143,26 +144,27 @@ find_keyword (register const char *str, register unsigned int len)
 #line 41 "keywords.gperf"
       {"tdb_traverse_start", OP_TDB_TRAVERSE_START, op_add_traverse_start,},
       {""},
-#line 34 "keywords.gperf"
-      {"tdb_append", OP_TDB_APPEND, op_add_append,},
+#line 44 "keywords.gperf"
+      {"traversefn", OP_TDB_TRAVERSE, op_add_traversefn,},
 #line 37 "keywords.gperf"
       {"tdb_transaction_start", OP_TDB_TRANSACTION_START, op_add_transaction,},
 #line 39 "keywords.gperf"
       {"tdb_transaction_commit", OP_TDB_TRANSACTION_COMMIT, op_analyze_transaction,},
 #line 40 "keywords.gperf"
       {"tdb_traverse_read_start", OP_TDB_TRAVERSE_READ_START, op_add_traverse_start,},
-      {""}, {""},
-#line 31 "keywords.gperf"
-      {"tdb_parse_record", OP_TDB_PARSE_RECORD, op_add_key_ret,},
-#line 44 "keywords.gperf"
-      {"tdb_firstkey", OP_TDB_FIRSTKEY, op_add_key,},
+      {""},
+#line 34 "keywords.gperf"
+      {"tdb_append", OP_TDB_APPEND, op_add_append,},
+#line 46 "keywords.gperf"
+      {"tdb_nextkey", OP_TDB_NEXTKEY, op_add_key_data,},
+      {""},
 #line 24 "keywords.gperf"
       {"tdb_chainlock", OP_TDB_CHAINLOCK, op_add_chainlock,},
       {""},
 #line 28 "keywords.gperf"
       {"tdb_chainunlock", OP_TDB_CHAINUNLOCK, op_analyze_chainlock,},
-#line 45 "keywords.gperf"
-      {"tdb_nextkey", OP_TDB_NEXTKEY, op_add_key_data,},
+#line 31 "keywords.gperf"
+      {"tdb_parse_record", OP_TDB_PARSE_RECORD, op_add_key_ret,},
       {""},
 #line 26 "keywords.gperf"
       {"tdb_chainlock_mark", OP_TDB_CHAINLOCK_MARK, op_add_key,},
index f2da43b953754968c9d5cc69c226ca28a1d4bd0c..676b64e62827c1d4b890f3c4b07f954866367a89 100644 (file)
@@ -41,6 +41,7 @@ tdb_traverse_read_start, OP_TDB_TRAVERSE_READ_START, op_add_traverse_start,
 tdb_traverse_start, OP_TDB_TRAVERSE_START, op_add_traverse_start,
 tdb_traverse_end, OP_TDB_TRAVERSE_END, op_analyze_traverse,
 traverse, OP_TDB_TRAVERSE, op_add_traverse,
+traversefn, OP_TDB_TRAVERSE, op_add_traversefn,
 tdb_firstkey, OP_TDB_FIRSTKEY, op_add_key,
 tdb_nextkey, OP_TDB_NEXTKEY, op_add_key_data,
 tdb_fetch, OP_TDB_FETCH, op_add_key_data,
index 4afe900aa8e8317587e2f4eb0d84572d74fc221b..08fe8790b6f7043c51af2044b54c47c591887808 100644 (file)
@@ -253,6 +253,16 @@ static void op_add_traverse(const char *filename,
        op[op_num].key = tdb_null;
 }
 
+/* Full traverse info is useful for debugging, but changing it to
+ * "traversefn" without the data makes the traces *much* smaller! */
+static void op_add_traversefn(const char *filename,
+                           struct op op[], unsigned int op_num, char *words[])
+{
+       if (words[2])
+               fail(filename, op_num+1, "Expected no values");
+       op[op_num].key = tdb_null;
+}
+
 /* <serial> tdb_store <rec> <rec> <flag> = <ret> */
 static void op_add_store(const char *filename,
                         struct op op[], unsigned int op_num, char *words[])
diff --git a/ccan/tdb/tools/tests/1-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/1-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..272ea29
Binary files /dev/null and b/ccan/tdb/tools/tests/1-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/2-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/2-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..20bd5d3
Binary files /dev/null and b/ccan/tdb/tools/tests/2-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/3-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/3-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..b039ca0
Binary files /dev/null and b/ccan/tdb/tools/tests/3-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/4-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/4-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..e2307f7
Binary files /dev/null and b/ccan/tdb/tools/tests/4-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/5-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/5-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..a3d590e
Binary files /dev/null and b/ccan/tdb/tools/tests/5-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/6-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/6-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..dc55cc9
Binary files /dev/null and b/ccan/tdb/tools/tests/6-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/7-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/7-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..e77abaf
Binary files /dev/null and b/ccan/tdb/tools/tests/7-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/8-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/8-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..5358d1a
Binary files /dev/null and b/ccan/tdb/tools/tests/8-torture.trace.tar.bz2 differ
diff --git a/ccan/tdb/tools/tests/9-torture.trace.tar.bz2 b/ccan/tdb/tools/tests/9-torture.trace.tar.bz2
new file mode 100644 (file)
index 0000000..edd88ea
Binary files /dev/null and b/ccan/tdb/tools/tests/9-torture.trace.tar.bz2 differ