From: Martin Quinson Date: Sun, 16 Oct 2022 10:11:47 +0000 (+0200) Subject: Add a sthread example that works (no deadlock) X-Git-Tag: v3.34~775 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/12f5ef5e51b0c8ea123c629b9f545d753fba4071 Add a sthread example that works (no deadlock) --- diff --git a/examples/sthread/CMakeLists.txt b/examples/sthread/CMakeLists.txt index 79857df41c..fd1c3c5792 100644 --- a/examples/sthread/CMakeLists.txt +++ b/examples/sthread/CMakeLists.txt @@ -15,9 +15,15 @@ foreach(x add_dependencies(tests pthread-${x}) ADD_TESH_FACTORIES(pthread-${x} "^thread" --setenv libdir=${CMAKE_BINARY_DIR}/lib --cd ${CMAKE_BINARY_DIR}/examples/sthread ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh) + + if(SIMGRID_HAVE_MC) + add_dependencies(tests-mc pthread-${x}) + ADD_TESH_FACTORIES(pthread-mc-${x} "^thread" --setenv libdir=${CMAKE_BINARY_DIR}/lib --cd ${CMAKE_BINARY_DIR}/examples/sthread ${CMAKE_CURRENT_SOURCE_DIR}/pthread-mc-${x}.tesh) + endif() endif() - set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh) + set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/pthread-mc-${x}.tesh) set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.c) endforeach() diff --git a/examples/sthread/pthread-mc-mutex-simple.tesh b/examples/sthread/pthread-mc-mutex-simple.tesh new file mode 100644 index 0000000000..1aba081db7 --- /dev/null +++ b/examples/sthread/pthread-mc-mutex-simple.tesh @@ -0,0 +1,16 @@ + +# We ignore the LD_PRELOAD lines from the expected output because they contain the build path +! ignore .*LD_PRELOAD.* + +$ ${bindir:=.}/../../bin/simgrid-mc --cfg=model-check/setenv:LD_PRELOAD=${libdir:=.}/libsgmalloc.so:${libdir:=.}/libsthread.so ${bindir:=.}/pthread-mutex-simple +> [0.000000] [sthread/INFO] Starting the simulation. +> All threads are started. +> [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor. +> The thread 0 is terminating. +> The thread 1 is terminating. +> User's main is terminating. +> The thread 1 is terminating. +> The thread 0 is terminating. +> User's main is terminating. +> [0.000000] [mc_dfs/INFO] DFS exploration ended. 17 unique states visited; 3 backtracks (22 transition replays, 3 states visited overall) +