comparison freeDiameter/tests/tests.h @ 236:60f34df3e025

Remove dependency on signalent.h
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 08 Mar 2010 14:10:30 +0900
parents 8773740401a5
children 5df55136361b
comparison
equal deleted inserted replaced
235:8773740401a5 236:60f34df3e025
54 54
55 /* Standard includes */ 55 /* Standard includes */
56 #include <getopt.h> 56 #include <getopt.h>
57 #include <time.h> 57 #include <time.h>
58 #include <libgen.h> 58 #include <libgen.h>
59 #include <signal.h>
59 60
60 /* Define the return code values */ 61 /* Define the return code values */
61 #define PASS 0 62 #define PASS 0
62 #define FAIL 1 63 #define FAIL 1
63 64
113 CHECK( 0, fd_conf_init() ); \ 114 CHECK( 0, fd_conf_init() ); \
114 CHECK( 0, fd_dict_base_protocol(fd_g_config->cnf_dict) ); \ 115 CHECK( 0, fd_dict_base_protocol(fd_g_config->cnf_dict) ); \
115 parse_cmdline(argc, argv); \ 116 parse_cmdline(argc, argv); \
116 } 117 }
117 118
119 static void test_timeout(int signal)
120 {
121 FAILTEST("The timeout (" _stringize(TEST_TIMEOUT) " sec) was reached. Use -n or change TEST_TIMEOUT if the test needs more time to execute.");
122 }
123
118 static inline void parse_cmdline(int argc, char * argv[]) { 124 static inline void parse_cmdline(int argc, char * argv[]) {
119 int c; 125 int c;
120 int no_timeout = 0; 126 int no_timeout = 0;
121 while ((c = getopt (argc, argv, "dqn")) != -1) { 127 while ((c = getopt (argc, argv, "dqn")) != -1) {
122 switch (c) { 128 switch (c) {
135 default: /* bug: option not considered. */ 141 default: /* bug: option not considered. */
136 return; 142 return;
137 } 143 }
138 } 144 }
139 fd_g_debug_lvl = (test_verbo > 0) ? (test_verbo - 1) : 0; 145 fd_g_debug_lvl = (test_verbo > 0) ? (test_verbo - 1) : 0;
140 if (!no_timeout) 146 if (!no_timeout) {
141 alarm(TEST_TIMEOUT); 147 alarm(TEST_TIMEOUT);
148 fd_sig_register(SIGALRM, "Test.harness", test_timeout);
149 }
142 } 150 }
143 151
144 #endif /* _TESTS_H */ 152 #endif /* _TESTS_H */
"Welcome to our mercurial repository"