git » nmdb » commit f919b36

Move tests to a different directory.

author Alberto Bertogli
2007-06-03 22:56:54 UTC
committer Alberto Bertogli
2007-06-03 22:56:54 UTC
parent 591e98887f6c9afe66ae724a7b26243ee418b1ae

Move tests to a different directory.

This only moves the C library tests; we'll move the other ones when more
are available.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

README +3 -3
libnmdb/Makefile +2 -24
tests/Makefile +52 -0
{libnmdb => tests}/test1c.c +0 -0
{libnmdb => tests}/test1d.c +0 -0
{libnmdb => tests}/test2c.c +0 -0
{libnmdb => tests}/test2cm.c +0 -0
{libnmdb => tests}/test2d.c +0 -0
{libnmdb => tests}/test2dm.c +0 -0
{libnmdb => tests}/test_functions.sh +0 -0
{libnmdb => tests}/timer.h +0 -0

diff --git a/README b/README
index d4712b5..47f8748 100644
--- a/README
+++ b/README
@@ -43,9 +43,9 @@ Requisites:
 To compile the server and the library, you can just use "make" on their
 directories. To install them, use "make install".
 
-To run some tests, start the server and then go to the library directory. Run
-"make tests", and then use the "test1c" and "test2c" to test the cache layer,
-and "test1d" and "test2d" to test the database backend.
+To run some tests, start the server and then go to the "tests/" directory. Run
+"make", and then use the "test1c" and "test2c" to test the cache layer, and
+"test1d" and "test2d" to test the database backend.
 
 To compile the Python bindings, you need to have the library already
 installed. Go to the directory and run "python setup.py install", which will
diff --git a/libnmdb/Makefile b/libnmdb/Makefile
index 18b4914..e467d0e 100644
--- a/libnmdb/Makefile
+++ b/libnmdb/Makefile
@@ -18,7 +18,7 @@ endif
 PREFIX=/usr/local
 
 
-OBJS = libnmdb.o test1c.o test1d.o test2c.o test2cm.o test2d.o test2dm.o
+OBJS = libnmdb.o
 
 
 default: all
@@ -35,27 +35,6 @@ libnmdb.a: libnmdb.o
 	$(AR) cr libnmdb.a libnmdb.o
 
 
-tests: test1c test1d test2c test2cm test2d test2dm
-
-test1c: test1c.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test1c.o libnmdb.a -o test1c
-
-test1d: test1d.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test1d.o libnmdb.a -o test1d
-
-test2c: test2c.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test2c.o libnmdb.a -o test2c
-
-test2cm: test2cm.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test2cm.o libnmdb.a -o test2cm
-
-test2d: test2d.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test2d.o libnmdb.a -o test2d
-
-test2dm: test2dm.o libnmdb.a
-	$(CC) $(ALL_CFLAGS) test2dm.o libnmdb.a -o test2dm
-
-
 install: libs
 	install -d $(PREFIX)/lib
 	install -m 0755 libnmdb.so $(PREFIX)/lib
@@ -74,9 +53,8 @@ install: libs
 
 clean:
 	rm -f $(OBJS) libnmdb.so libnmdb.a
-	rm -f test1c test1d test2c test2cm test2d test2dm
 	rm -f *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out
 
-.PHONY: default all libs tests install clean
+.PHONY: default all libs install clean
 
 
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..561b580
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,52 @@
+
+CFLAGS += -std=c99 -Wall -O3
+ALL_CFLAGS = -D_XOPEN_SOURCE=500 -fPIC $(CFLAGS)
+
+ifdef DEBUG
+ALL_CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
+endif
+
+ifdef STRICT
+ALL_CFLAGS += -ansi -pedantic
+endif
+
+
+OBJS = test1c.o test1d.o test2c.o test2cm.o test2d.o test2dm.o
+
+
+default: all
+
+all: tests
+
+tests: test1c test1d test2c test2cm test2d test2dm
+
+test1c: test1c.o
+	$(CC) $(ALL_CFLAGS) test1c.o -lnmdb -o test1c
+
+test1d: test1d.o
+	$(CC) $(ALL_CFLAGS) test1d.o -lnmdb -o test1d
+
+test2c: test2c.o
+	$(CC) $(ALL_CFLAGS) test2c.o -lnmdb -o test2c
+
+test2cm: test2cm.o
+	$(CC) $(ALL_CFLAGS) test2cm.o -lnmdb -o test2cm
+
+test2d: test2d.o
+	$(CC) $(ALL_CFLAGS) test2d.o -lnmdb -o test2d
+
+test2dm: test2dm.o
+	$(CC) $(ALL_CFLAGS) test2dm.o -lnmdb -o test2dm
+
+
+.c.o:
+	$(CC) $(ALL_CFLAGS) -c $< -o $@
+
+clean:
+	rm -f $(OBJS)
+	rm -f test1c test1d test2c test2cm test2d test2dm
+	rm -f *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out
+
+.PHONY: default all tests clean
+
+
diff --git a/libnmdb/test1c.c b/tests/test1c.c
similarity index 100%
rename from libnmdb/test1c.c
rename to tests/test1c.c
diff --git a/libnmdb/test1d.c b/tests/test1d.c
similarity index 100%
rename from libnmdb/test1d.c
rename to tests/test1d.c
diff --git a/libnmdb/test2c.c b/tests/test2c.c
similarity index 100%
rename from libnmdb/test2c.c
rename to tests/test2c.c
diff --git a/libnmdb/test2cm.c b/tests/test2cm.c
similarity index 100%
rename from libnmdb/test2cm.c
rename to tests/test2cm.c
diff --git a/libnmdb/test2d.c b/tests/test2d.c
similarity index 100%
rename from libnmdb/test2d.c
rename to tests/test2d.c
diff --git a/libnmdb/test2dm.c b/tests/test2dm.c
similarity index 100%
rename from libnmdb/test2dm.c
rename to tests/test2dm.c
diff --git a/libnmdb/test_functions.sh b/tests/test_functions.sh
similarity index 100%
rename from libnmdb/test_functions.sh
rename to tests/test_functions.sh
diff --git a/libnmdb/timer.h b/tests/timer.h
similarity index 100%
rename from libnmdb/timer.h
rename to tests/timer.h