Commit bda37d9c authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1531 Additional porting for windows, to attempt to support bdb tests

git-svn-id: file:///svn/toku/tokudb@10438 c7de825b-a66e-492c-adef-691d508d4ae1
parent b11a25de
......@@ -23,9 +23,9 @@ $(OBJS): CFLAGS += -DTOKU_ALLOW_DEPRECATED
#Blank on purpose
check: $(TARGET)
cd tests; $(MAKE) check
cd tests && $(MAKE) check
clean:
rm -rf $(TARGET) $(LIBPORTABILITY)
cd tests; $(MAKE) clean
cd tests && $(MAKE) clean
# -*- Mode: Makefile -*-
CPPFLAGS = -D_GNU_SOURCE
CPPFLAGS += -I../../toku_include -I..
CFLAGS = -Wall -Werror -g -O0
......@@ -28,7 +29,8 @@ all: $(TARGETS)
test-gettime: test-gettime.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) -lrt
check: $(TARGETS) $(RUNTARGETS)
.PHONY: check
check: $(TARGETS) $(RUNTARGETS);
%.tdbrun: %
ifeq ($(VGRIND),)
......
......@@ -39,6 +39,14 @@ WINDOWS_DONTRUN_TESTS = \
helgrind3 \
#\ ends prev line
#BDB Tests that are irrelevant in windows.
WINDOWS_BDB_DONTRUN_TESTS = \
diskfull \
test_groupcommit_count \
#\ 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
ifeq ($(OS_CHOICE),windows)
TDB_TESTS = $(patsubst %.c,%.tdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(WINDOWS_DONTRUN_TESTS)),$(SRCS)))
else
......@@ -70,6 +78,10 @@ BDB_DONTRUN_TESTS = \
test_txn_commit8 \
#\ ends prev line
ifeq ($(OS_CHOICE),windows)
BDB_DONTRUN_TESTS+=$(WINDOWS_BDB_DONTRUN_TESTS)
endif
BDB_TESTS = $(patsubst %.c,%.bdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(BDB_DONTRUN_TESTS)),$(SRCS)))
TDB_TESTS_THAT_SHOULD_FAIL= \
......@@ -106,7 +118,7 @@ RUN_TDB_TESTS = $(patsubst %.tdb$(BINSUF),%.tdbrun,$(TDB_TESTS)) $(EXTRA_TDB_TE
RUN_BDB_TESTS = $(patsubst %.bdb$(BINSUF),%.bdbrun,$(BDB_TESTS))
RUN_ALL_TESTS = $(RUN_BDB_TESTS) $(RUN_TDB_TESTS)
MORE_BDB_BINS = test1426.bdb
MORE_BDB_BINS = test1426.bdb$(BINSUF)
.PHONY: default all check tests check.lin check.tlog check.log tests.lin tests.log tests.tlog
......@@ -117,7 +129,7 @@ tests: tests.bdb tests.tdb ;
tests.bdb: $(BDB_TESTS) ;
check.bdb: $(RUN_BDB_TESTS) ;
tests.tdb: $(TDB_TESTS) ;
check.tdb: $(RUN_TDB_TESTS) ;
check.tdb: $(notdir $(LIBTDB)) $(RUN_TDB_TESTS) ;
foo:
echo RUN_TDB_TESTS: $(RUN_TDB_TESTS)
......@@ -139,9 +151,37 @@ $(SHOULD_FAIL): SUMMARIZE_CMD=$(SUMMARIZE_SHOULD_FAIL)
TDBVGRIND=$(VGRIND)
ifeq ($(OS_CHOICE),windows)
ifdef BDBDIR
%.bdb$(BINSUF): INCLUDEDIRS=-I$(BDBDIR)/include
%.bdb$(BINSUF): RPATH_DIRS=$(BDBDIR)/lib
endif
ifeq ($(DEBUG),0)
WINDOWS_BDB_LIB_NAME=libdb$(BDBVER).$(SOEXT)
$(WINDOWS_BDB_LIB_NAME):
cp $(BDBDIR)/bin/$(WINDOWS_BDB_LIB_NAME) $@
else
WINDOWS_BDB_LIB_NAME=libdb$(BDBVER)d.$(SOEXT)
$(WINDOWS_BDB_LIB_NAME):
cp $(BDBDIR)/bin/debug/$(WINDOWS_BDB_LIB_NAME) $@
endif
%.bdb$(BINSUF): DLINK_FILES=$(BDBDIR)/lib/$(WINDOWS_BDB_LIB_NAME)
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
# Use -s on the command line to make things quiet.
# Use -s on the command line to make things quiet.
%.bdbrun: %.bdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK)
%.bdbrun: %.bdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK) $(WINDOWS_BDB_LIB_NAME)
$(BDBVGRIND) ./$< $(VERBVERBOSE) $(SUMMARIZE_CMD)
%.tdbrun: %.tdb$(BINSUF) $(DEPEND_COMPILE) $(DEPEND_LINK) $(notdir $(LIBTDB))
$(TDBVGRIND) ./$< $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
......@@ -168,14 +208,7 @@ 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): CFLAGS+= -DENVDIR=\"dir.$<.bdb\" -DUSE_BDB -DIS_TDB=0 -DTOKU_ALLOW_DEPRECATED
%.bdb$(BINSUF): %.c $(DEPEND_COMPILE) $(DEPEND_LINK)
$(CC) $< $(BIN_FROM_C_FLAGS) $(LINK_MUST_BE_LAST)
......@@ -288,7 +321,7 @@ test_db_assoc3.tdbrun: test_db_assoc3.tdb$(BINSUF)
$(VGRIND) ./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
# Give up on VGRIND for bdbrun
test_db_assoc3.bdbrun: test_db_assoc3.bdb$(BINSUF)
test_db_assoc3.bdbrun: test_db_assoc3.bdb$(BINSUF) $(WINDOWS_BDB_LIB_NAME)
./$< --seed=2 --count=100000 $(VERBVERBOSE) && \
./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
......
......@@ -114,14 +114,21 @@ typedef enum __toku_bool { FALSE=0, TRUE=1} BOOL;
#define CLOSE_TRACE_FILE(x) ((void)0)
#endif
#include <memory.h>
int test_main (int argc, const char *argv[]);
int
main(int argc, const char *argv[]) {
#if defined(_WIN32) || defined(_WIN64)
int r;
#if IS_TDB && (defined(_WIN32) || defined(_WIN64))
toku_ydb_init();
#endif
int r = test_main(argc, argv);
#if defined(_WIN32) || defined(_WIN64)
#if !IS_TDB
r = db_env_set_func_malloc(toku_malloc); assert(r==0);
r = db_env_set_func_free(toku_free); assert(r==0);
r = db_env_set_func_realloc(toku_realloc); assert(r==0);
#endif
r = test_main(argc, argv);
#if IS_TDB && (defined(_WIN32) || defined(_WIN64))
toku_ydb_destroy();
#endif
return r;
......
......@@ -75,9 +75,9 @@ test_truncate_with_cursors (int n) {
r = db->truncate(db, 0, &row_count, 0);
#ifdef USE_BDB
// It looks like for 4.6 there's no error code, even though the documentation says "it is an error to truncate with open cursors".
// For 4.3 the error code is EINVAL
// For 4.3 and 4.7 the error code is EINVAL
// I don't know where the boundary really is: Is it an error in 4.5 or 4.4?
if (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR>=4) {
if (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR>=4 && DB_VERSION_MINOR < 7) {
assert(r == 0 && test_errors);
} else {
assert(r == EINVAL && test_errors);
......
......@@ -109,10 +109,8 @@ test_txn_abort (int n, int which_guys_to_abort) {
int
test_main(int argc, const char *argv[]) {
#if IS_TDB // This test is inappropriate for BDB. It requires finer grained locking that BDB supports.
int i,j;
if (!IS_TDB) {
return 0; // This test is inappropriate for BDB. It requires finer grained locking that BDB supports.
}
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) {
......@@ -126,5 +124,6 @@ test_main(int argc, const char *argv[]) {
for (i=1; i<100; i*=2)
test_txn_abort(i, j);
if (verbose>0) printf("OK\n");
#endif
return 0;
}
......@@ -192,6 +192,9 @@ ifeq ($(CC),icc)
#Cygwin
ICC_NOWARN=-Qdiag-disable:
SKIP_WARNING += $(ICC_NOWARN)869 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about multi-file optimization
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about single-file optimization
SKIP_WARNING += $(ICC_NOWARN)11005 # Disable message about creating object file
else
#Linux
ICC_NOWARN=-diag-disable #Need the space
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment