2007-11-28 15:38:54 +00:00
|
|
|
ifndef BDBDIR
|
2007-12-04 16:36:25 +00:00
|
|
|
BDBDIR=/usr/local/BerkeleyDB.4.4
|
2007-11-28 15:38:54 +00:00
|
|
|
endif
|
|
|
|
BDB_DUMP=$(BDBDIR)/bin/db_dump
|
|
|
|
BDB_LOAD=$(BDBDIR)/bin/db_load
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-11-28 15:38:54 +00:00
|
|
|
CPPFLAGS = -I$(BDBDIR)/include
|
2007-11-14 18:00:48 +00:00
|
|
|
CFLAGS = -std=gnu89 -W -Wall -Wno-unused -g
|
2007-11-28 15:38:54 +00:00
|
|
|
LDFLAGS = -L$(BDBDIR)/lib -ldb -lpthread -Wl,-rpath,$(BDBDIR)/lib
|
|
|
|
# LDFLAGS = -L$(BDBDIR)/lib -ldb -lpthread
|
2007-12-07 18:52:21 +00:00
|
|
|
STATIC_CPPFLAGS = -I../include
|
2007-12-06 13:54:26 +00:00
|
|
|
STATIC_LDFLAGS = ../lib/libdb.a -lz
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-09-21 21:48:11 +00:00
|
|
|
UTILS= \
|
|
|
|
tokudb_gen \
|
|
|
|
tokudb_load \
|
2007-10-11 18:01:43 +00:00
|
|
|
tokudb_dump \
|
2007-09-15 00:24:48 +00:00
|
|
|
#End
|
2007-11-14 18:00:48 +00:00
|
|
|
STATIC_UTILS=$(patsubst %,%_static,$(UTILS))
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-10-17 01:24:30 +00:00
|
|
|
.PHONY: all clean test test_gen test_gen_hex test_load test_dump
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-11-14 18:00:48 +00:00
|
|
|
all: $(UTILS) $(STATIC_UTILS)
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-11-14 18:00:48 +00:00
|
|
|
%: %.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-11-14 18:00:48 +00:00
|
|
|
%_static: %.c
|
2007-12-07 18:52:21 +00:00
|
|
|
$(CC) $(STATIC_CPPFLAGS) $(CFLAGS) -o $@ $< $(STATIC_LDFLAGS)
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-12-04 16:36:25 +00:00
|
|
|
strip: $(STATIC_UTILS)
|
|
|
|
strip $(STATIC_UTILS)
|
|
|
|
|
2007-11-14 18:00:48 +00:00
|
|
|
test: test_gen test_load test_dump test_bdb_tokudb
|
|
|
|
|
|
|
|
test_gen: test_gen_hex
|
2007-09-15 00:24:48 +00:00
|
|
|
|
2007-09-21 23:33:40 +00:00
|
|
|
TEST_GEN_HEX_NUMKEYS=10000
|
|
|
|
TEST_GEN_HEX_LENGTHMIN=0
|
|
|
|
TEST_GEN_HEX_LENGTHLIMIT=1024
|
|
|
|
TEST_GEN_HEX_FLAGS=-n $(TEST_GEN_HEX_NUMKEYS) -m $(TEST_GEN_HEX_LENGTHMIN) -M $(TEST_GEN_HEX_LENGTHLIMIT) -r 5
|
2007-09-15 00:24:48 +00:00
|
|
|
|
|
|
|
test_gen_hex:
|
2007-09-21 23:33:40 +00:00
|
|
|
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
|
2007-09-15 00:24:48 +00:00
|
|
|
echo "Generating text input > db > text"
|
2007-09-21 23:33:40 +00:00
|
|
|
rm -f $@.*.temp
|
2007-10-09 16:24:05 +00:00
|
|
|
./tokudb_gen $(TEST_GEN_HEX_FLAGS) > $@.gen.temp
|
|
|
|
$(BDB_LOAD) $@.db.temp < $@.gen.temp
|
2007-09-19 15:24:20 +00:00
|
|
|
$(BDB_DUMP) $@.db.temp > $@.load_dump.temp
|
2007-09-21 21:48:11 +00:00
|
|
|
./tokudb_gen -Hf > $@.gen_sorted.temp
|
2007-11-14 18:00:48 +00:00
|
|
|
export LC_ALL=C;./tokudb_gen -hf $(TEST_GEN_HEX_FLAGS) -d "\t" -s "\n" | sort -k 1,1 | tr -d "\n" | tr "\t" "\n" >> $@.gen_sorted.temp
|
2007-09-21 21:48:11 +00:00
|
|
|
./tokudb_gen -Fh >> $@.gen_sorted.temp
|
2007-09-21 23:33:40 +00:00
|
|
|
if ! diff -q $@.load_dump.temp $@.gen_sorted.temp; then echo "Test Failed!"; exit 1; fi
|
2007-09-19 15:24:20 +00:00
|
|
|
rm $@.*.temp
|
2007-10-04 19:53:14 +00:00
|
|
|
|
2007-10-17 01:24:30 +00:00
|
|
|
test_load:
|
2007-10-09 16:24:05 +00:00
|
|
|
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
|
|
|
|
echo "Generating text input > db > text"
|
|
|
|
rm -f $@.*.temp
|
|
|
|
./tokudb_gen $(TEST_GEN_HEX_FLAGS) > $@.gen.temp
|
|
|
|
$(BDB_LOAD) $@.bdb.temp < $@.gen.temp
|
|
|
|
./tokudb_load $@.tokudb.temp < $@.gen.temp
|
|
|
|
$(BDB_DUMP) $@.bdb.temp > $@.dump.bdb.temp
|
|
|
|
$(BDB_DUMP) $@.tokudb.temp > $@.dump.tokudb.temp
|
|
|
|
if ! diff -q $@.dump.bdb.temp $@.dump.tokudb.temp; then echo "Test Failed!"; exit 1; fi
|
2007-11-14 18:00:48 +00:00
|
|
|
|
2007-10-17 01:24:30 +00:00
|
|
|
test_dump:
|
|
|
|
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
|
|
|
|
echo "Generating text input > db > text"
|
|
|
|
rm -f $@.*.temp
|
|
|
|
./tokudb_gen $(TEST_GEN_HEX_FLAGS) > $@.gen.temp
|
|
|
|
$(BDB_LOAD) $@.bdb.temp < $@.gen.temp
|
|
|
|
$(BDB_DUMP) $@.bdb.temp > $@.dump.bdb.temp
|
|
|
|
./tokudb_dump $@.bdb.temp > $@.dump.tokudb.temp
|
|
|
|
if ! diff -q $@.dump.bdb.temp $@.dump.tokudb.temp; then echo "Test Failed!"; exit 1; fi
|
2007-11-14 18:00:48 +00:00
|
|
|
|
|
|
|
test_bdb_tokudb:
|
|
|
|
rm -rf $@.*.temp
|
|
|
|
./tokudb_gen $(TEST_GEN_HEX_FLAGS) >$@.gen.temp
|
|
|
|
$(BDB_LOAD) $@.bdb.temp <$@.gen.temp
|
|
|
|
$(BDB_DUMP) $@.bdb.temp >$@.dump.bdb.temp
|
|
|
|
./tokudb_load_static $@.tdb.temp <$@.gen.temp
|
|
|
|
./tokudb_dump_static $@.tdb.temp >$@.dump.tdb.temp
|
|
|
|
if ! diff -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
|
|
|
|
|
2007-09-15 00:24:48 +00:00
|
|
|
#if diff -q <(echo "foo") <(echo "foo") > /dev/null; then echo yes; else echo no; fi
|
|
|
|
clean:
|
2007-11-14 18:00:48 +00:00
|
|
|
rm -rf *.so *.o $(UTILS) $(STATIC_UTILS) *.temp
|
2007-09-15 00:24:48 +00:00
|
|
|
|