Changeset 729:5d8ac5da7092 in freeDiameter for tests/tests.h
- Timestamp:
- Feb 24, 2011, 5:19:14 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/tests.h
r695 r729 77 77 (void)fd_core_shutdown(); \ 78 78 (void)fd_core_wait_shutdown_complete(); \ 79 (void)fd_thr_term(& timeout_thr);\79 (void)fd_thr_term(&signal_thr); \ 80 80 exit(PASS); \ 81 81 } … … 105 105 } 106 106 107 static pthread_t timeout_thr;108 static void * timeout_catch(void * arg)107 static pthread_t signal_thr; 108 static void * signal_catch(void * arg) 109 109 { 110 110 int sig; 111 111 sigset_t ss; 112 fd_log_threadname ( " Test alarmcatcher" );112 fd_log_threadname ( "Signal catcher" ); 113 113 114 114 sigemptyset(&ss); 115 116 /* We use SIGALRM */ 115 117 sigaddset(&ss, SIGALRM); 116 118 119 /* Unblock any other signal for this thread, so that default handler is enabled */ 120 CHECK_SYS_DO( pthread_sigmask( SIG_SETMASK, &ss, NULL ), ); 121 122 /* Now wait for sigwait or cancelation */ 117 123 CHECK_POSIX_DO( sigwait(&ss, &sig), ); 118 119 124 FAILTEST("The timeout (" _stringize(TEST_TIMEOUT) " sec) was reached. Use -n or change TEST_TIMEOUT if the test needs more time to execute."); 120 125 … … 165 170 if (!no_timeout) { 166 171 alarm(TEST_TIMEOUT); 167 CHECK( 0, pthread_create(&timeout_thr, NULL, timeout_catch, NULL) );168 172 } 173 CHECK( 0, pthread_create(&signal_thr, NULL, signal_catch, NULL) ); 169 174 } 170 175 171 176 static inline void test_init(int argc, char * argv[], char *fname) 172 177 { 178 sigset_t sig_all; 179 sigfillset(&sig_all); 180 181 CHECK( 0, pthread_sigmask(SIG_BLOCK, &sig_all, NULL)); 182 173 183 memset(fd_g_config, 0, sizeof(struct fd_config)); 174 184 … … 176 186 177 187 fd_log_threadname(basename(fname)); 188 189 /* Parse the command line */ 190 parse_cmdline(argc, argv); 178 191 179 192 /* Initialize gcrypt and gnutls */ … … 194 207 CHECK( 0, fd_sess_start() ); 195 208 196 /* Parse the command line */197 parse_cmdline(argc, argv);198 199 209 return; 200 210 }
Note: See TracChangeset
for help on using the changeset viewer.