1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# On OSX do:
# make OSX=OSX
# For verbose output do
# make VERBOSE=1
# For very verbose output do
# make VERBOSE=2
ifdef BDBDIR
BDB_CPPFLAGS = -I$(BDBDIR)/include
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb
endif
ifneq ($(OSX),)
#Note: OSX 10.4 needs DYLD_LIBRARY_PATH. OSX 10.5 claims to support -rpath.
CFLAGS = -DOSX
LIBEXT=dylib
VGRIND=
HGRIND=
# SETTOKUENV=export DYLD_LIBRARY_PATH=.. ;
# UNSETTOKUENV=unset DYLD_LIBRARY_PATH ;
else
CFLAGS =
# SETTOKUENV=
# UNSETTOKUENV=
LIBEXT=so
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=full --show-reachable=yes
HGRIND=valgrind --quiet --tool=helgrind
endif
ifdef BDBDIR
BDB_LDFLAGS += -Wl,-rpath,$(BDBDIR)/lib
endif
BDB_LDFLAGS += -lpthread
TDB_LOADLIBES = -L.. -ltokudb -Wl,-rpath,.. -lpthread
TDB_TRACELOADLIBES = -L.. -ltokudbtrace -Wl,-rpath,.. -lpthread
ifeq ($(VGRIND),)
BDB_SUPPRESSIONS =
else
BDB_SUPPRESSIONS = --suppressions=bdb.supressions --gen-suppressions=all
endif
# VERBOSE=true
LIBNAME=libdb.$(LIBEXT)
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS += -Wall -Werror $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
TDB_CPPFLAGS = -I../../include
SRCS = $(sort $(wildcard *.c))
TDB_TESTS = $(patsubst %.c,%.tdb,$(SRCS))
BDB_DONTRUN = bug627 test_abort1
BDB_TESTS = $(patsubst %.c,%.bdb,$(filter-out $(patsubst %,%.c,$(BDB_DONTRUN)),$(SRCS)))
TDB_TESTS_THAT_SHOULD_FAIL = test_groupcommit_count
ALL_TESTS = $(TDB_TESTS) $(BDB_TESTS)
RUN_TDB_TESTS = $(patsubst %.tdb,%.tdbrun,$(TDB_TESTS))
RUN_BDB_TESTS = $(patsubst %.bdb,%.bdbrun,$(BDB_TESTS))
RUN_ALL_TESTS = $(RUN_TDB_TESTS) $(RUN_BDB_TESTS)
all build: $(ALL_TESTS)
#traces: test_env_open_flags.tdbt
traces: $(patsubst %.tdb,%.tdbt,$(TDB_TESTS))
foo:
echo RUN_TDB_TESTS: $(RUN_TDB_TESTS)
echo ALL_TESTS: $(ALL_TESTS)
.PHONY: check check.bdb check.tdb
check: check.tdb test_db_assoc3.tdbrun_wasbad check.bdb
@ echo ok $@
tests: tests.bdb tests.tdb
@ echo ok $@
tests.bdb: $(BDB_TESTS)
@ echo ok $@
check.bdb: $(RUN_BDB_TESTS)
@ echo ok $@
tests.tdb: $(TDB_TESTS)
@ echo ok $@
check.tdb: $(RUN_TDB_TESTS) all.recover
@ echo ok $@
# Need these rule so that Make knows about all the file names
.PHONY: %.run
$(RUN_ALL_TESTS):
$(ALL_TESTS):
%.run: %.bdbrun %.tdbrun
@ echo ok
ifeq ($(VERBOSE),2)
VERBVERBOSE=-v
MAYBEATSIGN=
VERBQUIET=
else
ifeq ($(VERBOSE),1)
VERBVERBOSE=
MAYBEATSIGN=
VERBQUIET=
else
VERBVERBOSE=
MAYBEATSIGN=@
VERBQUIET=--quiet
endif
endif
# The @ sign makes the make quiet. If there is an error there is enough info to tell what test failed.
# Give up VGRIND of bdbrun
# It was this:
#%.bdbrun: %.bdb
# $(MAYBEATSIGN) $(UNSETTOKUENV) $(VGRIND) $(BDB_SUPPRESSIONS) ./$< $(VERBVERBOSE)
# Now this:
%.bdbrun: %.bdb ../libtokudb.$(LIBEXT)
$(MAYBEATSIGN) $(UNSETTOKUENV) ./$< $(VERBVERBOSE)
%.tdbrun: %.tdb ../libtokudb.$(LIBEXT)
$(MAYBEATSIGN) $(SETTOKUENV) $(VGRIND) ./$< $(VERBVERBOSE) $(MAYBEINVERTERR)
@ touch $@
# Any test that should fail, we invert the result by using MAYBEINVERTERR
$(patsubst %,%.tdbrun,$(TDB_TESTS_THAT_SHOULD_FAIL)): MAYBEINVERTERR=;test $$? -ne 0
# Don't include log2 log3 log4 log5 etc since they are covered by all.recover
# Don't run valgrind on the groupcommit performance tests
test_groupcommit_perf.bdbrun test_groupcommit_perf.tdbrun: VGRIND=
# Use helgrind on the group commit count test
# helgrind is too flakey, so I'm removing it from the tests. -Bradley
#test_groupcommit_count_helgrind.tdbrun: test_groupcommit_count_helgrind.tdb
# $(MAYBEATSIGN) $(SETTOKUENV) $(HGRIND) ./$< $(VERBVERBOSE)
libs:
cd ..;make
%.bdb: %.c
$(UNSETTOKUENV) cc -DENVDIR=\"dir.$<.bdb\" $(BDB_CPPFLAGS) -DUSE_BDB -DIS_TDB=0 $(CFLAGS) $< $(BDB_LDFLAGS) -ldb -o $@
%.tdb: %.c
$(SETTOKUENV) cc -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(TDB_CPPFLAGS) $(TDB_LOADLIBES) $< -o $@
%.tdbt: %.c
$(SETTOKUENV) cc -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(TDB_CPPFLAGS) $(TDB_TRACELOADLIBES) $< -o $@
.PHONY: %.recover
TLRECOVER = 2 3 4 5 6 7 8 9 10
all.recover: $(patsubst %,test_log%.recover,$(TLRECOVER))
$(patsubst %,test_log%.tdbrun,$(TLRECOVER)):
@echo -n
%.recover: %.tdb
$(MAYBEATSIGN) $(SETTOKUENV) $(VGRIND) ./$<
$(MAYBEATSIGN) $(SETTOKUENV) rm -rf dir.$(patsubst %.tdb,%.c.tdb,$<).recover
$(MAYBEATSIGN) $(SETTOKUENV) mkdir dir.$(patsubst %.tdb,%.c.tdb,$<).recover
$(MAYBEATSIGN) $(SETTOKUENV) cd dir.$(patsubst %.tdb,%.c.tdb,$<).recover; $(VGRIND) ../../../newbrt/tdb-recover ../dir.$(patsubst %.tdb,%.c.tdb,$<)
$(MAYBEATSIGN) $(SETTOKUENV) diff dir.$(patsubst %.tdb,%.c.tdb,$<) dir.$(patsubst %.tdb,%.c.tdb,$<).recover/foo.db
%.recoverwc: %.tdb
$(MAYBEATSIGN) $(SETTOKUENV) (cd dir.$(patsubst %.tdb,%.c.tdb,$<);pwd;cat log*| ../../../newbrt/tdb_logprint |wc -c)
.PHONY: clean cleanall
clean:
rm -f $(ALL_TESTS) *.o *.gcno *.gcda *.gcov
rm -rf dir.*.tdb dir.*.bdb dir.*.tdb.recover
cleanall: clean
rm -f *.tdbrun
test_db_curs4.tdb: trace.h
test_db_curs4.bdb: trace.h
test_db_assoc3.tdb test_db_assoc3.bdb: test.h
# This one failed in both BDB and TokuDB, in the same way. It was a program error. Now it works
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdb
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
$(MAYBEATSIGN) $(SETTOKUENV) ./test_db_assoc3.tdb --seed=1 --count=200 --more
@ touch $@
# serialize these two tests since they use the same directory
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdbrun
test_db_assoc3.tdbrun: test_db_assoc3.tdb
$(MAYBEATSIGN) $(SETTOKUENV) $(VGRIND) ./test_db_assoc3.tdb --seed=2 --count=100000 $(VERBVERBOSE)
$(MAYBEATSIGN) $(SETTOKUENV) $(VGRIND) ./test_db_assoc3.tdb --seed=2 --count=100000 --more $(VERBVERBOSE)
@ touch $@
# Give up on VGRIND for bdbrun
test_db_assoc3.bdbrun: test_db_assoc3.bdb
$(MAYBEATSIGN) $(UNSETTOKUENV) ./test_db_assoc3.bdb --seed=2 --count=100000 $(VERBVERBOSE)
$(MAYBEATSIGN) $(UNSETTOKUENV) ./test_db_assoc3.bdb --seed=2 --count=100000 --more $(VERBVERBOSE)
dumpit:
../../newbrt/brtdump dir.test_log5.c.tdb.recover/foo.db > dump.r && ../../newbrt/brtdump dir.test_log5.c.tdb/foo.db > dump.o && diff dump.o dump.r
# test on small stacks
test_thread_stack.%run: test_thread_stack.%
$(MAYBEATSIGN) $(UNSETTOKUENV) ./test_thread_stack.% -a -thread_stack 16384
$(MAYBEATSIGN) $(UNSETTOKUENV) ./test_thread_stack.% -a -thread_stack 16384 -resume