Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a172a49155724e1f88a5781f155d1b046ac1e4d6
[simgrid.git] / src / xbt / config.cpp
1 /* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.     */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <cstdio>
7
8 #include <algorithm>
9 #include <cerrno>
10 #include <cstring>
11 #include <climits>
12
13 #include <functional>
14 #include <map>
15 #include <stdexcept>
16 #include <string>
17 #include <string>
18 #include <type_traits>
19 #include <typeinfo>
20 #include <vector>
21
22 #include "simgrid/sg_config.hpp"
23 #include "xbt/dynar.h"
24 #include "xbt/log.h"
25 #include "xbt/misc.h"
26 #include "xbt/sysdep.h"
27 #include <xbt/config.h>
28 #include <xbt/config.hpp>
29 #include <xbt/ex.hpp>
30
31 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
32
33 XBT_EXPORT_NO_IMPORT xbt_cfg_t simgrid_config = nullptr;
34
35 namespace simgrid {
36 namespace config {
37
38 namespace {
39
40 const char* true_values[] = {
41   "yes", "on", "true", "1"
42 };
43 const char* false_values[] = {
44   "no", "off", "false", "0"
45 };
46
47 static bool parse_bool(const char* value)
48 {
49   for (const char* const& true_value : true_values)
50     if (std::strcmp(true_value, value) == 0)
51       return true;
52   for (const char* const& false_value : false_values)
53     if (std::strcmp(false_value, value) == 0)
54       return false;
55   throw std::range_error("not a boolean");
56 }
57
58 static double parse_double(const char* value)
59 {
60   char* end;
61   errno = 0;
62   double res = std::strtod(value, &end);
63   if (errno == ERANGE)
64     throw std::range_error("out of range");
65   else if (errno)
66     xbt_die("Unexpected errno");
67   if (end == value || *end != '\0')
68     throw std::range_error("invalid double");
69   else
70     return res;
71 }
72
73 static long int parse_long(const char* value)
74 {
75   char* end;
76   errno = 0;
77   long int res = std::strtol(value, &end, 0);
78   if (errno) {
79     if (res == LONG_MIN && errno == ERANGE)
80       throw std::range_error("underflow");
81     else if (res == LONG_MAX && errno == ERANGE)
82       throw std::range_error("overflow");
83     xbt_die("Unexpected errno");
84   }
85   if (end == value || *end != '\0')
86     throw std::range_error("invalid integer");
87   else
88     return res;
89 }
90
91 // ***** ConfigType *****
92
93 /// A trait which define possible options types:
94 template <class T> class ConfigType;
95
96 template <> class ConfigType<int> {
97 public:
98   static constexpr const char* type_name = "int";
99   static inline double parse(const char* value)
100   {
101     return parse_long(value);
102   }
103 };
104 template <> class ConfigType<double> {
105 public:
106   static constexpr const char* type_name = "double";
107   static inline double parse(const char* value)
108   {
109     return parse_double(value);
110   }
111 };
112 template <> class ConfigType<std::string> {
113 public:
114   static constexpr const char* type_name = "string";
115   static inline std::string parse(const char* value)
116   {
117     return std::string(value);
118   }
119 };
120 template <> class ConfigType<bool> {
121 public:
122   static constexpr const char* type_name = "boolean";
123   static inline bool parse(const char* value)
124   {
125     return parse_bool(value);
126   }
127 };
128
129 // **** Forward declarations ****
130
131 class ConfigurationElement ;
132 template<class T> class TypedConfigurationElement;
133
134 // **** ConfigurationElement ****
135
136 class ConfigurationElement {
137 private:
138   std::string key;
139   std::string desc;
140   bool isdefault = true;
141
142 public:
143   /* Callback */
144   xbt_cfg_cb_t old_callback = nullptr;
145
146   ConfigurationElement(const char* key, const char* desc) : key(key ? key : ""), desc(desc ? desc : "") {}
147   ConfigurationElement(const char* key, const char* desc, xbt_cfg_cb_t cb)
148     : key(key ? key : ""), desc(desc ? desc : ""), old_callback(cb) {}
149
150   virtual ~ConfigurationElement() = default;
151
152   virtual std::string get_string_value()           = 0;
153   virtual void set_string_value(const char* value) = 0;
154   virtual const char* get_type_name()              = 0;
155
156   template <class T> T const& get_value() const
157   {
158     return dynamic_cast<const TypedConfigurationElement<T>&>(*this).get_value();
159   }
160   template <class T> void set_value(T value)
161   {
162     dynamic_cast<TypedConfigurationElement<T>&>(*this).set_value(std::move(value));
163   }
164   template <class T> void set_default_value(T value)
165   {
166     dynamic_cast<TypedConfigurationElement<T>&>(*this).set_default_value(std::move(value));
167   }
168   void unset_default() { isdefault = false; }
169   bool is_default() const { return isdefault; }
170
171   std::string const& get_description() const { return desc; }
172   std::string const& get_key() const { return key; }
173 };
174
175 // **** TypedConfigurationElement<T> ****
176
177 // TODO, could we use boost::any with some Type* reference?
178 template<class T>
179 class TypedConfigurationElement : public ConfigurationElement {
180 private:
181   T content;
182   std::function<void(T&)> callback;
183
184 public:
185   TypedConfigurationElement(const char* key, const char* desc, T value = T())
186     : ConfigurationElement(key, desc), content(std::move(value))
187   {}
188   TypedConfigurationElement(const char* key, const char* desc, T value, xbt_cfg_cb_t cb)
189       : ConfigurationElement(key, desc, cb), content(std::move(value))
190   {}
191   TypedConfigurationElement(const char* key, const char* desc, T value, std::function<void(T&)> callback)
192       : ConfigurationElement(key, desc), content(std::move(value)), callback(std::move(callback))
193   {}
194   ~TypedConfigurationElement() = default;
195
196   std::string get_string_value() override;
197   const char* get_type_name() override;
198   void set_string_value(const char* value) override;
199
200   void update()
201   {
202     if (old_callback)
203       this->old_callback(get_key().c_str());
204     if (this->callback)
205       this->callback(this->content);
206   }
207
208   T const& get_value() const { return content; }
209
210   void set_value(T value)
211   {
212     this->content = std::move(value);
213     this->update();
214     this->unset_default();
215   }
216
217   void set_default_value(T value)
218   {
219     if (this->is_default()) {
220       this->content = std::move(value);
221       this->update();
222     } else {
223       XBT_DEBUG("Do not override configuration variable '%s' with value '%s' because it was already set.",
224                 get_key().c_str(), to_string(value).c_str());
225     }
226   }
227 };
228
229 template <class T> std::string TypedConfigurationElement<T>::get_string_value() // override
230 {
231   return to_string(content);
232 }
233
234 template <class T> void TypedConfigurationElement<T>::set_string_value(const char* value) // override
235 {
236   this->content = ConfigType<T>::parse(value);
237   this->unset_default();
238   this->update();
239 }
240
241 template <class T> const char* TypedConfigurationElement<T>::get_type_name() // override
242 {
243   return ConfigType<T>::type_name;
244 }
245
246 } // end of anonymous namespace
247
248 // **** Config ****
249
250 class Config {
251 private:
252   // name -> ConfigElement:
253   std::map<std::string, simgrid::config::ConfigurationElement*> options;
254   // alias -> ConfigElement from options:
255   std::map<std::string, simgrid::config::ConfigurationElement*> aliases;
256   bool warn_for_aliases = true;
257
258 public:
259   Config();
260   ~Config();
261
262   // No copy:
263   Config(Config const&) = delete;
264   Config& operator=(Config const&) = delete;
265
266   ConfigurationElement& operator[](const char* name);
267   void alias(const char* realname, const char* aliasname);
268
269   template <class T, class... A>
270   simgrid::config::TypedConfigurationElement<T>* register_option(const char* name, A&&... a)
271   {
272     xbt_assert(options.find(name) == options.end(), "Refusing to register the config element '%s' twice.", name);
273     TypedConfigurationElement<T>* variable = new TypedConfigurationElement<T>(name, std::forward<A>(a)...);
274     XBT_DEBUG("Register cfg elm %s (%s) of type %s @%p in set %p)", name, variable->get_description().c_str(),
275               variable->get_type_name(), variable, this);
276     options.insert({name, variable});
277     variable->update();
278     return variable;
279   }
280
281   // Debug:
282   void dump(const char *name, const char *indent);
283   void show_aliases();
284   void help();
285
286 protected:
287   ConfigurationElement* get_dict_element(const char* name);
288 };
289
290 Config::Config()
291 {
292   atexit(&sg_config_finalize);
293 }
294 Config::~Config()
295 {
296   XBT_DEBUG("Frees cfg set %p", this);
297   for (auto const& elm : options)
298     delete elm.second;
299 }
300
301 inline ConfigurationElement* Config::get_dict_element(const char* name)
302 {
303   auto opt = options.find(name);
304   if (opt != options.end()) {
305     return opt->second;
306   } else {
307     auto als = aliases.find(name);
308     if (als != aliases.end()) {
309       ConfigurationElement* res = als->second;
310       if (warn_for_aliases)
311         XBT_INFO("Option %s has been renamed to %s. Consider switching.", name, res->get_key().c_str());
312       return res;
313     } else {
314       THROWF(not_found_error, 0, "Bad config key: %s", name);
315     }
316   }
317 }
318
319 inline ConfigurationElement& Config::operator[](const char* name)
320 {
321   return *(get_dict_element(name));
322 }
323
324 void Config::alias(const char* realname, const char* aliasname)
325 {
326   xbt_assert(aliases.find(aliasname) == aliases.end(), "Alias '%s' already.", aliasname);
327   ConfigurationElement* element = this->get_dict_element(realname);
328   xbt_assert(element, "Cannot define an alias to the non-existing option '%s'.", realname);
329   this->aliases.insert({aliasname, element});
330 }
331
332 /** @brief Dump a config set for debuging purpose
333  *
334  * @param name The name to give to this config set
335  * @param indent what to write at the beginning of each line (right number of spaces)
336  */
337 void Config::dump(const char *name, const char *indent)
338 {
339   if (name)
340     printf("%s>> Dumping of the config set '%s':\n", indent, name);
341
342   for (auto const& elm : options)
343     printf("%s  %s: ()%s) %s", indent, elm.first.c_str(), elm.second->get_type_name(),
344            elm.second->get_string_value().c_str());
345
346   if (name)
347     printf("%s<< End of the config set '%s'\n", indent, name);
348   fflush(stdout);
349 }
350
351 /** @brief Displays the declared aliases and their replacement */
352 void Config::show_aliases()
353 {
354   for (auto const& elm : aliases)
355     printf("   %-40s %s\n", elm.first.c_str(), elm.second->get_key().c_str());
356 }
357
358 /** @brief Displays the declared options and their description */
359 void Config::help()
360 {
361   for (auto const& elm : options) {
362     simgrid::config::ConfigurationElement* variable = this->options.at(elm.first);
363     printf("   %s: %s\n", elm.first.c_str(), variable->get_description().c_str());
364     printf("       Type: %s; ", variable->get_type_name());
365     printf("Current value: %s\n", variable->get_string_value().c_str());
366   }
367 }
368
369 // ***** get_config *****
370
371 template <class T> XBT_PUBLIC T const& get_config(const char* name)
372 {
373   return (*simgrid_config)[name].get_value<T>();
374 }
375
376 template XBT_PUBLIC int const& get_config<int>(const char* name);
377 template XBT_PUBLIC double const& get_config<double>(const char* name);
378 template XBT_PUBLIC bool const& get_config<bool>(const char* name);
379 template XBT_PUBLIC std::string const& get_config<std::string>(const char* name);
380
381 // ***** alias *****
382
383 void alias(const char* realname, std::initializer_list<const char*> aliases)
384 {
385   for (auto const& aliasname : aliases)
386     simgrid_config->alias(realname, aliasname);
387 }
388
389 // ***** declareFlag *****
390
391 template <class T>
392 XBT_PUBLIC void declareFlag(const char* name, const char* description, T value, std::function<void(const T&)> callback)
393 {
394   if (simgrid_config == nullptr)
395     simgrid_config = xbt_cfg_new();
396   simgrid_config->register_option<T>(name, description, std::move(value), std::move(callback));
397 }
398
399 template XBT_PUBLIC void declareFlag(const char* name, const char* description, int value,
400                                      std::function<void(int const&)> callback);
401 template XBT_PUBLIC void declareFlag(const char* name, const char* description, double value,
402                                      std::function<void(double const&)> callback);
403 template XBT_PUBLIC void declareFlag(const char* name, const char* description, bool value,
404                                      std::function<void(bool const&)> callback);
405 template XBT_PUBLIC void declareFlag(const char* name, const char* description, std::string value,
406                                      std::function<void(std::string const&)> callback);
407 }
408 }
409
410 // ***** C bindings *****
411
412 xbt_cfg_t xbt_cfg_new()
413 {
414   return new simgrid::config::Config();
415 }
416 void xbt_cfg_free(xbt_cfg_t * cfg) { delete *cfg; }
417
418 void xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg)
419 {
420   cfg->dump(name, indent);
421 }
422
423 /*----[ Registering stuff ]-----------------------------------------------*/
424
425 void xbt_cfg_register_double(const char *name, double default_value,
426   xbt_cfg_cb_t cb_set, const char *desc)
427 {
428   if (simgrid_config == nullptr)
429     simgrid_config = xbt_cfg_new();
430   simgrid_config->register_option<double>(name, desc, default_value, cb_set);
431 }
432
433 void xbt_cfg_register_int(const char *name, int default_value,xbt_cfg_cb_t cb_set, const char *desc)
434 {
435   if (simgrid_config == nullptr)
436     simgrid_config = xbt_cfg_new();
437   simgrid_config->register_option<int>(name, desc, default_value, cb_set);
438 }
439
440 void xbt_cfg_register_string(const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
441 {
442   if (simgrid_config == nullptr)
443     simgrid_config = xbt_cfg_new();
444   simgrid_config->register_option<std::string>(name, desc, default_value ? default_value : "", cb_set);
445 }
446
447 void xbt_cfg_register_boolean(const char *name, const char*default_value,xbt_cfg_cb_t cb_set, const char *desc)
448 {
449   if (simgrid_config == nullptr)
450     simgrid_config = xbt_cfg_new();
451   simgrid_config->register_option<bool>(name, desc, simgrid::config::parse_bool(default_value), cb_set);
452 }
453
454 void xbt_cfg_register_alias(const char *realname, const char *aliasname)
455 {
456   if (simgrid_config == nullptr)
457     simgrid_config = xbt_cfg_new();
458   simgrid_config->alias(realname, aliasname);
459 }
460
461 void xbt_cfg_aliases()
462 {
463   simgrid_config->show_aliases();
464 }
465 void xbt_cfg_help()
466 {
467   simgrid_config->help();
468 }
469
470 /*----[ Setting ]---------------------------------------------------------*/
471
472 /** @brief Add values parsed from a string into a config set
473  *
474  * @param options a string containing the content to add to the config set. This is a '\\t',' ' or '\\n' or ','
475  * separated list of variables. Each individual variable is like "[name]:[value]" where [name] is the name of an
476  * already registered variable, and [value] conforms to the data type under which this variable was registered.
477  *
478  * @todo This is a crude manual parser, it should be a proper lexer.
479  */
480 void xbt_cfg_set_parse(const char *options)
481 {
482   if (not options || not strlen(options)) { /* nothing to do */
483     return;
484   }
485
486   XBT_DEBUG("List to parse and set:'%s'", options);
487   std::string optionlist(options);
488   while (not optionlist.empty()) {
489     XBT_DEBUG("Still to parse and set: '%s'", optionlist.c_str());
490
491     // skip separators
492     size_t pos = optionlist.find_first_not_of(" \t\n,");
493     optionlist.erase(0, pos);
494     // find option
495     pos              = optionlist.find_first_of(" \t\n,");
496     std::string name = optionlist.substr(0, pos);
497     optionlist.erase(0, pos);
498     XBT_DEBUG("parse now:'%s'; parse later:'%s'", name.c_str(), optionlist.c_str());
499
500     if (name.empty())
501       continue;
502
503     pos = name.find(':');
504     xbt_assert(pos != std::string::npos, "Option '%s' badly formatted. Should be of the form 'name:value'",
505                name.c_str());
506
507     std::string val = name.substr(pos + 1);
508     name.erase(pos);
509
510     const std::string path("path");
511     if (name.compare(0, path.length(), path) != 0)
512       XBT_INFO("Configuration change: Set '%s' to '%s'", name.c_str(), val.c_str());
513
514     (*simgrid_config)[name.c_str()].set_string_value(val.c_str());
515   }
516 }
517
518 /** @brief Set the value of a variable, using the string representation of that value
519  *
520  * @param key name of the variable to modify
521  * @param value string representation of the value to set
522  */
523
524 void xbt_cfg_set_as_string(const char *key, const char *value)
525 {
526   (*simgrid_config)[key].set_string_value(value);
527 }
528
529 /** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
530  *
531  * This is useful to change the default value of a variable while allowing
532  * users to override it with command line arguments
533  */
534 void xbt_cfg_setdefault_int(const char *key, int value)
535 {
536   (*simgrid_config)[key].set_default_value<int>(value);
537 }
538
539 /** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
540  *
541  * This is useful to change the default value of a variable while allowing
542  * users to override it with command line arguments
543  */
544 void xbt_cfg_setdefault_double(const char *key, double value)
545 {
546   (*simgrid_config)[key].set_default_value<double>(value);
547 }
548
549 /** @brief Set a string value to \a name within \a cfg if it wasn't changed yet
550  *
551  * This is useful to change the default value of a variable while allowing
552  * users to override it with command line arguments
553  */
554 void xbt_cfg_setdefault_string(const char *key, const char *value)
555 {
556   (*simgrid_config)[key].set_default_value<std::string>(value ? value : "");
557 }
558
559 /** @brief Set an boolean value to \a name within \a cfg if it wasn't changed yet
560  *
561  * This is useful to change the default value of a variable while allowing
562  * users to override it with command line arguments
563  */
564 void xbt_cfg_setdefault_boolean(const char *key, const char *value)
565 {
566   (*simgrid_config)[key].set_default_value<bool>(simgrid::config::parse_bool(value));
567 }
568
569 /** @brief Set an integer value to \a name within \a cfg
570  *
571  * @param key the name of the variable
572  * @param value the value of the variable
573  */
574 void xbt_cfg_set_int(const char *key, int value)
575 {
576   (*simgrid_config)[key].set_value<int>(value);
577 }
578
579 /** @brief Set or add a double value to \a name within \a cfg
580  *
581  * @param key the name of the variable
582  * @param value the double to set
583  */
584 void xbt_cfg_set_double(const char *key, double value)
585 {
586   (*simgrid_config)[key].set_value<double>(value);
587 }
588
589 /** @brief Set or add a string value to \a name within \a cfg
590  *
591  * @param key the name of the variable
592  * @param value the value to be added
593  *
594  */
595 void xbt_cfg_set_string(const char* key, const char* value)
596 {
597   (*simgrid_config)[key].set_value<std::string>(value);
598 }
599
600 /** @brief Set or add a boolean value to \a name within \a cfg
601  *
602  * @param key the name of the variable
603  * @param value the value of the variable
604  */
605 void xbt_cfg_set_boolean(const char *key, const char *value)
606 {
607   (*simgrid_config)[key].set_value<bool>(simgrid::config::parse_bool(value));
608 }
609
610
611 /* Say if the value is the default value */
612 int xbt_cfg_is_default_value(const char *key)
613 {
614   return (*simgrid_config)[key].is_default() ? 1 : 0;
615 }
616
617 /*----[ Getting ]---------------------------------------------------------*/
618 /** @brief Retrieve an integer value of a variable (get a warning if not uniq)
619  *
620  * @param key the name of the variable
621  *
622  * Returns the first value from the config set under the given name.
623  */
624 int xbt_cfg_get_int(const char *key)
625 {
626   return (*simgrid_config)[key].get_value<int>();
627 }
628
629 /** @brief Retrieve a double value of a variable (get a warning if not uniq)
630  *
631  * @param key the name of the variable
632  *
633  * Returns the first value from the config set under the given name.
634  */
635 double xbt_cfg_get_double(const char *key)
636 {
637   return (*simgrid_config)[key].get_value<double>();
638 }
639
640 /** @brief Retrieve a string value of a variable (get a warning if not uniq)
641  *
642  * @param key the name of the variable
643  *
644  * Returns the first value from the config set under the given name.
645  * If there is more than one value, it will issue a warning.
646  * Returns nullptr if there is no value.
647  *
648  * \warning the returned value is the actual content of the config set
649  */
650 std::string xbt_cfg_get_string(const char* key)
651 {
652   return (*simgrid_config)[key].get_value<std::string>();
653 }
654
655 /** @brief Retrieve a boolean value of a variable (get a warning if not uniq)
656  *
657  * @param key the name of the variable
658  *
659  * Returns the first value from the config set under the given name.
660  * If there is more than one value, it will issue a warning.
661  */
662 int xbt_cfg_get_boolean(const char *key)
663 {
664   return (*simgrid_config)[key].get_value<bool>() ? 1 : 0;
665 }
666
667 #ifdef SIMGRID_TEST
668
669 #include <string>
670
671 #include "xbt.h"
672 #include "xbt/ex.h"
673 #include <xbt/ex.hpp>
674
675 #include <xbt/config.hpp>
676
677 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
678
679 XBT_TEST_SUITE("config", "Configuration support");
680
681 XBT_PUBLIC_DATA xbt_cfg_t simgrid_config;
682
683 static void make_set()
684 {
685   simgrid_config = nullptr;
686   xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
687   simgrid::config::declareFlag<int>("speed", "description", 0);
688   simgrid::config::declareFlag<std::string>("peername", "description", "");
689   simgrid::config::declareFlag<std::string>("user", "description", "");
690 }                               /* end_of_make_set */
691
692 XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")
693 {
694   auto temp = simgrid_config;
695   make_set();
696   xbt_test_add("Alloc and free a config set");
697   xbt_cfg_set_parse("peername:veloce user:bidule");
698   xbt_cfg_free(&simgrid_config);
699   simgrid_config = temp;
700 }
701
702 XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
703 {
704   auto temp = simgrid_config;
705   make_set();
706   xbt_test_add("Get a single value");
707   {
708     /* get_single_value */
709     xbt_cfg_set_parse("peername:toto:42 speed:42");
710     int ival = xbt_cfg_get_int("speed");
711     if (ival != 42)
712       xbt_test_fail("Speed value = %d, I expected 42", ival);
713   }
714
715   xbt_test_add("Access to a non-existant entry");
716   {
717     try {
718       xbt_cfg_set_parse("color:blue");
719     } catch(xbt_ex& e) {
720       if (e.category != not_found_error)
721         xbt_test_exception(e);
722     }
723   }
724   xbt_cfg_free(&simgrid_config);
725   simgrid_config = temp;
726 }
727
728 XBT_TEST_UNIT("c++flags", test_config_cxx_flags, "C++ flags")
729 {
730   auto temp = simgrid_config;
731   make_set();
732   xbt_test_add("C++ declaration of flags");
733
734   simgrid::config::Flag<int> int_flag("int", "", 0);
735   simgrid::config::Flag<std::string> string_flag("string", "", "foo");
736   simgrid::config::Flag<double> double_flag("double", "", 0.32);
737   simgrid::config::Flag<bool> bool_flag1("bool1", "", false);
738   simgrid::config::Flag<bool> bool_flag2("bool2", "", true);
739
740   xbt_test_add("Parse values");
741   xbt_cfg_set_parse("int:42 string:bar double:8.0 bool1:true bool2:false");
742   xbt_test_assert(int_flag == 42, "Check int flag");
743   xbt_test_assert(string_flag == "bar", "Check string flag");
744   xbt_test_assert(double_flag == 8.0, "Check double flag");
745   xbt_test_assert(bool_flag1, "Check bool1 flag");
746   xbt_test_assert(not bool_flag2, "Check bool2 flag");
747
748   xbt_cfg_free(&simgrid_config);
749   simgrid_config = temp;
750 }
751
752 #endif                          /* SIMGRID_TEST */