From 66b9e86eafc3709c491f96c917069db8b6a0c895 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Jul 2006 15:33:31 +0200 Subject: Add support for checking test suite coverage using gcov. --- .bzrignore | 3 +++ Makefile | 9 +++++++-- configure | 7 +++++++ protocols/Makefile | 3 +++ protocols/jabber/Makefile | 1 + protocols/msn/Makefile | 3 +++ protocols/oscar/Makefile | 3 +++ protocols/yahoo/Makefile | 3 +++ tests/Makefile | 9 +++++++-- tests/check_nick.c | 2 +- 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, -- cgit v1.2.3 From f4aa393b221dcc709f189ed04945ee67e956872a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Jul 2006 15:34:01 +0200 Subject: Ignore *.o files (removed from global ignores in bzr 0.9) --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 1c18013a..12dd9c10 100644 --- a/.bzrignore +++ b/.bzrignore @@ -15,3 +15,4 @@ tests/check *.gcda *.gcov *.gcno +*.o -- cgit v1.2.3 From bd28e6a2eec0333a866ef2e380d32b1e6ad0c80b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 24 Oct 2006 12:40:28 +0200 Subject: MSN message packets are now sent at once instead of separately. Probably the MSN servers don't care, but it looks a bit prettier in wireshark. ;-) --- protocols/msn/sb.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index 63744cd0..7ec340bd 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -121,9 +121,10 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text ) { if( sb->ready ) { - char cmd[1024], *buf; + char *packet, *buf; int i, j; + /* Build the message. Convert LF to CR-LF for normal messages. */ if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 ) { buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 ); @@ -141,19 +142,21 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text ) else { i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username ); - buf = g_new0( char, strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username ) ); + buf = g_new0( char, i ); i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username ); } - g_snprintf( cmd, sizeof( cmd ), "MSG %d N %d\r\n", ++sb->trId, i ); - if( msn_sb_write( sb, cmd, strlen( cmd ) ) && msn_sb_write( sb, buf, i ) ) + /* Build the final packet (MSG command + the message). */ + packet = g_strdup_printf( "MSG %d N %d\r\n%s", ++sb->trId, i, buf ); + g_free( buf ); + if( msn_sb_write( sb, packet, strlen( packet ) ) ) { - g_free( buf ); + g_free( packet ); return( 1 ); } else { - g_free( buf ); + g_free( packet ); return( 0 ); } } -- cgit v1.2.3 From 7740c4caae24fe8186947d0f1f6a114098daa171 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 5 Dec 2006 23:57:02 +0100 Subject: Fix xslt with newer (more pedantic) XSLT processors. --- doc/user-guide/docbook.xsl | 1 + doc/user-guide/help.xsl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/doc/user-guide/docbook.xsl b/doc/user-guide/docbook.xsl index 9adff305..21d6b08e 100644 --- a/doc/user-guide/docbook.xsl +++ b/doc/user-guide/docbook.xsl @@ -82,6 +82,7 @@ + cmd_ diff --git a/doc/user-guide/help.xsl b/doc/user-guide/help.xsl index dec6a671..b7e3c371 100644 --- a/doc/user-guide/help.xsl +++ b/doc/user-guide/help.xsl @@ -30,6 +30,7 @@ + Processing: ? @@ -121,6 +122,7 @@ + Processing command '' ? -- cgit v1.2.3 From 2c7df621d2337437a46b0ccee6a7801bc04db8f4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Dec 2006 13:15:09 +0100 Subject: Fix testsuite. --- lib/Makefile | 2 ++ tests/Makefile | 4 ++-- tests/check_nick.c | 2 +- tests/check_util.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 6408c5ba..b1bddb3e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -17,6 +17,8 @@ LFLAGS += -r # [SH] Phony targets all: lib.o +check: + .PHONY: all clean distclean clean: $(subdirs) diff --git a/tests/Makefile b/tests/Makefile index 206331f4..f0456063 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,11 +8,11 @@ all: 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 +main_objs = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_xml.o storage_text.o user.o test_objs = check.o check_util.o check_nick.o -check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o +check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o @echo '*' Linking $@ @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS) diff --git a/tests/check_nick.c b/tests/check_nick.c index b235d260..714c4fdc 100644 --- a/tests/check_nick.c +++ b/tests/check_nick.c @@ -5,7 +5,7 @@ #include #include "irc.h" #include "set.h" -#include "util.h" +#include "misc.h" START_TEST(test_nick_strip) { diff --git a/tests/check_util.c b/tests/check_util.c index e771238f..ee365735 100644 --- a/tests/check_util.c +++ b/tests/check_util.c @@ -5,7 +5,7 @@ #include #include "irc.h" #include "set.h" -#include "util.h" +#include "misc.h" START_TEST(test_strip_linefeed) { -- cgit v1.2.3 From 6a909671115ba5fac94c212c249264bf25ec8840 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Dec 2006 14:26:22 +0100 Subject: Add tests for md5. --- tests/Makefile | 2 +- tests/check.c | 18 ++++++++++++++++++ tests/check_md5.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testsuite.h | 6 ++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tests/check_md5.c create mode 100644 tests/testsuite.h diff --git a/tests/Makefile b/tests/Makefile index f0456063..6a97e8ac 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -10,7 +10,7 @@ clean: main_objs = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_xml.o storage_text.o user.o -test_objs = check.o check_util.o check_nick.o +test_objs = check.o check_util.o check_nick.o check_md5.o check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o @echo '*' Linking $@ diff --git a/tests/check.c b/tests/check.c index 5cfb7dfd..294580b7 100644 --- a/tests/check.c +++ b/tests/check.c @@ -3,9 +3,23 @@ #include #include #include "bitlbee.h" +#include "testsuite.h" global_t global; /* Against global namespace pollution */ +gboolean g_io_channel_pair(GIOChannel **ch1, GIOChannel **ch2) +{ + int sock[2]; + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, sock) < 0) { + perror("socketpair"); + return FALSE; + } + + *ch1 = g_io_channel_unix_new(sock[0]); + *ch2 = g_io_channel_unix_new(sock[1]); + return TRUE; +} + double gettime() { struct timeval time[1]; @@ -20,11 +34,15 @@ Suite *util_suite(void); /* From check_nick.c */ Suite *nick_suite(void); +/* From check_md5.c */ +Suite *md5_suite(void); + int main (void) { int nf; SRunner *sr = srunner_create(util_suite()); srunner_add_suite(sr, nick_suite()); + srunner_add_suite(sr, md5_suite()); srunner_run_all (sr, CK_NORMAL); nf = srunner_ntests_failed(sr); srunner_free(sr); diff --git a/tests/check_md5.c b/tests/check_md5.c new file mode 100644 index 00000000..4b99d300 --- /dev/null +++ b/tests/check_md5.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include +#include "md5.h" + +/* From RFC 1321 */ +struct md5_test { + const char *str; + md5_byte_t expected[16]; +} tests[] = { + { "", + { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } }, + { "a", + { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } }, + { "abc", + { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } }, + { "message digest", + { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, + { "abcdefghijklmnopqrstuvwxyz", + { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } }, + { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, + + { NULL }, +}; + +static void check_sums(int l) +{ + int i; + for (i = 0; tests[i].str; i++) { + md5_byte_t sum[16]; + tcase_fn_start (tests[i].str, __FILE__, __LINE__); + md5_state_t state; + int di; + + md5_init(&state); + md5_append(&state, (const md5_byte_t *)tests[i].str, strlen(tests[i].str)); + md5_finish(&state, sum); + + fail_if(memcmp(tests[i].expected, sum, 16) != 0, "%s failed", tests[i].str); + } +} + +Suite *md5_suite (void) +{ + Suite *s = suite_create("MD5"); + TCase *tc_core = tcase_create("Core"); + suite_add_tcase (s, tc_core); + tcase_add_test (tc_core, check_sums); + return s; +} diff --git a/tests/testsuite.h b/tests/testsuite.h new file mode 100644 index 00000000..dacaf8a3 --- /dev/null +++ b/tests/testsuite.h @@ -0,0 +1,6 @@ +#ifndef __BITLBEE_CHECK_H__ +#define __BITLBEE_CHECK_H__ + +gboolean g_io_channel_pair(GIOChannel **ch1, GIOChannel **ch2); + +#endif /* __BITLBEE_CHECK_H__ */ -- cgit v1.2.3 From 3b4cc8f0af7a4d9e1fae69e12a438b15f9206003 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Dec 2006 14:34:15 +0100 Subject: Support arguments passed to tests/check to enable verbose logging or to disable forking (for debugging purposes). --- tests/check.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/check.c b/tests/check.c index 294580b7..6cba4302 100644 --- a/tests/check.c +++ b/tests/check.c @@ -37,13 +37,35 @@ Suite *nick_suite(void); /* From check_md5.c */ Suite *md5_suite(void); -int main (void) +int main (int argc, char **argv) { int nf; - SRunner *sr = srunner_create(util_suite()); + SRunner *sr; + GOptionContext *pc; + gboolean no_fork = FALSE; + gboolean verbose = FALSE; + GOptionEntry options[] = { + {"no-fork", 'n', 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork" }, + {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, + { NULL } + }; + int i; + + pc = g_option_context_new(""); + g_option_context_add_main_entries(pc, options, NULL); + + if(!g_option_context_parse(pc, &argc, &argv, NULL)) + return 1; + + g_option_context_free(pc); + + + sr = srunner_create(util_suite()); srunner_add_suite(sr, nick_suite()); srunner_add_suite(sr, md5_suite()); - srunner_run_all (sr, CK_NORMAL); + if (no_fork) + srunner_set_fork_status(sr, CK_NOFORK); + srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL); nf = srunner_ntests_failed(sr); srunner_free(sr); return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -- cgit v1.2.3 From 7bcdde3d31f0e5b53601b90aa33ebd820c770172 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Dec 2006 14:57:25 +0100 Subject: Some simple tests for irc_*() --- tests/Makefile | 4 ++-- tests/check.c | 15 +++++++++++++ tests/check_irc.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 tests/check_irc.c diff --git a/tests/Makefile b/tests/Makefile index 6a97e8ac..9dd3df7c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,14 +3,14 @@ include ../Makefile.settings LFLAGS +=-lcheck all: check - ./check + ./check $(CHECKFLAGS) clean: rm -f check *.o main_objs = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_xml.o storage_text.o user.o -test_objs = check.o check_util.o check_nick.o check_md5.o +test_objs = check.o check_util.o check_nick.o check_md5.o check_irc.o check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o @echo '*' Linking $@ diff --git a/tests/check.c b/tests/check.c index 6cba4302..42ff067f 100644 --- a/tests/check.c +++ b/tests/check.c @@ -37,6 +37,9 @@ Suite *nick_suite(void); /* From check_md5.c */ Suite *md5_suite(void); +/* From check_irc.c */ +Suite *irc_suite(void); + int main (int argc, char **argv) { int nf; @@ -59,10 +62,22 @@ int main (int argc, char **argv) g_option_context_free(pc); + log_init(); + + if (verbose) { + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_DEBUG, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_INFO, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); + } + + global.conf = conf_load( 0, NULL); + global.conf->runmode = RUNMODE_DAEMON; sr = srunner_create(util_suite()); srunner_add_suite(sr, nick_suite()); srunner_add_suite(sr, md5_suite()); + srunner_add_suite(sr, irc_suite()); if (no_fork) srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL); diff --git a/tests/check_irc.c b/tests/check_irc.c new file mode 100644 index 00000000..c1cf05a5 --- /dev/null +++ b/tests/check_irc.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include +#include +#include "irc.h" +#include "testsuite.h" + +START_TEST(test_connect) + GIOChannel *ch1, *ch2; + irc_t *irc; + char *raw; + fail_unless(g_io_channel_pair(&ch1, &ch2)); + + irc = irc_new(g_io_channel_unix_get_fd(ch1)); + + irc_free(irc); + + fail_unless(g_io_channel_read_to_end(ch2, &raw, NULL, NULL) == G_IO_STATUS_NORMAL); + + fail_if(strcmp(raw, "") != 0); + + g_free(raw); +END_TEST + +START_TEST(test_login) + GIOChannel *ch1, *ch2; + irc_t *irc; + GError *error = NULL; + char *raw; + fail_unless(g_io_channel_pair(&ch1, &ch2)); + + g_io_channel_set_flags(ch1, G_IO_FLAG_NONBLOCK, NULL); + g_io_channel_set_flags(ch2, G_IO_FLAG_NONBLOCK, NULL); + + irc = irc_new(g_io_channel_unix_get_fd(ch1)); + + fail_unless(g_io_channel_write_chars(ch2, "NICK bla\r\n" + "USER a a a a\r\n", -1, NULL, NULL) == G_IO_STATUS_NORMAL); + fail_unless(g_io_channel_flush(ch2, NULL) == G_IO_STATUS_NORMAL); + + g_main_iteration(FALSE); + irc_free(irc); + + fail_unless(g_io_channel_read_to_end(ch2, &raw, NULL, NULL) == G_IO_STATUS_NORMAL); + + fail_unless(strstr(raw, "001") != NULL); + fail_unless(strstr(raw, "002") != NULL); + fail_unless(strstr(raw, "003") != NULL); + fail_unless(strstr(raw, "004") != NULL); + fail_unless(strstr(raw, "005") != NULL); + + g_free(raw); +END_TEST + +Suite *irc_suite (void) +{ + Suite *s = suite_create("IRC"); + TCase *tc_core = tcase_create("Core"); + suite_add_tcase (s, tc_core); + tcase_add_test (tc_core, test_connect); + tcase_add_test (tc_core, test_login); + return s; +} -- cgit v1.2.3 From a51be6448b7a6aa100f27873ce40b835068a66a7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Dec 2006 15:16:56 +0100 Subject: Fix gcov. --- lib/Makefile | 5 +++-- protocols/jabber/Makefile | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index b1bddb3e..33073c27 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -16,8 +16,9 @@ LFLAGS += -r # [SH] Phony targets all: lib.o - -check: +check: all +gcov: + gcov *.c .PHONY: all clean distclean diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile index abfc7478..27a29be4 100644 --- a/protocols/jabber/Makefile +++ b/protocols/jabber/Makefile @@ -17,6 +17,8 @@ LFLAGS += -r # [SH] Phony targets all: jabber_mod.o check: all +gcov: + gcov *.c .PHONY: all clean distclean -- cgit v1.2.3