5 #include "simdag/simdag.h"
11 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test");
13 int main(int argc, char **argv)
15 const SD_workstation_t *workstations;
21 xbt_dict_cursor_t cursor = NULL;
23 char noexist[] = "NoProp";
25 char exist[] = "SG_TEST_Hdd";
27 /* initialisation of SD */
30 INFO1("Usage: %s platform_file", argv[0]);
31 INFO1("example: %s sd_platform.xml", argv[0]);
34 SD_create_environment(argv[1]);
36 /* init of platform elements */
37 workstations = SD_workstation_get_list();
40 SD_workstation_set_access_mode(w2, SD_WORKSTATION_SEQUENTIAL_ACCESS);
41 name1 = SD_workstation_get_name(w1);
42 name2 = SD_workstation_get_name(w2);
45 /* The host properties can be retrived from all interfaces */
47 INFO1("Property list for workstation %s", name1);
48 /* Get the property list of the workstation 1 */
49 props = SD_workstation_get_properties(w1);
52 /* Trying to set a new property */
53 xbt_dict_set(props, xbt_strdup("NewProp"), strdup("newValue"), free);
55 /* Print the properties of the workstation 1 */
56 xbt_dict_foreach(props, cursor, key, data) {
57 INFO2("\tProperty: %s has value: %s", key, data);
60 /* Try to get a property that does not exist */
62 value = SD_workstation_get_property_value(w1, noexist);
64 INFO1("\tProperty: %s is undefined", noexist);
66 INFO2("\tProperty: %s has value: %s", noexist, value);
69 INFO1("Property list for workstation %s", name2);
70 /* Get the property list of the workstation 2 */
71 props = SD_workstation_get_properties(w2);
74 /* Print the properties of the workstation 2 */
75 xbt_dict_foreach(props, cursor, key, data) {
76 INFO2("\tProperty: %s on host: %s", key, data);
79 /* Modify an existing property test. First check it exists */
80 INFO0("Modify an existing property");
82 value = SD_workstation_get_property_value(w2, exist);
84 INFO1("\tProperty: %s is undefined", exist);
86 INFO2("\tProperty: %s old value: %s", exist, value);
87 xbt_dict_set(props, exist, strdup("250"), free);
90 /* Test if we have changed the value */
91 value = SD_workstation_get_property_value(w2, exist);
93 INFO1("\tProperty: %s is undefined", exist);
95 INFO2("\tProperty: %s new value: %s", exist, value);