int main(int argc, char **argv) { int i,j; double ratio; #ifdef _WIN32 WORD wVersionRequested = MAKEWORD(2,2); WSADATA wsaData; (void) WSAStartup(wVersionRequested, &wsaData); #endif #ifndef _WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) return 1; #endif for (i = 1; i < argc; ++i) { for (j = 0; options[j].name; ++j) { if (!strcmp(argv[i],options[j].name)) { if (handle_option(argc,argv,&i,&options[j])<0) return 1; goto again; } } fprintf(stderr, "Unknown option '%s'\n", argv[i]); usage(); return 1; again: ; } if (cfg_help) { usage(); return 0; } cfg_tick.tv_sec = cfg_tick_msec / 1000; cfg_tick.tv_usec = (cfg_tick_msec % 1000)*1000; seconds_per_tick = ratio = cfg_tick_msec / 1000.0; cfg_connlimit *= ratio; cfg_grouplimit *= ratio; { struct timeval tv; evutil_gettimeofday(&tv, NULL); #ifdef _WIN32 srand(tv.tv_usec); #else srandom(tv.tv_usec); #endif } #ifndef EVENT__DISABLE_THREAD_SUPPORT evthread_enable_lock_debugging(); #endif return test_ratelimiting(); }
int main(int argc, const char **argv) { #ifdef _WIN32 WORD wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD(2, 2); (void) WSAStartup(wVersionRequested, &wsaData); #endif #ifndef _WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) return 1; #endif #ifdef _WIN32 tinytest_skip(testgroups, "http/connection_retry"); tinytest_skip(testgroups, "http/https_connection_retry"); #endif #ifndef EVENT__DISABLE_THREAD_SUPPORT if (!getenv("EVENT_NO_DEBUG_LOCKS")) evthread_enable_lock_debugging(); #endif if (getenv("EVENT_DEBUG_MODE")) { event_enable_debug_mode(); libevent_tests_running_in_debug_mode = 1; } if (getenv("EVENT_DEBUG_LOGGING_ALL")) { event_enable_debug_logging(EVENT_DBG_ALL); } tinytest_set_aliases(testaliases); evutil_weakrand_seed_(&test_weakrand_state, 0); if (tinytest_main(argc,argv,testgroups)) return 1; libevent_global_shutdown(); return 0; }
/* misspelled version for backward compatibility */ void evthread_enable_lock_debuging(void) { evthread_enable_lock_debugging(); }