aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-07-07 15:33:31 +0200
committerJelmer Vernooij <jelmer@samba.org>2006-07-07 15:33:31 +0200
commit66b9e86eafc3709c491f96c917069db8b6a0c895 (patch)
tree2332c2527f4467adec8d354223ef42d1abd39152
parentbf25fa3627c00f80bad624bb4549c46e4b084279 (diff)
Add support for checking test suite coverage using gcov.
-rw-r--r--.bzrignore3
-rw-r--r--Makefile9
-rwxr-xr-xconfigure7
-rw-r--r--protocols/Makefile3
-rw-r--r--protocols/jabber/Makefile1
-rw-r--r--protocols/msn/Makefile3
-rw-r--r--protocols/oscar/Makefile3
-rw-r--r--protocols/yahoo/Makefile3
-rw-r--r--tests/Makefile9
-rw-r--r--tests/check_nick.c2
10 files changed, 38 insertions, 5 deletions
diff --git a/.bzrignore b/.bzrignore
index cddd9fb1..1c18013a 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -12,3 +12,6 @@ encode
bitlbee.pc
.gdb_history
tests/check
+*.gcda
+*.gcov
+*.gcno
diff --git a/Makefile b/Makefile
index 6f1d2d4a..aa4589b5 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@
# Program variables
objects = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o unix.o url.o user.o util.o
headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ini.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h url.h user.h protocols/http_client.h protocols/md5.h protocols/nogaim.h protocols/proxy.h protocols/sha.h protocols/ssl_client.h
-subdirs = protocols
+subdirs = protocols
# Expansion of variables
subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
@@ -39,14 +39,19 @@ Makefile.settings:
clean: $(subdirs)
rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode
+ $(MAKE) -C tests clean
distclean: clean $(subdirs)
rm -f Makefile.settings config.h
find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
+ $(MAKE) -C test distclean
-check:
+check: all
$(MAKE) -C tests
+gcov: check
+ gcov *.c
+
install-doc:
$(MAKE) -C doc install
diff --git a/configure b/configure
index a3c16e75..43bd2f95 100755
--- a/configure
+++ b/configure
@@ -27,6 +27,7 @@ yahoo=1
debug=0
strip=1
+gcov=0
ipv6=1
events=glib
@@ -63,6 +64,7 @@ Option Description Default
--debug=0/1 Disable/enable debugging $debug
--strip=0/1 Disable/enable binary stripping $strip
+--gcov=0/1 Disable/enable test coverage reporting $gcov
--ipv6=0/1 IPv6 socket support $ipv6
@@ -313,6 +315,11 @@ else
fi;
fi
+if [ "$gcov" = "1" ]; then
+ echo "CFLAGS+=-ftest-coverage -fprofile-arcs" >> Makefile.settings
+ echo "EFLAGS+=-lgcov" >> Makefile.settings
+fi
+
echo
if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
nick=`bzr nick`
diff --git a/protocols/Makefile b/protocols/Makefile
index b74212f4..8f58ecd6 100644
--- a/protocols/Makefile
+++ b/protocols/Makefile
@@ -25,6 +25,9 @@ LFLAGS += -r
# [SH] Phony targets
all: protocols.o
+check: all
+gcov:
+ gcov *.c
.PHONY: all clean distclean $(subdirs)
diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile
index 9b414dc8..abfc7478 100644
--- a/protocols/jabber/Makefile
+++ b/protocols/jabber/Makefile
@@ -16,6 +16,7 @@ LFLAGS += -r
# [SH] Phony targets
all: jabber_mod.o
+check: all
.PHONY: all clean distclean
diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile
index 873c831c..f53b34ba 100644
--- a/protocols/msn/Makefile
+++ b/protocols/msn/Makefile
@@ -16,6 +16,9 @@ LFLAGS += -r
# [SH] Phony targets
all: msn_mod.o
+check: all
+gcov:
+ gcov *.c
.PHONY: all clean distclean
diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile
index 97a27299..ed2d7f83 100644
--- a/protocols/oscar/Makefile
+++ b/protocols/oscar/Makefile
@@ -16,6 +16,9 @@ LFLAGS += -r
# [SH] Phony targets
all: oscar_mod.o
+check: all
+gcov:
+ gcov *.c
.PHONY: all clean distclean
diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile
index b4014f8a..34c3551a 100644
--- a/protocols/yahoo/Makefile
+++ b/protocols/yahoo/Makefile
@@ -16,6 +16,9 @@ LFLAGS += -r
# [SH] Phony targets
all: yahoo_mod.o
+check: all
+gcov:
+ gcov *.c
.PHONY: all clean distclean
diff --git a/tests/Makefile b/tests/Makefile
index ce8ed690..206331f4 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,12 +2,17 @@ include ../Makefile.settings
LFLAGS +=-lcheck
-all: check
+all: check
./check
+clean:
+ rm -f check *.o
+
main_objs = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o url.o user.o util.o
-check: check.o check_util.o check_nick.o $(addprefix ../, $(main_objs)) ../protocols/protocols.o
+test_objs = check.o check_util.o check_nick.o
+
+check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o
@echo '*' Linking $@
@$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
diff --git a/tests/check_nick.c b/tests/check_nick.c
index 5858e512..b235d260 100644
--- a/tests/check_nick.c
+++ b/tests/check_nick.c
@@ -22,7 +22,7 @@ START_TEST(test_nick_strip)
NULL };
for (i = 0; get[i]; i++) {
- char copy[30];
+ char copy[60];
strcpy(copy, get[i]);
nick_strip(copy);
fail_unless (strcmp(copy, expected[i]) == 0,