Changeset a3a3778 for tests


Ignore:
Timestamp:
2006-12-22T17:17:08Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
5c5a586, 9225e08
Parents:
55078f5 (diff), bd28e6a (diff), a51be64 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging trees.

Location:
tests
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile

    r55078f5 ra3a3778  
    33LFLAGS +=-lcheck
    44
    5 all: check
    6         ./check
     5all: check 
     6        ./check $(CHECKFLAGS)
    77
    8 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
     8clean:
     9        rm -f check *.o
    910
    10 check: check.o check_util.o check_nick.o $(addprefix ../, $(main_objs)) ../protocols/protocols.o
     11main_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
     12
     13test_objs = check.o check_util.o check_nick.o check_md5.o check_irc.o
     14
     15check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o
    1116        @echo '*' Linking $@
    1217        @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
  • tests/check.c

    r55078f5 ra3a3778  
    44#include <check.h>
    55#include "bitlbee.h"
     6#include "testsuite.h"
    67
    78global_t global;        /* Against global namespace pollution */
     9
     10gboolean g_io_channel_pair(GIOChannel **ch1, GIOChannel **ch2)
     11{
     12        int sock[2];
     13        if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, sock) < 0) {
     14                perror("socketpair");
     15                return FALSE;
     16        }
     17
     18        *ch1 = g_io_channel_unix_new(sock[0]);
     19        *ch2 = g_io_channel_unix_new(sock[1]);
     20        return TRUE;
     21}
    822
    923double gettime()
     
    2135Suite *nick_suite(void);
    2236
    23 int main (void)
     37/* From check_md5.c */
     38Suite *md5_suite(void);
     39
     40/* From check_irc.c */
     41Suite *irc_suite(void);
     42
     43int main (int argc, char **argv)
    2444{
    2545        int nf;
    26         SRunner *sr = srunner_create(util_suite());
     46        SRunner *sr;
     47        GOptionContext *pc;
     48        gboolean no_fork = FALSE;
     49        gboolean verbose = FALSE;
     50        GOptionEntry options[] = {
     51                {"no-fork", 'n', 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork" },
     52                {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
     53                { NULL }
     54        };
     55        int i;
     56
     57        pc = g_option_context_new("");
     58        g_option_context_add_main_entries(pc, options, NULL);
     59
     60        if(!g_option_context_parse(pc, &argc, &argv, NULL))
     61                return 1;
     62
     63        g_option_context_free(pc);
     64
     65        log_init();
     66
     67        if (verbose) {
     68                log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
     69                log_link( LOGLVL_DEBUG, LOGOUTPUT_CONSOLE );
     70                log_link( LOGLVL_INFO, LOGOUTPUT_CONSOLE );
     71                log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
     72        }
     73
     74        global.conf = conf_load( 0, NULL);
     75        global.conf->runmode = RUNMODE_DAEMON;
     76
     77        sr = srunner_create(util_suite());
    2778        srunner_add_suite(sr, nick_suite());
    28         srunner_run_all (sr, CK_NORMAL);
     79        srunner_add_suite(sr, md5_suite());
     80        srunner_add_suite(sr, irc_suite());
     81        if (no_fork)
     82                srunner_set_fork_status(sr, CK_NOFORK);
     83        srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL);
    2984        nf = srunner_ntests_failed(sr);
    3085        srunner_free(sr);
  • tests/check_nick.c

    r55078f5 ra3a3778  
    66#include "irc.h"
    77#include "set.h"
    8 #include "util.h"
     8#include "misc.h"
    99
    1010START_TEST(test_nick_strip)
     
    2323
    2424        for (i = 0; get[i]; i++) {
    25                 char copy[30];
     25                char copy[60];
    2626                strcpy(copy, get[i]);
    2727                nick_strip(copy);
  • tests/check_util.c

    r55078f5 ra3a3778  
    66#include "irc.h"
    77#include "set.h"
    8 #include "util.h"
     8#include "misc.h"
    99
    1010START_TEST(test_strip_linefeed)
Note: See TracChangeset for help on using the changeset viewer.