From e9e4057237fe1ffb6594a10a6952478ee114e0ec Mon Sep 17 00:00:00 2001 From: suter Date: Tue, 30 Oct 2012 20:40:05 +0100 Subject: [PATCH] better to use a function that exists than dealing with the underlying data structure directly test two other uncovered functions while at it (update tesh accordingly) --- examples/msg/properties/msg_prop.c | 18 +++++++++++++++++- examples/msg/properties/msg_prop.tesh | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/msg/properties/msg_prop.c b/examples/msg/properties/msg_prop.c index 2347d0cd24..17fac55981 100644 --- a/examples/msg/properties/msg_prop.c +++ b/examples/msg/properties/msg_prop.c @@ -63,7 +63,7 @@ static void test_host(const char*hostname) XBT_INFO(" Property: %s old value: %s", exist, value); XBT_INFO("== Trying to modify a host property"); - xbt_dict_set(props, exist, xbt_strdup("250"), NULL); + MSG_host_set_property_value(thehost, exist, xbt_strdup("250"), NULL); /* Test if we have changed the value */ value = MSG_host_get_property_value(thehost, exist); @@ -112,11 +112,27 @@ int bob(int argc, char *argv[]) msg_error_t test_all(const char *platform_file, const char *application_file) { + int host_number; + unsigned int i; + double speed; + xbt_dynar_t hosts; + msg_host_t host; MSG_function_register("alice", alice); MSG_function_register("bob", bob); MSG_function_register("carole", carole); MSG_create_environment(platform_file); + + host_number = MSG_get_host_number(); + XBT_INFO("There are %d hosts in the environment", host_number); + + hosts = MSG_hosts_as_dynar(); + + xbt_dynar_foreach(hosts, i, host){ + XBT_INFO("Host '%s' runs at %.0f flops/s",MSG_host_get_name(host), + MSG_get_host_speed(host)); + } + MSG_launch_application(application_file); return MSG_main(); diff --git a/examples/msg/properties/msg_prop.tesh b/examples/msg/properties/msg_prop.tesh index 826705bec8..244bf33cff 100644 --- a/examples/msg/properties/msg_prop.tesh +++ b/examples/msg/properties/msg_prop.tesh @@ -4,6 +4,9 @@ p Testing a MSG application with properties in the XML for Hosts, Links and Proc ! output sort $ $SG_TEST_EXENV properties/msg_prop$EXEEXT ${srcdir:=.}/../platforms/prop.xml ${srcdir:=.}/properties/deployment_properties.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) There are 2 hosts in the environment +> [ 0.000000] (0:@) Host 'host1' runs at 1000000000 flops/s +> [ 0.000000] (0:@) Host 'host2' runs at 1000000000 flops/s > [ 0.000000] (1:alice@host1) == Print the properties of the host > [ 0.000000] (1:alice@host1) Host property: 'SG_TEST_Hdd' -> '180' > [ 0.000000] (1:alice@host1) Host property: 'SG_TEST_mem' -> '4' -- 2.20.1