Changeset 5ebff60 for tests/check.c
- Timestamp:
- 2015-02-20T22:50:54Z (9 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check.c
raf359b4 r5ebff60 8 8 #include "testsuite.h" 9 9 10 global_t global; 10 global_t global; /* Against global namespace pollution */ 11 11 12 12 gboolean g_io_channel_pair(GIOChannel **ch1, GIOChannel **ch2) 13 13 { 14 14 int sock[2]; 15 15 16 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, sock) < 0) { 16 17 perror("socketpair"); … … 27 28 irc_t *irc; 28 29 GIOChannel *ch1, *ch2; 29 if (!g_io_channel_pair(&ch1, &ch2)) 30 31 if (!g_io_channel_pair(&ch1, &ch2)) { 30 32 return NULL; 33 } 31 34 irc = irc_new(g_io_channel_unix_get_fd(ch1)); 32 35 return irc; … … 37 40 struct timeval time[1]; 38 41 39 gettimeofday( time, 0);40 return( (double) time->tv_sec + (double) time->tv_usec / 1000000);42 gettimeofday(time, 0); 43 return((double) time->tv_sec + (double) time->tv_usec / 1000000); 41 44 } 42 45 … … 71 74 Suite *jabber_util_suite(void); 72 75 73 int main 76 int main(int argc, char **argv) 74 77 { 75 78 int nf; … … 79 82 gboolean verbose = FALSE; 80 83 GOptionEntry options[] = { 81 { "no-fork", 'n', 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork" },82 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },84 { "no-fork", 'n', 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork" }, 85 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, 83 86 { NULL } 84 87 }; … … 87 90 g_option_context_add_main_entries(pc, options, NULL); 88 91 89 if (!g_option_context_parse(pc, &argc, &argv, NULL))92 if (!g_option_context_parse(pc, &argc, &argv, NULL)) { 90 93 return 1; 94 } 91 95 92 96 g_option_context_free(pc); … … 97 101 98 102 if (verbose) { 99 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE);103 log_link(LOGLVL_ERROR, LOGOUTPUT_CONSOLE); 100 104 #ifdef DEBUG 101 log_link( LOGLVL_DEBUG, LOGOUTPUT_CONSOLE);105 log_link(LOGLVL_DEBUG, LOGOUTPUT_CONSOLE); 102 106 #endif 103 log_link( LOGLVL_INFO, LOGOUTPUT_CONSOLE);104 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE);107 log_link(LOGLVL_INFO, LOGOUTPUT_CONSOLE); 108 log_link(LOGLVL_WARNING, LOGOUTPUT_CONSOLE); 105 109 } 106 110 107 global.conf = conf_load( 111 global.conf = conf_load(0, NULL); 108 112 global.conf->runmode = RUNMODE_DAEMON; 109 113 … … 118 122 srunner_add_suite(sr, jabber_sasl_suite()); 119 123 srunner_add_suite(sr, jabber_util_suite()); 120 if (no_fork) 124 if (no_fork) { 121 125 srunner_set_fork_status(sr, CK_NOFORK); 122 srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL); 126 } 127 srunner_run_all(sr, verbose ? CK_VERBOSE : CK_NORMAL); 123 128 nf = srunner_ntests_failed(sr); 124 129 srunner_free(sr);
Note: See TracChangeset
for help on using the changeset viewer.