void test_config( const char * config_file ) { ert_test_context_type * test_context = ert_test_context_alloc( "RUNPATH_FILE" , config_file , NULL ); enkf_main_type * enkf_main = ert_test_context_get_main( test_context ); qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main ); ert_test_context_run_worklow( test_context , "ARGECHO_WF"); { FILE * stream = util_fopen("runpath_list.txt" , "r"); char runpath_file[256]; fscanf(stream , "%s" , runpath_file ); fclose( stream ); test_assert_string_equal( runpath_file , qc_module_get_runpath_list_file( qc_module )); } ert_test_context_free( test_context ); }
void test_magic_strings( ert_test_context_type * test_context ) { enkf_main_type * enkf_main = ert_test_context_get_main( test_context ); test_assert_true( ert_test_context_run_worklow( test_context , "MAGIC_PRINT") ); test_assert_true( util_file_exists( "magic-list.txt") ); { FILE * stream = util_fopen("magic-list.txt" , "r"); char string[128]; fscanf( stream , "%s" , string); test_assert_string_equal( string , enkf_fs_get_case_name( enkf_main_get_fs( enkf_main ))); fscanf( stream , "%s" , string); test_assert_string_equal( string , "MagicAllTheWayToWorkFlow"); fclose( stream ); } }
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; }