Makefile 9.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
# -*- Mode: Makefile -*-

.DEFAULT_GOAL= build
TOKUROOT=../../
INCLUDEDIRS=-I. -I../ -I$(TOKUROOT)newbrt -I../range_tree -I../lock_tree
DEPEND_COMPILE += \
	../*.h \
	../range_tree/*.h \
	../lock_tree/*.h \
	test.h \
#end
SKIP_NORETURN=1 #Do not add the -Wmissing-noreturn flag
13 14
include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS+=-D_GNU_SOURCE
15 16 17 18 19 20
LIBTDB=../libtokudb.$(SOEXT)
TLIBTDB=../libtokudbtrace.$(SOEXT)

ifeq ($(CC),icc)
SKIP_WARNING += $(ICC_NOWARN)1418 #Non static functions do not need prototypes.
endif
Yoni Fogel's avatar
Yoni Fogel committed
21
BDBVGRIND=
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
22

23
$(LIBTDB) $(TLIBTDB):
24
	cd $(@D) && $(MAKE) $(@F)
25

26
$(notdir $(LIBTDB)): $(LIBTDB)
27
	cp $< $@
28

29
$(notdir $(TLIBTDB)): $(TLIBTDB)
30
	cp $< $@
Zardosht Kasheff's avatar
Zardosht Kasheff committed
31

32
SRCS = $(sort $(wildcard *.c))
Zardosht Kasheff's avatar
Zardosht Kasheff committed
33

34 35 36 37 38 39 40 41 42 43
TDB_TESTS = $(patsubst %.c,%.tdb$(BINSUF),$(SRCS))
BDB_DONTRUN_TESTS = \
	bug627 \
	test_abort1 \
	keyrange \
	keyrange-unflat \
	keyrange-dupsort \
	keyrange-dupsort-unflat \
	manyfiles \
	test938c \
Yoni Fogel's avatar
Yoni Fogel committed
44
	helgrind1 \
45
	helgrind2 \
46
	helgrind3 \
47 48
#\ ends prev line

49
BDB_TESTS = $(patsubst %.c,%.bdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(BDB_DONTRUN_TESTS)),$(SRCS)))
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

TDB_TESTS_THAT_SHOULD_FAIL= \
	test_groupcommit_count \
	test-recover1 \
	test-recover2 \
	test-recover3 \
	test_txn_recover3 \
	test944 \
	test_truncate_txn_abort \
	test_truncate_subdb \
	test_txn_nested_abort3 \
	test_txn_nested_abort4 \
#\ ends prev line

TDB_TESTS_THAT_SHOULD_FAIL_LIT= \
	test_log2.recover \
	test_log3.recover \
	test_log4.recover \
	test_log5.recover \
	test_log6.recover \
	test_log7.recover \
	test_log8.recover \
	test_log9.recover \
	test_log10.recover \
#\ ends prev line

ALL_TESTS  = $(TDB_TESTS)

#Skip all BDB tests for CYGWIN+ICC
ifeq ($(CYGWIN),)
ALL_TESTS += $(BDB_TESTS)
else ifneq ($(CC),icc)
ALL_TESTS += $(BDB_TESTS)
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
83 84
endif

85
TLRECOVER = 2 3 4 5 6 7 8 9 10
86

87 88 89 90
EXTRA_TDB_TESTS = \
	test_db_assoc3.tdbrun_wasbad \
	$(patsubst %,test_log%.recover,$(TLRECOVER)) \
#\ ends prev line
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
91

92 93 94
RUN_TDB_TESTS = $(patsubst %.tdb$(BINSUF),%.tdbrun,$(TDB_TESTS))  $(EXTRA_TDB_TESTS)
RUN_BDB_TESTS  = $(patsubst %.bdb$(BINSUF),%.bdbrun,$(BDB_TESTS))
RUN_ALL_TESTS  = $(RUN_BDB_TESTS) $(RUN_TDB_TESTS)
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
95

96
.PHONY: default all check tests check.lin check.tlog check.log tests.lin tests.log tests.tlog
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
97

98
default all build: $(ALL_TESTS)
99

100 101 102 103 104 105
check: check.tdb check.bdb ;
tests: tests.bdb tests.tdb ;
tests.bdb: $(BDB_TESTS) ;
check.bdb: $(RUN_BDB_TESTS) ;
tests.tdb: $(TDB_TESTS) ;
check.tdb: $(RUN_TDB_TESTS) ;
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
106

107
foo:
108 109
	echo RUN_TDB_TESTS: $(RUN_TDB_TESTS)
	echo ALL_TESTS: $(ALL_TESTS)
110

111 112 113
#TODO: What is this for? TODO: Port this if necessary.
#traces: test_env_open_flags.tdbt$(BINSUF)
traces: $(patsubst %.tdb$(BINSUF),%.tdbt$(BINSUF),$(TDB_TESTS))
114

115 116
.PHONY: %.bdbrun %.run %.tdbrun
# STUFF!!!!
117

118 119 120 121 122 123 124
%.run: %.bdbrun %.tdbrun

SHOULD_FAIL = $(TDB_TESTS_THAT_SHOULD_FAIL_LIT) $(patsubst %,%.tdbrun,$(TDB_TESTS_THAT_SHOULD_FAIL))
# Any test that should fail, we invert the result by using MAYBEINVERTER
$(SHOULD_FAIL): MAYBEINVERTER=$(INVERTER)
$(SHOULD_FAIL): SUMMARIZE_CMD=$(SUMMARIZE_SHOULD_FAIL)

125 126
TDBVGRIND=$(VGRIND)

Yoni Fogel's avatar
Yoni Fogel committed
127
# Use -s on the command line to make things quiet.
128 129
# Use -s on the command line to make things quiet.
%.bdbrun: %.bdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK)
130
	$(BDBVGRIND) ./$< $(VERBVERBOSE) $(SUMMARIZE_CMD)
131
%.tdbrun: %.tdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK) $(notdir $(LIBTDB))
132
	$(TDBVGRIND)    ./$< $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
133 134

%.recover: %.tdb$(BINSUF)
135
	$(VGRIND) ./$< && \
136 137 138 139 140 141 142
	rm -rf dir.$*.c.tdb.recover && \
	mkdir dir.$*.c.tdb.recover && \
	(cd dir.$*.c.tdb.recover && $(VGRIND) ../../../newbrt/tdb-recover ../dir.$*.c.tdb ) && \
	diff dir.$*.c.tdb dir.$*.c.tdb.recover/foo.db \
	$(MAYBEINVERTER) $(SUMMARIZE_CMD)

%.recoverwc: %.tdb$(BINSUF)
143
	 (cd dir.$*.c.tdb;pwd;cat log*| ../../../newbrt/tdb_logprint |wc -c)
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160

.PHONY: %.recover
all.recover: $(patsubst %,test_log%.recover,$(TLRECOVER)) ;

#DISABLE standard tdbrun for recover tests.
$(patsubst %,test_log%.tdbrun,$(TLRECOVER)): ;

#TODO: PORT
ifdef BDBDIR
%.bdb$(BINSUF): INCLUDEDIRS=-I$(BDBDIR)/include
%.bdb$(BINSUF): RPATH_DIRS=$(BDBDIR)/lib
endif
%.bdb$(BINSUF): DLINK_FILES=db.$(SOEXT)

%.bdb$(BINSUF): CFLAGS+= -DENVDIR=\"dir.$<.bdb\" -DUSE_BDB -DIS_TDB=0

%.bdb$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK)
161
	$(CC) $< $(BIN_FROM_C_FLAGS)
162 163

%.tdb$(BINSUF):  DLINK_FILES+=$(LIBTDB)
Yoni Fogel's avatar
Yoni Fogel committed
164
%.tdb$(BINSUF):  RPATH_DIRS+=$(dir $(LIBTDB))
165
%.tdbt$(BINSUF): DLINK_FILES+=$(TLIBTDB)
Yoni Fogel's avatar
Yoni Fogel committed
166
%.tdbt$(BINSUF): RPATH_DIRS+=$(dir $(TLIBTDB))
167
%.tdb$(BINSUF) %.tdbt$(BINSUF): CFLAGS+= -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1
168
%.tdb$(BINSUF) %.tdbt$(BINSUF): CPPFLAGS+=-I$(TOKUROOT)include
169

170
%.tdb$(BINSUF) %.tdbt$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK)
171
	$(CC) $< $(filter-out ../../lib/libtokuportability.a,$(BIN_FROM_C_FLAGS))
172 173

clean:
174 175
	rm -f $(ALL_TESTS)
	rm -rf dir.*.tdb dir.*.bdb dir.*.tdb.recover
176 177 178 179 180 181 182 183

ifeq ($(VGRIND),)
  BDB_SUPPRESSIONS =
else
  BDB_SUPPRESSIONS = --suppressions=bdb.supressions --gen-suppressions=all
endif

# VERBOSE=true
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
184

185
# Need these rule so that Make knows about all the file names
Vincenzo Liberatore's avatar
Vincenzo Liberatore committed
186
.PHONY: %.run
187 188
$(RUN_ALL_TESTS):
$(ALL_TESTS):
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
189

190
%.run: %.bdbrun %.tdbrun
191
	@ echo ok
192

193 194 195



196 197 198 199 200
INVERTER=;test $$? -ne 0

# Any test that should fail, we invert the result by using MAYBEINVERTER
$(SHOULD_FAIL): MAYBEINVERTER=$(INVERTER)

201 202
HERE = src/tests

203

204
# Don't include log2 log3 log4 log5 etc since they are covered by all.recover
205

206 207
# Don't run valgrind on the groupcommit performance tests
test_groupcommit_perf.bdbrun test_groupcommit_perf.tdbrun: VGRIND=
208
# Use helgrind on the group commit count test
209 210
# helgrind is too flakey, so I'm removing it from the tests. -Bradley
#test_groupcommit_count_helgrind.tdbrun: test_groupcommit_count_helgrind.tdb
211
#	$(HGRIND) ./$< $(VERBVERBOSE)
212 213


214

215
libs:
Yoni Fogel's avatar
Yoni Fogel committed
216
	cd ..;$(MAKE)
217

218

219

Vincenzo Liberatore's avatar
Vincenzo Liberatore committed
220

221 222 223
test_db_curs4.tdb$(BINSUF): trace.h
test_db_curs4.bdb$(BINSUF): trace.h
test_db_assoc3.tdb$(BINSUF) test_db_assoc3.bdb$(BINSUF): test.h
224

225

226
# This one failed in both BDB and TokuDB, in the same way.  It was a program error.  Now it works
227
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdb$(BINSUF)
228 229 230 231 232 233 234
	./$< --seed=1 --count=200
	./$< --seed=1 --count=200 --more
	./$< --seed=1 --count=200 --more
	./$< --seed=1 --count=200 --more
	./$< --seed=1 --count=200 --more
	./$< --seed=1 --count=200 --more
	./$< --seed=1 --count=200 --more
235 236
# serialize these two tests since they use the same directory
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdbrun
237

238 239

.phony: build_primary_db build_name_db  build_expire_db
240
test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF):
241
	mkdir $@
242
build_primary_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
243
	gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/primary.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/primary.db
244
build_name_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
245
	gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/name.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/name.db
246
build_expire_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
247
	gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/expire.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/expire.db
248 249

test_v6v7_assoc3.tdbrun: test_db_assoc3.tdb$(BINSUF) build_primary_db  build_name_db build_expire_db
250
	(cd test_v6_assoc3.dir; LD_LIBRARY_PATH=../.. $(VGRIND) ../test_db_assoc3.tdb$(BINSUF) --seed=3 --count=1000 --more)  $(SUMMARIZE_CMD)
251 252

test_db_assoc3.tdbrun: test_db_assoc3.tdb$(BINSUF)
253
	$(VGRIND) ./$< --seed=2 --count=100000 $(VERBVERBOSE) && \
254
	              $(VGRIND) ./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
255

256
# Give up on VGRIND for bdbrun
257
test_db_assoc3.bdbrun: test_db_assoc3.bdb$(BINSUF)
258
	./$< --seed=2 --count=100000        $(VERBVERBOSE) && \
259
	              ./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
260

261 262 263 264 265 266 267 268 269 270 271 272
# a bunch of little tests designed to run in parallel
test_get_both_range.tdbrun: \
 tgbr_256_a.tdbrun tgbr_256_b.tdbrun tgbr_256_c.tdbrun \
 tgbr_128_a.tdbrun tgbr_128_b.tdbrun tgbr_128_c.tdbrun \
 tgbr_64_a.tdbrun  tgbr_64_b.tdbrun  tgbr_64_c.tdbrun \
 tgbr_32_a.tdbrun  tgbr_32_b.tdbrun  tgbr_32_c.tdbrun \
 tgbr_16_a.tdbrun  tgbr_16_b.tdbrun  tgbr_16_c.tdbrun \
 tgbr_8_a.tdbrun   tgbr_8_b.tdbrun   tgbr_8_c.tdbrun \
 tgbr_4_a.tdbrun   tgbr_4_b.tdbrun   tgbr_4_c.tdbrun \
 tgbr_2_a.tdbrun   tgbr_2_b.tdbrun   tgbr_2_c.tdbrun \
 tgbr_1_a.tdbrun   tgbr_1_b.tdbrun   tgbr_1_c.tdbrun \
 # intentionally blank line
273
	true $(SUMMARIZE_CMD) #State that this has passed.
274

275
tgbr_%_a.tdbrun: test_get_both_range.tdb$(BINSUF)
276
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -a $(MAYBEINVERTER) $(SUMMARIZE_CMD)
277
tgbr_%_b.tdbrun: test_get_both_range.tdb$(BINSUF)
278
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -b $(MAYBEINVERTER) $(SUMMARIZE_CMD)
279
tgbr_%_c.tdbrun: test_get_both_range.tdb$(BINSUF)
280
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -c $(MAYBEINVERTER) $(SUMMARIZE_CMD)
281

Yoni Fogel's avatar
Yoni Fogel committed
282
# helgrind1 is supposed to fail.
283
helgrind1.tdbrun: TDBVGRIND=$(HGRIND) --log-file=helgrind1.tdb.deleteme
Yoni Fogel's avatar
Yoni Fogel committed
284
helgrind1.tdbrun: MAYBEINVERTER=$(INVERTER)
285
helgrind2.tdbrun: TDBVGRIND=$(HGRIND)
Yoni Fogel's avatar
Yoni Fogel committed
286
helgrind2.bdbrun: BDBVGRIND=$(HGRIND)
287
helgrind3.tdbrun: TDBVGRIND=$(HGRIND)
Yoni Fogel's avatar
Yoni Fogel committed
288 289
helgrind3.bdbrun: BDBVGRIND=$(HGRIND)

290 291
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
292 293

# test on small stacks
294
test_thread_stack.%run: test_thread_stack.%$(BINSUF)
295 296
	./$< -a -thread_stack 16384         && \
	./$< -a -thread_stack 16384 -resume $(SUMMARIZE_CMD)
297