예제 #1
0
파일: job_queue.c 프로젝트: agchitu/ert
job_queue_type * job_queue_alloc(int  max_submit               ,
                                 const char * ok_file ,
                                 const char * status_file ,
                                 const char * exit_file ) {



  job_queue_type * queue  = util_malloc(sizeof * queue );
  UTIL_TYPE_ID_INIT( queue , JOB_QUEUE_TYPE_ID);
  queue->usleep_time      = 250000; /* 1000000 : 1 second */
  queue->max_ok_wait_time = 60;
  queue->max_duration     = 0;
  queue->stop_time        = 0;
  queue->max_submit       = max_submit;
  queue->driver           = NULL;
  queue->ok_file          = util_alloc_string_copy( ok_file );
  queue->exit_file        = util_alloc_string_copy( exit_file );
  queue->status_file      = util_alloc_string_copy( status_file );
  queue->open             = true;
  queue->user_exit        = false;
  queue->pause_on         = false;
  queue->running          = false;
  queue->submit_complete  = false;
  queue->work_pool        = NULL;
  queue->job_list         = job_list_alloc(  );
  queue->status           = job_queue_status_alloc( );

  pthread_mutex_init( &queue->run_mutex    , NULL );

  return queue;
}
예제 #2
0
void test_add_job() {
  job_list_type * list = job_list_alloc();
  job_queue_node_type * node = job_queue_node_alloc_simple("name" , "/tmp" , "/bin/ls" , 0 , NULL);
  job_list_add_job( list , node );
  test_assert_int_equal( job_list_get_size( list ) , 1 );
  test_assert_int_equal( job_queue_node_get_queue_index(node) ,  0 );
  test_assert_ptr_equal( node , job_list_iget_job(list , 0));
  {
    arg_pack_type * arg_pack = arg_pack_alloc( );
    arg_pack_append_ptr( arg_pack , list );
    arg_pack_append_ptr( arg_pack , node );
    test_assert_util_abort("job_queue_node_set_queue_index", call_add_job, arg_pack );
    arg_pack_free( arg_pack );
  }
  test_assert_util_abort("job_list_iget_job", call_iget_job, list);
  job_list_reset( list );
  test_assert_int_equal( 0 , job_list_get_size( list ));
  job_list_free( list );
}
예제 #3
0
파일: main.c 프로젝트: grugq/tg-community
static void set_defaults( struct opdis_options * opts ) {
	opts->jobs = job_list_alloc();
	opts->map = mem_map_alloc();
	opts->targets = tgt_list_alloc();
	opts->opdis = opdis_init();
	opts->insn_tree = opdis_insn_tree_init( 1 );
	opts->output_file = stdout;

	// TODO get first available arch
	// TODO: use 64-bit detection?
	opts->arch_str = "i386";
	opts->arch = bfd_mach_i386_i386;

	opts->syntax_str = "att";
	opts->syntax = opdis_x86_syntax_att;

	opts->fmt_str = "dump";
	opts->fmt = asmfmt_dump;


	opts->disasm_opts = "";
}
예제 #4
0
void test_create() {
  job_list_type * list = job_list_alloc();
  test_assert_true( job_list_is_instance( list ));
  test_assert_int_equal( 0 , job_list_get_size( list ));
  job_list_free( list );
}