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. */
6 #include <simgrid/modelchecker.h>
7 #include <simgrid/s4u.hpp>
9 #include <stdio.h> /* snprintf */
11 enum { ABORT, ASSERT, PRINTF } behavior;
13 /** An (fake) application with a bug occuring for some random values */
16 int x = MC_random(0, 5);
17 int y = MC_random(0, 5);
19 if (behavior == ABORT) {
21 } else if (behavior == ASSERT) {
22 MC_assert(x != 3 || y != 4);
23 } else if (behavior == PRINTF) {
25 fprintf(stderr, "Error reached\n");
30 int main(int argc, char* argv[])
32 simgrid::s4u::Engine e(&argc, argv);
33 xbt_assert(argc == 3, "Usage: random-bug raise|assert <platformfile>");
34 if (strcmp(argv[1], "abort") == 0) {
35 printf("Behavior: abort\n");
37 } else if (strcmp(argv[1], "assert") == 0) {
38 printf("Behavior: assert\n");
40 } else if (strcmp(argv[1], "printf") == 0) {
41 printf("Behavior: printf\n");
45 e.load_platform(argv[2]);
47 simgrid::s4u::Actor::create("app", simgrid::s4u::Host::by_name("Fafard"), &app);