示例#1
0
bool ert_test_context_install_workflow_job( ert_test_context_type * test_context , const char * job_name , const char * job_file) {
  if (util_file_exists( job_file )) {
    enkf_main_type * enkf_main = ert_test_context_get_main( test_context );
    ert_workflow_list_type * workflow_list = enkf_main_get_workflow_list( enkf_main );
    ert_workflow_list_add_job( workflow_list , job_name , job_file );
    return ert_workflow_list_has_job( workflow_list , job_name );
  } else
    return false;
}
示例#2
0
bool ert_test_context_run_worklow_job( ert_test_context_type * test_context , const char * job_name, const stringlist_type * args) {
  enkf_main_type * enkf_main = ert_test_context_get_main( test_context );
  ert_workflow_list_type * workflow_list = enkf_main_get_workflow_list( enkf_main );

  if (ert_workflow_list_has_job( workflow_list , job_name )) {
    bool status;
    {
      char * workflow = util_alloc_sprintf("WORKFLOW-%06d" , rng_get_int( test_context->rng , 1000000));
      {
        FILE * stream = util_fopen( workflow , "w");
        ert_test_context_fwrite_workflow_job( stream , job_name , args );
        fclose(stream);
      }
      ert_test_context_install_workflow( test_context , workflow , workflow);
      status = ert_test_context_run_worklow( test_context , workflow );
      free(workflow);
    }
    return status;
  } else
    return false;
}
void test_has_job(ert_test_context_type * test_context ) {
  enkf_main_type * enkf_main = ert_test_context_get_main( test_context );
  ert_workflow_list_type * workflows = enkf_main_get_workflow_list( enkf_main );
  test_assert_true( ert_workflow_list_has_job( workflows , "MAGIC_PRINT" ));
}