Makefile 16.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# -*- 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
12 13
include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS+=-D_GNU_SOURCE
14 15 16 17 18 19
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
20
BDBVGRIND=
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
21

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

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

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

31
SRCS = $(sort $(wildcard *.c))
32
RECOVER_SRCS = $(wildcard recover-*.c)
33 34 35 36 37 38 39 40

#Tests that are irrelevant in windows.
WINDOWS_DONTRUN_TESTS = \
	helgrind1 \
	helgrind2 \
	helgrind3 \
#\ ends prev line

41 42 43 44
#BDB Tests that are irrelevant in windows.
WINDOWS_BDB_DONTRUN_TESTS = \
	diskfull \
	test_groupcommit_count \
45
	test_set_func_malloc \
46 47 48
#\ ends prev line
#diskfull: windows bdb is missing db_env_set_func_pwrite and db_env_set_func_write
#test_groupcommit_count: windows bdb is missing db_env_set_func_fsync
49
#test_set_func_malloc: windows bdb (some) are missing db_env_set_func_(malloc|realloc|free)
50

51 52 53 54 55 56

#These tests fail, but sometimes they hang! (in windows).  Just disable them.
WINDOWS_BDB_DONTRUN_TESTS += \
	test_error \
#\ ends prev line

57
ifeq ($(OS_CHOICE),windows)
58 59
    TDB_BINS = $(patsubst %.c,%.tdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(WINDOWS_DONTRUN_TESTS)),$(SRCS)))
    TDB_TESTS = $(patsubst %.c,%.tdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(WINDOWS_DONTRUN_TESTS)),$(filter-out $(RECOVER_SRCS),$(SRCS))))
60
else
61 62
    TDB_BINS = $(patsubst %.c,%.tdb$(BINSUF),$(SRCS))
    TDB_TESTS = $(patsubst %.c,%.tdb$(BINSUF),$(filter-out $(RECOVER_SRCS),$(SRCS)))
63 64
endif

65
# For diskfull.bdb: db-4.6 seems OK, but db-4.3 segfaults
66
BDB_DONTRUN_TESTS = \
67
	bug1381 \
68
	bug627 \
69
	diskfull \
70
	test_abort1 \
71 72
	test_abort4 \
	test_abort5 \
73 74 75 76 77
	keyrange \
	keyrange-unflat \
	keyrange-dupsort \
	keyrange-dupsort-unflat \
	manyfiles \
78
	stat64 stat64_flatten \
79
	test938c \
80
	test1324 \
Yoni Fogel's avatar
Yoni Fogel committed
81
	helgrind1 \
82
	helgrind2 \
83
	helgrind3 \
84
	test1426 \
85
	test1572 \
86
	test_logflush \
87
	test_txn_abort6 \
88 89 90 91
	test_txn_abort8 \
	test_txn_abort9 \
	test_txn_close_open_commit \
	test_txn_commit8 \
92
	test_db_descriptor \
93
	test_db_descriptor_named_db \
94 95
	test_db_txn_locks_heaviside \
	test_heaviside_rh_1756 \
96
	test_heaviside_straddle_1622 \
97
	test_dbremove_old \
98 99 100
	root_fifo_2 \
	root_fifo_32 \
	root_fifo_41 \
101
	checkpoint_1 \
102
	checkpoint_stress \
103
	checkpoint_truncate_1 \
104
	checkpoint_callback \
105
	recovery_stress \
106
	recovery_fileops_stress \
107 108 109 110
	test_txn_nested1 \
	test_txn_nested2 \
	test_txn_nested3 \
	test_txn_nested4 \
111
	backwards_10_each_le_and_msg \
112 113
	test_dupsort_set_range_reverse \
	test_dupsort_get_both_range_reverse \
114
	recover-compare-db \
115
	recover-compare-db-descriptor \
Yoni Fogel's avatar
Yoni Fogel committed
116
	recover-tablelock \
117
	recover-fclose-in-checkpoint \
118
	test_cursor_delete_2119 \
119
	transactional_fileops \
120 121
	env_startup \
	zombie_db \
122 123
	recover-delboth-checkpoint \
	recover-delboth-after-checkpoint \
Rich Prohaska's avatar
Rich Prohaska committed
124
	filesize \
125 126
#\ ends prev line

127 128 129 130
# checkpoint tests depend on this header file, 
checkpoint_1.tdb$(BINSUF) checkpoint_stress.tdb$(BINSUF): checkpoint_test.h
# dependency only, not a rule (do not insert a tab at this line)

131 132 133
BDB_TESTS_THAT_SHOULD_FAIL= \
#\ ends prev line
ifeq ($(OS_CHOICE),windows)
134 135
    #The following are nondeterministic test failures or hangs in windows.  Just get rid of them in BDB. (for now)
    WINDOWS_BDB_DONTRUN_TESTS += \
136
	test_archive2 \
137
	test_cursor_delete \
138
	test_cursor_stickyness \
139 140
	test_db_dbt_mem_behavior \
	test_dup_insert \
141
	test_dup_search \
142
	test_dupsort_get \
143 144 145
	test_dupsort_set \
	test_unused_memory_crash \
	test_dupsort_get_both_range \
146 147
	test_reverse_compare_fun \
	test-recover3 \
148 149 150
#\ ends prev line
endif

151

152 153 154 155
ifeq ($(OS_CHOICE),windows)
    BDB_DONTRUN_TESTS+=$(WINDOWS_BDB_DONTRUN_TESTS)
endif

156 157 158 159
ifeq ($(OS_CHOICE),windows)
BDB_TESTS=
BDB_BINS=
else
160
BDB_TESTS = $(patsubst %.c,%.bdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(BDB_DONTRUN_TESTS)),$(SRCS)))
161 162
BDB_BINS = $(patsubst %.c,%.bdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(BDB_DONTRUN_TESTS)),$(SRCS)))
endif
163 164 165 166 167

TDB_TESTS_THAT_SHOULD_FAIL= \
	test_groupcommit_count \
	test944 \
	test_truncate_txn_abort \
168
	test_db_no_env \
169
	diskfull \
170
#\ ends prev line
171 172
#ifneq ($(OS_CHOICE),windows)
#    TDB_TESTS_THAT_SHOULD_FAIL+= \
173
#\ ends prev line
174
#endif
175

176
TDB_TESTS_THAT_SHOULD_FAIL_LIT= \
177 178 179
	test_log8.recover \
	test_log9.recover \
	test_log10.recover \
180 181
	recover-missing-dbfile.abortrecover \
	recover-missing-dbfile-2.abortrecover \
182 183
#\ ends prev line

184 185 186 187 188 189 190 191 192 193
ifeq ($(OS_CHOICE),windows)
    #Tests that fail in windows but shouldn't.  TODO: Fix each one of these and remove from the list!
    TDB_TESTS_THAT_SHOULD_FAIL += \
	test-recover2 \
	test-recover3 \
#\ ends prev line
    TDB_TESTS_THAT_SHOULD_FAIL_LIT += \
	test_log4.recover \
	test_log5.recover \
	test_log7.recover \
194 195
	test_log8.recover \
	test_log9.recover \
196 197
	test_log10.recover \
#\ ends prev line
198
    #NOTE:  test_log[89].recover is non-deterministic.  Sometimes passes/fails
199 200
endif

201 202 203 204 205 206 207
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
208 209
endif

210
TLRECOVER = 2 3 4 5 6 7 8 9 10
211

212 213 214
EXTRA_TDB_TESTS = \
	$(patsubst %,test_log%.recover,$(TLRECOVER)) \
#\ ends prev line
Bradley C. Kuszmaul's avatar
up  
Bradley C. Kuszmaul committed
215

216
RECOVER_TESTS = $(patsubst %.c,%.abortrecover,$(RECOVER_SRCS))
217

218
RUN_TDB_TESTS = $(patsubst %.tdb$(BINSUF),%.tdbrun,$(TDB_TESTS))  $(EXTRA_TDB_TESTS) $(RECOVER_TESTS)
219 220
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
221

222
MORE_BDB_BINS = test1426.bdb$(BINSUF)
223

224 225
ALL_BINS = $(TDB_BINS) $(BDB_BINS) $(MORE_BDB_BINS)

226
.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
227

228
default all build: $(ALL_BINS)
229

230
ifndef TOKUDBONLY
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
231 232 233
MAYBE_CHECK_BDB = check.bdb
else
MAYBE_CHECK_BDB =
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
234
endif
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
235
check: check.tdb $(MAYBE_CHECK_BDB) ;
236

237
tests: tests.bdb tests.tdb ;
238
tests.bdb: $(BDB_BINS) ;
239
check.bdb: $(RUN_BDB_TESTS) ;
240
tests.tdb: $(TDB_BINS) ;
241
check.tdb: $(notdir $(LIBTDB)) $(PTHREAD_LOCAL) $(RUN_TDB_TESTS) ;
242 243
check.tdb.extra: $(EXTRA_TDB_TESTS) ;
check.abortrecover: $(RECOVER_TESTS) ;
244

245
foo:
246 247
	echo RUN_TDB_TESTS: $(RUN_TDB_TESTS)
	echo ALL_TESTS: $(ALL_TESTS)
248

249 250 251
#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))
252

253 254
.PHONY: %.bdbrun %.run %.tdbrun
# STUFF!!!!
255

256 257
%.run: %.bdbrun %.tdbrun

258 259
SHOULD_FAIL = $(TDB_TESTS_THAT_SHOULD_FAIL_LIT) $(patsubst %,%.tdbrun,$(TDB_TESTS_THAT_SHOULD_FAIL)) \
	      $(BDB_TESTS_THAT_SHOULD_FAIL_LIT) $(patsubst %,%.bdbrun,$(BDB_TESTS_THAT_SHOULD_FAIL))
260 261 262 263
# Any test that should fail, we invert the result by using MAYBEINVERTER
$(SHOULD_FAIL): MAYBEINVERTER=$(INVERTER)
$(SHOULD_FAIL): SUMMARIZE_CMD=$(SUMMARIZE_SHOULD_FAIL)

264 265
TDBVGRIND=$(VGRIND)

266 267
ifeq ($(OS_CHOICE),windows)
ifdef BDBDIR
268
%.bdb$(BINSUF): INCLUDEDIRS=-I$(BDBDIR)/include -I$(TOKUROOT)newbrt
269 270 271
%.bdb$(BINSUF): RPATH_DIRS=$(BDBDIR)/lib
endif
ifeq ($(DEBUG),0)
272
WINDOWS_BDB_LIB_NAME=libdb.$(SOEXT)
273
$(WINDOWS_BDB_LIB_NAME):
274
	cp $(BDBDIR)/lib/libdb[0-9][0-9].$(SOEXT) ./
275
else
276
WINDOWS_BDB_LIB_NAME=libdbd.$(SOEXT)
277
$(WINDOWS_BDB_LIB_NAME):
278
	cp $(BDBDIR)/lib/libdb[0-9][0-9]d.$(SOEXT) ./
279 280
endif
%.bdb$(BINSUF): DLINK_FILES=$(BDBDIR)/lib/$(WINDOWS_BDB_LIB_NAME)
281
#empty
282 283 284 285 286 287 288 289 290 291 292 293 294
else
WINDOWS_BDB_LIB_NAME=
#linux
ifdef BDBDIR
%.bdb$(BINSUF): INCLUDEDIRS=-I$(BDBDIR)/include
%.bdb$(BINSUF): RPATH_DIRS=$(BDBDIR)/lib
endif
%.bdb$(BINSUF): DLINK_FILES=db.$(SOEXT)
endif
#empty on purpose



Yoni Fogel's avatar
Yoni Fogel committed
295
# Use -s on the command line to make things quiet.
296
# Use -s on the command line to make things quiet.
297
%.bdbrun: %.bdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK) $(WINDOWS_BDB_LIB_NAME)
298
	$(BDBVGRIND) ./$< $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
299
%.tdbrun: %.tdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK) $(notdir $(LIBTDB)) $(PTHREAD_LOCAL)
300
	$(TDBVGRIND) ./$< $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
301

302 303 304 305 306 307 308 309
ifeq ($(OS_CHOICE),windows)
    TDBDUMP=$(TOKUROOT)utils/tokudb_dump$(BINSUF)
    TDBLOAD=$(TOKUROOT)utils/tokudb_load$(BINSUF)
else
    TDBDUMP=$(TOKUROOT)utils/tokudb_dump_static$(BINSUF)
    TDBLOAD=$(TOKUROOT)utils/tokudb_load_static$(BINSUF)
endif

310
%.recover: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
311
	echo doing ./$< &&\
312
	./$< --no-shutdown                                                                      && \
313 314
	rm -rf dir.$*.c.tdb.recover                                                             && \
	mkdir dir.$*.c.tdb.recover                                                              && \
315 316 317
	cp dir.$*.c.tdb/tokudb.directory   dir.$*.c.tdb.recover/                                && \
	cp dir.$*.c.tdb/tokudb.environment dir.$*.c.tdb.recover/                                && \
	cp dir.$*.c.tdb/*.tokulog          dir.$*.c.tdb.recover/                                && \
318
	echo doing recovery &&\
319
	$(VGRIND) ../../newbrt/tdb-recover dir.$*.c.tdb.recover dir.$*.c.tdb.recover            && \
320
	echo dump and compare &&\
321 322
	$(TDBDUMP) -h dir.$*.c.tdb         foo.db > dir.$*.c.tdb/foo.dump          && \
	$(TDBDUMP) -h dir.$*.c.tdb.recover foo.db > dir.$*.c.tdb.recover/foo.dump  && \
323
	diff -q dir.$*.c.tdb/foo.dump dir.$*.c.tdb.recover/foo.dump                                   \
324 325
	$(MAYBEINVERTER) $(SUMMARIZE_CMD)

326
%.recoverwc: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
327
	 (cd dir.$*.c.tdb;pwd;cat log*| ../../../newbrt/tdb_logprint |wc -c)
328

329 330 331 332 333 334 335 336 337 338 339 340
%.abortrecover: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
ifeq ($(VGRIND),)
	./$< --test >$<.check.output 2>&1; \
        if [ $$? -ne 134 ] ; then \
		test 0 = 1; \
        else \
		./$< --recover >>$<.check.output 2>&1; \
	fi \
	$(MAYBEINVERTER) $(SUMMARIZE_CMD)
else
	./$< --test >$<.check.output 2>&1; \
        if [ $$? -ne 134 ] ; then \
341
		cat $<.check.output; test 0 = 1; \
342 343 344
        else \
		valgrind --quiet --error-exitcode=1 --leak-check=full --log-file=$<.check.valgrind ./$< --recover >>$<.check.output 2>&1; \
		if [ $$? -ne 0 ] ; then \
345
		    	cat $<.check.valgrind; test 0 = 1; \
346 347
	        else \
			lines=`cat $<.check.valgrind | wc -l`; \
348
			if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi; \
349 350 351 352 353
	        fi \
	fi \
	$(MAYBEINVERTER) $(SUMMARIZE_CMD)
endif

354
.PHONY: %.recover
355
all.recover: $(patsubst %,test_log%.recover,$(TLRECOVER)) $(PTHREAD_LOCAL) ;
356 357 358 359

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

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

%.bdb$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK)
363
	$(CC) $< $(BIN_FROM_C_FLAGS) $(LINK_MUST_BE_LAST)
364

Yoni Fogel's avatar
Yoni Fogel committed
365 366 367 368 369
TDB_EXTRA_NEEDED=
ifeq ($(CYGWIN),)
%.tdb$(BINSUF):  DLINK_FILES+=$(LIBTDB)
%.tdb$(BINSUF):  RPATH_DIRS+=$(dir $(LIBTDB))
else ifneq ($(CC),icc)
370
%.tdb$(BINSUF):  DLINK_FILES+=$(LIBTDB)
Yoni Fogel's avatar
Yoni Fogel committed
371
%.tdb$(BINSUF):  RPATH_DIRS+=$(dir $(LIBTDB))
Yoni Fogel's avatar
Yoni Fogel committed
372 373 374 375 376 377 378 379
else ifeq  ($(DEBUG),0)
%.tdb$(BINSUF):  LINK_FILES+=$(IPO_YDB)
TDB_EXTRA_NEEDED=$(IPO_YDB)
else
%.tdb$(BINSUF):  LINK_FILES+=$(NOIPO_YDB)
TDB_EXTRA_NEEDED=$(NOIPO_YDB)
endif

380
%.tdbt$(BINSUF): DLINK_FILES+=$(TLIBTDB)
Yoni Fogel's avatar
Yoni Fogel committed
381
%.tdbt$(BINSUF): RPATH_DIRS+=$(dir $(TLIBTDB))
382
%.tdb$(BINSUF) %.tdbt$(BINSUF): CFLAGS+= -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1
383
%.tdb$(BINSUF) %.tdbt$(BINSUF): CPPFLAGS+=-I$(TOKUROOT)include
384

Yoni Fogel's avatar
Yoni Fogel committed
385
%.tdb$(BINSUF) %.tdbt$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK) $(TDB_EXTRA_NEEDED)
386
	$(CC) $< $(filter-out ../../lib/libtokuportability.a,$(BIN_FROM_C_FLAGS)) $(LINK_MUST_BE_LAST)
387 388

clean:
389 390
	rm -f $(ALL_BINS)
	rm -rf dir.*.tdb dir.*.bdb dir.*.tdb.recover *.check.output *.check.valgrind
391
	rm -f dump.bdb.1426 dump.tdb.1426 test1426.bdb
392 393 394 395 396 397 398 399

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
400

401
# Need these rule so that Make knows about all the file names
Vincenzo Liberatore's avatar
Vincenzo Liberatore committed
402
.PHONY: %.run
403 404
$(RUN_ALL_TESTS):
$(ALL_TESTS):
Bradley C. Kuszmaul's avatar
Bradley C. Kuszmaul committed
405

406
%.run: %.bdbrun %.tdbrun
Yoni Fogel's avatar
 
Yoni Fogel committed
407
	@ echo ok
408

409 410 411



412 413 414 415 416
INVERTER=;test $$? -ne 0

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

417 418
HERE = src/tests

419

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

422 423
# Don't run valgrind on the groupcommit performance tests
test_groupcommit_perf.bdbrun test_groupcommit_perf.tdbrun: VGRIND=
424
# Use helgrind on the group commit count test
425 426
# helgrind is too flakey, so I'm removing it from the tests. -Bradley
#test_groupcommit_count_helgrind.tdbrun: test_groupcommit_count_helgrind.tdb
427
#	$(HGRIND) ./$< $(VERBVERBOSE)
428 429


430

431
libs:
Yoni Fogel's avatar
Yoni Fogel committed
432
	cd ..;$(MAKE)
433

434

435

Vincenzo Liberatore's avatar
Vincenzo Liberatore committed
436

437 438
test_db_curs4.tdb$(BINSUF): trace.h
test_db_curs4.bdb$(BINSUF): trace.h
439 440 441 442 443 444 445 446 447 448 449 450
# 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
451
	true $(SUMMARIZE_CMD) #State that this has passed.
452

453
tgbr_%_a.tdbrun: test_get_both_range.tdb$(BINSUF) $(PTHREAD_LOCAL)
454
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -a $(MAYBEINVERTER) $(SUMMARIZE_CMD)
455
tgbr_%_b.tdbrun: test_get_both_range.tdb$(BINSUF) $(PTHREAD_LOCAL)
456
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -b $(MAYBEINVERTER) $(SUMMARIZE_CMD)
457
tgbr_%_c.tdbrun: test_get_both_range.tdb$(BINSUF) $(PTHREAD_LOCAL)
458
	$(VGRIND) ./$< $(VERBVERBOSE) -i $* -c $(MAYBEINVERTER) $(SUMMARIZE_CMD)
459

460 461 462 463
ifeq ($(OS_CHOICE),windows)
    #Windows BDB cannot run 1426.  Save output from linux and compare.
dump.bdb.1426: test1426.bdbdump/dump.bdb.1426
	cat $< | unix2dos --u2d > $@
464

465
else
466
dump.bdb.1426: test1426.bdb$(BINSUF) test1426.bdbdump/dump.bdb.1426
467 468 469 470 471
	./$< -q  && \
	 $(BDBDIR)/bin/db_dump -p -h dir.test1426.c.bdb main > $@
	diff -q $@ test1426.bdbdump/$@ #Assert output is correct.
endif

472
# test1426 is run by comparing the BDB output to the TDB output
473
test1426.tdbrun: test1426.tdb$(BINSUF) dump.bdb.1426 $(PTHREAD_LOCAL)
474
	(./test1426.tdb$(BINSUF) -q && \
475
	 $(TDBDUMP) -p -h dir.test1426.c.tdb main > dump.tdb.1426 && \
476
	 diff -q -I db_pagesize=4096 dump.bdb.1426 dump.tdb.1426 ) \
477
	 $(MAYBEINVERTER) $(SUMMARIZE_CMD)
478

479 480 481
# STRESS RUNS is number of iterations, STRESS_SIZE is operations per iteration (must not change between iterations)
STRESS_RUNS=5
STRESS_SIZE=5001
482
checkpoint_stress.tdbrun: SHELL=/bin/bash
483
checkpoint_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL)
484 485
	$(VGRIND) ./$< -C -n $(STRESS_SIZE) $(VERBVERBOSE) && \
	($(VGRIND) ./$< -C -i 0 -n $(STRESS_SIZE) $(VERBVERBOSE) && \
486
	 for (( i = 1; i < $(STRESS_RUNS); i++ )); do \
487
		date; \
488
		./$< -c -i $$i -n $(STRESS_SIZE) $(VERBVERBOSE) 2> dir.checkpoint_stress.c.tdb/error.$$i ; \
489
		if ! grep -q 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.$$i; then break; fi; \
490 491 492 493 494 495 496 497 498 499 500 501
	done && \
	test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \
	) $(MAYBEINVERTER) $(SUMMARIZE_CMD)

recover_stress.tdbrun: SHELL=/bin/bash
recover_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL)
	$(VGRIND) ./$< -C -n $(STRESS_SIZE) -l $(VERBVERBOSE) && \
	($(VGRIND) ./$< -C -i 0 -n $(STRESS_SIZE) -l $(VERBVERBOSE) && \
	 for (( i = 1; i < $(STRESS_RUNS); i++ )); do \
		date; \
		./$< -c -i $$i -n $(STRESS_SIZE) -l $(VERBVERBOSE) 2> dir.checkpoint_stress.c.tdb/error.$$i ; \
		if ! grep -q 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.$$i; then break; fi; \
502 503 504 505
	done && \
	test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \
	) $(MAYBEINVERTER) $(SUMMARIZE_CMD)

Yoni Fogel's avatar
Yoni Fogel committed
506
# helgrind1 is supposed to fail.
507
helgrind1.tdbrun: TDBVGRIND=$(HGRIND) --log-file=helgrind1.tdb.deleteme
Yoni Fogel's avatar
Yoni Fogel committed
508
helgrind1.tdbrun: MAYBEINVERTER=$(INVERTER)
509
helgrind2.tdbrun: TDBVGRIND=$(HGRIND)
Yoni Fogel's avatar
Yoni Fogel committed
510
helgrind2.bdbrun: BDBVGRIND=$(HGRIND)
511
helgrind3.tdbrun: TDBVGRIND=$(HGRIND)
Yoni Fogel's avatar
Yoni Fogel committed
512 513
helgrind3.bdbrun: BDBVGRIND=$(HGRIND)

514 515 516 517 518 519
# we deliberately don't close the env, so recovery runs
# lets avoid all of the valgrind errors
test-recover1.tdbrun: VGRIND=
test-recover2.tdbrun: VGRIND=
test-recover3.tdbrun: VGRIND=

520 521 522
# filesize is too slow with vgrind.
filesize.tdbrun: VGRIND=

523
dumpit:
524
	../../newbrt/brtdump  dir.test_log5.c.tdb.recover/foo.db > dump.r && ../../newbrt/brtdump  dir.test_log5.c.tdb/foo.db > dump.o && diff -q dump.o dump.r
525 526

# test on small stacks
527
test_thread_stack.%run: test_thread_stack.%$(BINSUF) $(PTHREAD_LOCAL)
528 529
	./$< -a -thread_stack 16384         && \
	./$< -a -thread_stack 16384 -resume $(SUMMARIZE_CMD)