#! /usr/bin/env python3
-# The goal is to introduce random failures in a simulation, to test simgrid under extreme conditions.
+# The goal is to introduce random failures in a simulation, to test SimGrid under extreme conditions.
#
# It is made of several components.
#
# Kill the link #0 after 42 seconds (using a kernel::Timer)
#
# * a python script: tools/simgrid-monkey (this file)
-# * It takes a regular simgrid simulation as a parameter, use the cmonkey plugin to get the information about it,
+# * It takes a regular SimGrid simulation as a parameter, use the cmonkey plugin to get the information about it,
# and then restart many runs, with one resource being turn_off() + turn_on() in each run.
# * Each resource gets killed between each timestamps, and on each timestamp.
# * So the amount of simulations is: 1 + (host_c+link_c) * timestamps * 2
#
# * Test program, written to resist these extreme conditions:
-# * teshsuite/s4u/monkey-masterworkers: tests synchronous comms and execs
+# * teshsuite/s4u/monkey-masterworkers: tests synchronous comms and execs (C++ and python)
+# * teshsuite/s4u/monkey-semaphore: tests async semaphores (C++ only)
-import multiprocessing as mp
import sys
import os
import argparse
#print(f"hosts:{host_count} links:{link_count} timestamps:{' '.join(([str(i) for i in timestamps]))}")
return (host_count, link_count, timestamps)
-parser = argparse.ArgumentParser(description='Run a simgrid simulation, and turn off/on resources at random.')
+parser = argparse.ArgumentParser(description='Run a SimGrid simulation, and turn off/on resources at random.')
parser.add_argument('--valgrind', help="Run the simulations in valgrind")
parser.add_argument('command', nargs='*')
args = parser.parse_args()
def doit():
prev_time = 0
- test_count = 0
test_todo = 2 * len(timestamps) * (host_count + link_count)
for pos in range(len(timestamps)):
now = timestamps[pos]