1 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
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. */
7 #include <simgrid/modelchecker.h>
8 #include <simgrid/s4u.hpp>
11 XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "For this example");
13 enum { ABORT, ASSERT, PRINTF } behavior;
15 /** An (fake) application with a bug occuring for some random values */
18 int x = MC_random(0, 5);
19 int y = MC_random(0, 5);
25 MC_assert(x != 3 || y != 4);
29 XBT_ERROR("Error reached");
35 int main(int argc, char* argv[])
37 simgrid::s4u::Engine e(&argc, argv);
38 xbt_assert(argc == 3, "Usage: random-bug raise|assert <platformfile>");
39 if (strcmp(argv[1], "abort") == 0) {
40 XBT_INFO("Behavior: abort");
42 } else if (strcmp(argv[1], "assert") == 0) {
43 XBT_INFO("Behavior: assert");
45 } else if (strcmp(argv[1], "printf") == 0) {
46 XBT_INFO("Behavior: printf");
50 e.load_platform(argv[2]);
52 simgrid::s4u::Actor::create("app", simgrid::s4u::Host::by_name("Fafard"), &app);