Add handling of reduced test cases (traverse lines trimmed), and add all the test...
[ccan] / ccan / tdb / tools / Makefile
index 7c459353a681e6bd1666c533a3977c71af17112a..d52b9f376f708d3baf6e88b5343c0a4119d77517 100644 (file)
@@ -1,8 +1,29 @@
 LDLIBS:=-lccan
-CFLAGS:=-I../../.. -Wall -g -pg -O3
+CFLAGS:=-I../../.. -Wall -O3 #-g -pg
 LDFLAGS:=-L../../..
 
-default: replay_trace tdbtorture
+default: replay_trace tdbtorture tdbdump
+
+replay_trace: replay_trace.c keywords.c
+       $(LINK.c) $< $(LOADLIBES) $(LDLIBS) -o $@
+
+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 *.o
+       rm -f replay_trace tdbtorture tdbdump *.o