/** @brief Hold every rates association between host and links (host name, rates id) */
std::map<xbt::string, int> host_rates_;
- /** @brief Hold every rates available for this Access Point */
- // double* rates; FIXME: unused
-
/** @brief A link can have several bandwith attach to it (mostly use by wifi model) */
std::vector<Metric> bandwidths_;
"Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"));
}
- return (bandwidths);
+ return bandwidths;
}
double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name)
#!/usr/bin/env tesh
$ ${bindir:=.}/random-bug printf ${platfdir}/small_platform.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=model-check/replay:1/3;1/4"
-> Behavior: printf
+> [ 0.000000] (0:maestro@) Behavior: printf
> [ 0.000000] (0:maestro@) path=1/3;1/4
-> Error reached
+> [ 0.000000] (1:app@Fafard) Error reached
# Behavior: assert does not have the same output within and without MC, so don't test it here. That's already covered with the other ones
! expect signal SIGIOT
$ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/random-bug abort ${platfdir}/small_platform.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=model-check/replay:1/3;1/4"
-> Behavior: abort
+> [ 0.000000] (0:maestro@) Behavior: abort
> [ 0.000000] (0:maestro@) path=1/3;1/4
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <cstring>
#include <simgrid/modelchecker.h>
#include <simgrid/s4u.hpp>
+#include <xbt/log.h>
-#include <stdio.h> /* snprintf */
+XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "For this example");
enum { ABORT, ASSERT, PRINTF } behavior;
int x = MC_random(0, 5);
int y = MC_random(0, 5);
- if (behavior == ABORT) {
- abort();
- } else if (behavior == ASSERT) {
- MC_assert(x != 3 || y != 4);
- } else if (behavior == PRINTF) {
- if (x == 3 && y == 4)
- fprintf(stderr, "Error reached\n");
+ switch (behavior) {
+ case ABORT:
+ abort();
+ case ASSERT:
+ MC_assert(x != 3 || y != 4);
+ break;
+ case PRINTF:
+ if (x == 3 && y == 4)
+ XBT_ERROR("Error reached");
+ break;
}
}
simgrid::s4u::Engine e(&argc, argv);
xbt_assert(argc == 3, "Usage: random-bug raise|assert <platformfile>");
if (strcmp(argv[1], "abort") == 0) {
- printf("Behavior: abort\n");
+ XBT_INFO("Behavior: abort");
behavior = ABORT;
} else if (strcmp(argv[1], "assert") == 0) {
- printf("Behavior: assert\n");
+ XBT_INFO("Behavior: assert");
behavior = ASSERT;
} else if (strcmp(argv[1], "printf") == 0) {
- printf("Behavior: printf\n");
+ XBT_INFO("Behavior: printf");
behavior = PRINTF;
}
! expect return 1
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug assert ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning
> [ 0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: assert
+> [ 0.000000] (0:maestro@) Behavior: assert
> [ 0.000000] (0:maestro@) **************************
> [ 0.000000] (0:maestro@) *** PROPERTY NOT VALID ***
> [ 0.000000] (0:maestro@) **************************
# because SIMGRID_MC_EXIT_PROGRAM_CRASH = 6
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug abort ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --log=no_loc
> [ 0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: abort
+> [ 0.000000] (0:maestro@) Behavior: abort
> [ 0.000000] (0:maestro@) **************************
> [ 0.000000] (0:maestro@) ** CRASH IN THE PROGRAM **
> [ 0.000000] (0:maestro@) **************************
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug printf ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning
> [ 0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: printf
-> Error reached
+> [ 0.000000] (0:maestro@) Behavior: printf
+> [ 0.000000] (1:app@Fafard) Error reached
> [ 0.000000] (0:maestro@) No property violation found.
> [ 0.000000] (0:maestro@) Expanded states = 43
> [ 0.000000] (0:maestro@) Visited states = 108