diff --git a/Makefile b/Makefile index 6241dac..7fa03f0 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,14 @@ all: - (cd src; make all) + @(cd src; make all) + @(cd tests; make all) stateos: @echo OS is $(OS) clean: @echo "Cleaning..." - (cd src; make clean) + @(cd src; make clean) + @(cd tests; make clean) @rm -rf bin diff --git a/src/Makefile b/src/Makefile index ec8b689..003b84e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -29,6 +29,6 @@ $(SERVER): $(SERVEROBJS) @$(CC) $(CFLAGS) $< -o $@ clean: - @echo "Cleaning..." - @rm -f $(CLIENT) $(SERVER) $(TESTSUITE) *~ *.o *.core + @echo "Cleaning src/" + @rm -f $(CLIENT) $(SERVER) *~ *.o *.core diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..50010f2 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,28 @@ +CC = gcc +TESTSUITE = tester +TESTOBJS = test.o ../src/dns.o ../src/read.o ../src/encoding.o + +OS = `uname | tr "a-z" "A-Z"` + +LDFLAGS = -lz +CFLAGS = -c -g -Wall -D$(OS) + +all: $(TESTSUITE) + +test: $(TESTSUITE) + @./$(TESTSUITE) + +$(TESTSUITE): $(TESTOBJS) + @echo LD $@ + @$(CC) $(TESTOBJS) -o $(TESTSUITE) $(LDFLAGS) + @echo Running tests... + @./$(TESTSUITE) + +.c.o: + @echo CC $< + @$(CC) $(CFLAGS) $< -o $@ + +clean: + @echo "Cleaning tests/" + @rm -f $(TESTSUITE) *~ *.o *.core + diff --git a/tests/test.c b/tests/test.c index a2098cf..8549d8b 100644 --- a/tests/test.c +++ b/tests/test.c @@ -28,10 +28,10 @@ #include #include -#include "structs.h" -#include "encoding.h" -#include "dns.h" -#include "read.h" +#include "../src/structs.h" +#include "../src/encoding.h" +#include "../src/dns.h" +#include "../src/read.h" static void test_readputshort()