int main(int argc, const char *argv[]) { if(setup_cli(argc, argv) == -1) { usage(argv[0]); return EXIT_FAILURE; } config.syslog = 0; config.loglevel = CRIT; config.bufsize = 16384; struct node_conf conf = {NULL, 0}; struct context ctx; context_init(&ctx); memcpy(&config.node, &conf, sizeof(config.node)); slot_init_updater(&ctx); RUN_CASE(test_slot); RUN_CASE(test_hash); RUN_CASE(test_parser); RUN_CASE(test_cmd); RUN_CASE(test_server); RUN_CASE(test_dict); RUN_CASE(test_socket); RUN_CASE(test_client); RUN_CASE(test_timer); RUN_CASE(test_config); usleep(10000); slot_create_job(SLOT_UPDATER_QUIT); pthread_join(ctx.thread, NULL); report(); return manager.failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }
int main(int argc, const char *argv[]) { if(setup_cli(argc, argv) == -1) { usage(argv[0]); return EXIT_FAILURE; } config.syslog = 0; config.loglevel = CRIT; config.bufsize = 16384; config.thread = 1; struct node_conf conf = {NULL, 0}; build_contexts(); struct context *contexts = get_contexts(); memcpy(&config.node, &conf, sizeof(config.node)); slot_start_manager(&contexts[config.thread]); RUN_CASE(test_slot); RUN_CASE(test_hash); RUN_CASE(test_parser); RUN_CASE(test_cmd); RUN_CASE(test_server); RUN_CASE(test_dict); RUN_CASE(test_socket); RUN_CASE(test_client); RUN_CASE(test_timer); RUN_CASE(test_config); RUN_CASE(test_stats); RUN_CASE(test_mbuf); RUN_CASE(test_slowlog); usleep(10000); slot_create_job(SLOT_UPDATER_QUIT); pthread_join(contexts[config.thread].thread, NULL); for (int i = 0; i <= config.thread; i++) { context_free(&contexts[i]); } destroy_contexts(); report(); return manager.failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }