9 global_t global
; /* Against global namespace pollution */
11 gboolean
g_io_channel_pair(GIOChannel
**ch1
, GIOChannel
**ch2
)
14 if (socketpair(AF_UNIX
, SOCK_STREAM
, PF_UNIX
, sock
) < 0) {
19 *ch1
= g_io_channel_unix_new(sock
[0]);
20 *ch2
= g_io_channel_unix_new(sock
[1]);
24 irc_t
*torture_irc(void)
27 GIOChannel
*ch1
, *ch2
;
28 if (!g_io_channel_pair(&ch1
, &ch2
))
30 irc
= irc_new(g_io_channel_unix_get_fd(ch1
));
36 struct timeval time
[1];
38 gettimeofday( time
, 0 );
39 return( (double) time
->tv_sec
+ (double) time
->tv_usec
/ 1000000 );
42 /* From check_util.c */
43 Suite
*util_suite(void);
45 /* From check_nick.c */
46 Suite
*nick_suite(void);
48 /* From check_md5.c */
49 Suite
*md5_suite(void);
51 /* From check_arc.c */
52 Suite
*arc_suite(void);
54 /* From check_irc.c */
55 Suite
*irc_suite(void);
57 /* From check_help.c */
58 Suite
*help_suite(void);
60 /* From check_user.c */
61 Suite
*user_suite(void);
63 /* From check_set.c */
64 Suite
*set_suite(void);
66 /* From check_jabber_sasl.c */
67 Suite
*jabber_sasl_suite(void);
69 /* From check_jabber_sasl.c */
70 Suite
*jabber_util_suite(void);
72 int main (int argc
, char **argv
)
77 gboolean no_fork
= FALSE
;
78 gboolean verbose
= FALSE
;
79 GOptionEntry options
[] = {
80 {"no-fork", 'n', 0, G_OPTION_ARG_NONE
, &no_fork
, "Don't fork" },
81 {"verbose", 'v', 0, G_OPTION_ARG_NONE
, &verbose
, "Be verbose", NULL
},
86 pc
= g_option_context_new("");
87 g_option_context_add_main_entries(pc
, options
, NULL
);
89 if(!g_option_context_parse(pc
, &argc
, &argv
, NULL
))
92 g_option_context_free(pc
);
96 setlocale(LC_CTYPE
, "");
99 log_link( LOGLVL_ERROR
, LOGOUTPUT_CONSOLE
);
101 log_link( LOGLVL_DEBUG
, LOGOUTPUT_CONSOLE
);
103 log_link( LOGLVL_INFO
, LOGOUTPUT_CONSOLE
);
104 log_link( LOGLVL_WARNING
, LOGOUTPUT_CONSOLE
);
107 global
.conf
= conf_load( 0, NULL
);
108 global
.conf
->runmode
= RUNMODE_DAEMON
;
110 sr
= srunner_create(util_suite());
111 srunner_add_suite(sr
, nick_suite());
112 srunner_add_suite(sr
, md5_suite());
113 srunner_add_suite(sr
, arc_suite());
114 srunner_add_suite(sr
, irc_suite());
115 srunner_add_suite(sr
, help_suite());
116 srunner_add_suite(sr
, user_suite());
117 srunner_add_suite(sr
, set_suite());
118 srunner_add_suite(sr
, jabber_sasl_suite());
119 srunner_add_suite(sr
, jabber_util_suite());
121 srunner_set_fork_status(sr
, CK_NOFORK
);
122 srunner_run_all (sr
, verbose
?CK_VERBOSE
:CK_NORMAL
);
123 nf
= srunner_ntests_failed(sr
);
125 return (nf
== 0) ? EXIT_SUCCESS
: EXIT_FAILURE
;