From 20427e1463985c071ac551547d0906e282b43520 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 7 Nov 2011 14:11:01 +0100 Subject: [PATCH] fix the last broken tests by sanitizing the way properties are handled during the parse --- include/simgrid/platf.h | 1 + src/surf/cpu.c | 3 +-- src/surf/cpu_im.c | 3 +-- src/surf/cpu_ti.c | 3 +-- src/surf/network_constant.c | 6 ++---- src/surf/surfxml_parse.c | 4 ++++ src/surf/workstation_ptask_L07.c | 3 +-- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 79aee43c32..fc3704c863 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -39,6 +39,7 @@ typedef struct { e_surf_resource_state_t V_host_state_initial; //state tmgr_trace_t V_host_state_trace; //state file const char* V_host_coord; + xbt_dict_t properties; } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t; typedef struct { diff --git a/src/surf/cpu.c b/src/surf/cpu.c index fe1b2f2829..b7012df444 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -82,8 +82,7 @@ static void parse_cpu_init(sg_platf_host_cbarg_t host) host->V_host_core, host->V_host_state_initial, host->V_host_state_trace, - current_property_set); - current_property_set = NULL; + host->properties); } static void add_traces_cpu(void) diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 01630f28b7..ada8774b7b 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -97,8 +97,7 @@ static void parse_cpu_im_init(sg_platf_host_cbarg_t host) host->V_host_core, host->V_host_state_initial, host->V_host_state_trace, - current_property_set); - current_property_set = NULL; + host->properties); } static void cpu_im_add_traces_cpu(void) diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index 206e7dd993..7c1a1a6e30 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -199,8 +199,7 @@ static void parse_cpu_ti_init(sg_platf_host_cbarg_t host) host->V_host_core, host->V_host_state_initial, host->V_host_state_trace, - current_property_set); - current_property_set = NULL; + host->properties); } diff --git a/src/surf/network_constant.c b/src/surf/network_constant.c index a94f7acc42..c733bc8d3b 100644 --- a/src/surf/network_constant.c +++ b/src/surf/network_constant.c @@ -21,13 +21,11 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); static random_data_t random_latency = NULL; static int host_number_int = 0; -static void netcste_count_hosts(sg_platf_host_cbarg_t h) -{ +static void netcste_count_hosts(sg_platf_host_cbarg_t h) { host_number_int++; } -static void netcste_define_callbacks(void) -{ +static void netcste_define_callbacks(void) { sg_platf_host_add_cb(netcste_count_hosts); } diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index ffa11fc1a9..69f87cad8b 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -292,6 +292,9 @@ void STag_surfxml_host(void){ s_sg_platf_host_cbarg_t host; memset(&host,0,sizeof(host)); + xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)"); + host.properties = current_property_set = xbt_dict_new(); + host.V_host_id = A_surfxml_host_id; host.V_host_power_peak = get_cpu_power(A_surfxml_host_power); host.V_host_power_scale = surf_parse_get_double( A_surfxml_host_availability); @@ -309,6 +312,7 @@ void STag_surfxml_host(void){ sg_platf_new_host(&host); } void ETag_surfxml_host(void){ + current_property_set = NULL; surfxml_call_cb_functions(ETag_surfxml_host_cb_list); } diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index ac1c51c768..087e1a7412 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -663,8 +663,7 @@ static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host) host->V_host_power_trace, host->V_host_state_initial, host->V_host_state_trace, - current_property_set); - current_property_set=NULL; + host->properties); } static void* ptask_link_create_resource(const char *name, -- 2.20.1