void modules_transform::apply(const context& ctx, meta_model::model& m) { tracing::scoped_transform_tracer stp(lg, "modules transform", transform_id, m.name().qualified().dot(), *ctx.tracer(), m); const auto im(gather_internal_modules(m)); create_modules(im, m); stp.end_transform(m); }
int CommonRender::restart_playback() { delete_vconsole(); create_modules(); build_virtual_console(); start_plugins(); done = 0; interrupt = 0; last_playback = 0; restart_plugins = 0; return 0; }
int main() { tai_status_t status; int i; status = tai_api_initialize(0, &g_service_table); if ( status != TAI_STATUS_SUCCESS ) { printf("failed to initialize TAI\n"); return 1; } tai_log_set(TAI_API_MODULE, TAI_LOG_LEVEL_INFO); tai_log_set(TAI_API_HOSTIF, TAI_LOG_LEVEL_INFO); tai_log_set(TAI_API_NETWORKIF, TAI_LOG_LEVEL_INFO); status = tai_api_query(TAI_API_MODULE, (void**)&module_api); if ( status != TAI_STATUS_SUCCESS ) { printf("no api for TAI_API_MODULE\n"); return 1; } printf("module_api: %p\n", module_api); status = tai_api_query(TAI_API_NETWORKIF, (void**)&network_interface_api); if ( status != TAI_STATUS_SUCCESS ) { printf("no api for TAI_API_NETWORKIF\n"); return 1; } printf("network_interface_api: %p\n", network_interface_api); status = tai_api_query(TAI_API_HOSTIF, (void**)&host_interface_api); if ( status != TAI_STATUS_SUCCESS ) { printf("no api for TAI_API_HOSTIF\n"); return 1; } printf("host_interface_api: %p\n", host_interface_api); sleep(1); create_modules(); status = tai_api_uninitialize(); if ( status != TAI_STATUS_SUCCESS ) { printf("failed to uninitialize TAI\n"); return 1; } }
int PluginArray::start_plugins(MWindow *mwindow, EDL *edl, PluginServer *plugin_server, KeyFrame *keyframe, int64_t start, int64_t end, File *file) { this->mwindow = mwindow; this->edl = edl; this->plugin_server = plugin_server; this->keyframe = keyframe; this->start = start; this->end = end; this->file = file; cache = new CICache(mwindow->preferences); buffer_size = get_bufsize(); get_recordable_tracks(); create_modules(); create_buffers(); if(!plugin_server->realtime) { PluginServer *plugin; int i; if(!plugin_server->multichannel) { // ============================ single channel plugins // start 1 plugin for each track for(i = 0; i < total_tracks(); i++) { append(plugin = new PluginServer(*plugin_server)); plugin->set_mwindow(mwindow); plugin->set_keyframe(keyframe); plugin->append_module(modules[i]); plugin->open_plugin(0, mwindow->preferences, mwindow->edl, 0); if(i == 0) plugin->set_interactive(); plugin->start_loop(start, end, buffer_size, 1); } } else { // ============================ multichannel // start 1 plugin for all tracks append(plugin = new PluginServer(*plugin_server)); plugin->set_mwindow(mwindow); plugin->set_keyframe(keyframe); for(i = 0; i < total_tracks(); i++) plugin->append_module(modules[i]); plugin->open_plugin(0, mwindow->preferences, mwindow->edl, 0); // set one plugin for progress bars plugin->set_interactive(); plugin->start_loop(start, end, buffer_size, total_tracks()); } //printf("PluginArray::start_plugins 5\n"); } else { PluginServer *plugin; int i; if(!plugin_server->multichannel) { // single channel plugins // start 1 plugin for each track for(i = 0; i < total_tracks(); i++) { append(plugin = new PluginServer(*plugin_server)); plugin->set_mwindow(mwindow); plugin->set_keyframe(keyframe); plugin->append_module(modules[i]); plugin->open_plugin(0, mwindow->preferences, mwindow->edl, 0); plugin->get_parameters(start, end, 1); plugin->init_realtime(0, 1, get_bufsize()); } } else { // multichannel // start 1 plugin for all tracks append(plugin = new PluginServer(*plugin_server)); plugin->set_mwindow(mwindow); plugin->set_keyframe(keyframe); for(i = 0; i < total_tracks(); i++) plugin->append_module(modules[i]); plugin->open_plugin(0, mwindow->preferences, mwindow->edl, 0); plugin->get_parameters(start, end, total_tracks()); plugin->init_realtime(0, total_tracks(), get_bufsize()); } } //printf("PluginArray::start_plugins 8\n"); return 0; }
/* main tests */ int main (int argc, char **argv, char **env) { argc = argc; argv = argv; env = env; int status, chld, rc; int tests = 125; int rrc; char cmd[150]; char *result, *error, *message, *output; plan(tests); mod_gm_opt = malloc(sizeof(mod_gm_opt_t)); set_default_options(mod_gm_opt); #ifdef EMBEDDEDPERL char p1[150]; snprintf(p1, 150, "--p1_file=worker/mod_gearman_p1.pl"); parse_args_line(mod_gm_opt, p1, 0); init_embedded_perl(env); #endif char options[150]; snprintf(options, 150, "--server=127.0.0.1:%d", GEARMAND_TEST_PORT); ok(parse_args_line(mod_gm_opt, options, 0) == 0, "parse_args_line()"); mod_gm_opt->debug_level = GM_LOG_ERROR; worker_logfile = my_tmpfile(); if(!ok(worker_logfile != NULL, "created temp logile: %s", worker_logfile)) { diag("could not create temp logfile"); exit( EXIT_FAILURE ); } /* first fire up a gearmand server and one worker */ start_gearmand((void*)NULL); sleep(2); start_worker((void*)NULL); sleep(2); /* wait one second and catch died procs */ while((chld = waitpid(-1, &status, WNOHANG)) != -1 && chld > 0) { diag( "waitpid() %d exited with %d\n", chld, status); status = 0; } if(!ok(gearmand_pid > 0, "'gearmand started with port %d and pid: %d", GEARMAND_TEST_PORT, gearmand_pid)) { diag("make sure gearmand is in your PATH. Common locations are /usr/sbin or /usr/local/sbin"); exit( EXIT_FAILURE ); } if(!ok(pid_alive(gearmand_pid) == TRUE, "gearmand alive")) { check_logfile("/tmp/gearmand.log", 3); kill(gearmand_pid, SIGTERM); kill(worker_pid, SIGTERM); exit( EXIT_FAILURE ); } if(!ok(worker_pid > 0, "worker started with pid: %d", worker_pid)) diag("could not start worker"); if(!ok(pid_alive(worker_pid) == TRUE, "worker alive")) { check_logfile(worker_logfile, 3); kill(gearmand_pid, SIGTERM); kill(worker_pid, SIGTERM); exit( EXIT_FAILURE ); } skip(gearmand_pid <= 0 || worker_pid <= 0, tests-3, /* Number of tests to skip */ "Skipping all tests, no need to go on without gearmand or worker"); /* create server / clients */ mod_gm_opt->transportmode = GM_ENCODE_ONLY; create_modules(); /* send big job */ send_big_jobs(GM_ENCODE_ONLY); //diag_queues(); wait_for_empty_queue("eventhandler", 20); wait_for_empty_queue("service", 20); //diag_queues(); do_result_work(1); //diag_queues(); wait_for_empty_queue(GM_DEFAULT_RESULT_QUEUE, 5); /***************************************** * test check */ //diag_queues(); test_servicecheck(GM_ENCODE_ONLY, "./t/crit.pl"); //diag_queues(); wait_for_empty_queue("eventhandler", 20); wait_for_empty_queue("service", 5); //diag_queues(); do_result_work(1); //diag_queues(); wait_for_empty_queue(GM_DEFAULT_RESULT_QUEUE, 5); //diag_queues(); like(last_result, "test plugin CRITICAL", "stdout output from ./t/crit.pl"); like(last_result, "some errors on stderr", "stderr output from ./t/crit.pl"); /***************************************** * test check2 */ //diag_queues(); test_servicecheck(GM_ENCODE_ONLY, "./t/both"); //diag_queues(); wait_for_empty_queue("eventhandler", 20); wait_for_empty_queue("service", 5); //diag_queues(); do_result_work(1); //diag_queues(); wait_for_empty_queue(GM_DEFAULT_RESULT_QUEUE, 5); like(last_result, "stdout output", "stdout output from ./t/both"); like(last_result, "stderr output", "stderr output from ./t/both"); /* try to send some data with base64 only */ //diag_queues(); test_eventhandler(GM_ENCODE_ONLY); //diag_queues(); test_servicecheck(GM_ENCODE_ONLY, NULL); //diag_queues(); wait_for_empty_queue("eventhandler", 20); wait_for_empty_queue("service", 5); //diag_queues(); do_result_work(1); //diag_queues(); wait_for_empty_queue(GM_DEFAULT_RESULT_QUEUE, 5); sleep(1); kill(worker_pid, SIGTERM); waitpid(worker_pid, &status, 0); ok(status == 0, "worker (%d) exited with exit code %d", worker_pid, real_exit_code(status)); status = 0; check_no_worker_running(worker_logfile); check_logfile(worker_logfile, 0); char * test_keys[] = { "12345", "test", "test key 123", "me make you loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong key" }; /* ignore some signals for now */ signal(SIGTERM, SIG_IGN); int i; for(i=0;i<4;i++) { mod_gm_opt->transportmode = GM_ENCODE_AND_ENCRYPT; start_worker((void *)test_keys[i]); mod_gm_crypt_init( test_keys[i] ); ok(1, "initialized with key: %s", test_keys[i]); test_eventhandler(GM_ENCODE_AND_ENCRYPT); test_servicecheck(GM_ENCODE_AND_ENCRYPT, NULL); wait_for_empty_queue("eventhandler", 20); wait_for_empty_queue("service", 5); do_result_work(1); wait_for_empty_queue(GM_DEFAULT_RESULT_QUEUE, 5); sleep(1); kill(worker_pid, SIGTERM); waitpid(worker_pid, &status, 0); ok(status == 0, "worker (%d) exited with exit code %d", worker_pid, real_exit_code(status)); status = 0; check_no_worker_running(worker_logfile); check_logfile(worker_logfile, 0); } /***************************************** * send_gearman */ snprintf(cmd, 150, "./send_gearman --server=127.0.0.1:%d --key=testtest --host=test --service=test --message=test --returncode=0", GEARMAND_TEST_PORT); rrc = real_exit_code(run_check(cmd, &result, &error)); cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc); like(result, "^\\s*$", "output from ./send_gearman"); free(result); free(error); /***************************************** * send_multi */ snprintf(cmd, 150, "./send_multi --server=127.0.0.1:%d --host=blah < t/data/send_multi.txt", GEARMAND_TEST_PORT); rrc = real_exit_code(run_check(cmd, &result, &error)); cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc); like(result, "send_multi OK: 2 check_multi child checks submitted", "output from ./send_multi"); free(result); free(error); /***************************************** * check_gearman */ snprintf(cmd, 150, "./check_gearman -H 127.0.0.1:%d -s check -a -q worker_test", GEARMAND_TEST_PORT); rrc = real_exit_code(run_check(cmd, &result, &error)); cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc); like(result, "check_gearman OK - sending background job succeded", "output from ./check_gearman"); /* cleanup */ free(result); free(error); free_client(&client); free_worker(&worker); /* shutdown gearmand */ rc = send2gearmandadmin("shutdown\n", "127.0.0.1", GEARMAND_TEST_PORT, &output, &message); ok(rc == 0, "rc of send2gearmandadmin %d", rc); like(output, "OK", "output contains OK"); free(message); free(output); /* wait 5 seconds to shutdown */ for(i=0;i<=5;i++) { waitpid(gearmand_pid, &status, WNOHANG); if(pid_alive(gearmand_pid) == FALSE) { todo(); ok(status == 0, "gearmand (%d) exited with: %d", gearmand_pid, real_exit_code(status)); endtodo; break; } sleep(1); } if(pid_alive(gearmand_pid) == TRUE) { /* kill it the hard way */ kill(gearmand_pid, SIGTERM); waitpid(gearmand_pid, &status, 0); ok(status == 0, "gearmand (%d) exited with exit code %d", gearmand_pid, real_exit_code(status)); status = 0; ok(false, "gearmand had to be killed!"); } todo(); check_logfile("/tmp/gearmand.log", status != 0 ? 2 : 0); endtodo; status = 0; kill(worker_pid, SIGTERM); waitpid(worker_pid, &status, 0); ok(status == 0, "worker (%d) exited with exit code %d", worker_pid, real_exit_code(status)); check_no_worker_running(worker_logfile); status = 0; #ifdef EMBEDDEDPERL deinit_embedded_perl(0); #endif free(last_result); free(worker_logfile); endskip; mod_gm_free_opt(mod_gm_opt); return exit_status(); }