Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a sthread example that works (no deadlock)
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 16 Oct 2022 10:11:47 +0000 (12:11 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 16 Oct 2022 10:58:21 +0000 (12:58 +0200)
examples/sthread/CMakeLists.txt
examples/sthread/pthread-mc-mutex-simple.tesh [new file with mode: 0644]

index 79857df..fd1c3c5 100644 (file)
@@ -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 (file)
index 0000000..1aba081
--- /dev/null
@@ -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)
+