Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / examples / sthread / pthread-mc-mutex-simpledeadlock.tesh
1
2 # We ignore the LD_PRELOAD lines from the expected output because they contain the build path
3 ! ignore .*LD_PRELOAD.*
4
5 # This test raises a deadlock, thus the return code of 3
6 ! expect return 3
7 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-check/setenv:LD_PRELOAD=${libdir:=.}/libsthread.so ${bindir:=.}/pthread-mutex-simpledeadlock
8 > All threads are started.
9 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
10 > The thread 0 is terminating.
11 > The thread 1 is terminating.
12 > User's main is terminating.
13 > [0.000000] [mc_global/INFO] **************************
14 > [0.000000] [mc_global/INFO] *** DEADLOCK DETECTED ***
15 > [0.000000] [mc_global/INFO] **************************
16 > [0.000000] [ker_engine/INFO] 3 actors are still running, waiting for something.
17 > [0.000000] [ker_engine/INFO] Legend of the following listing: "Actor <pid> (<name>@<host>): <status>"
18 > [0.000000] [ker_engine/INFO] Actor 1 (main thread@Lilibeth) simcall ActorJoin(pid:2)
19 > [0.000000] [ker_engine/INFO] Actor 2 (thread 1@Lilibeth) simcall MUTEX_WAIT(mutex_id:1 owner:3)
20 > [0.000000] [ker_engine/INFO] Actor 3 (thread 2@Lilibeth) simcall MUTEX_WAIT(mutex_id:0 owner:2)
21 > [0.000000] [mc_global/INFO] Counter-example execution trace:
22 > [0.000000] [mc_global/INFO]   Actor 2 in simcall MUTEX_ASYNC_LOCK(mutex: 0, owner: 2)
23 > [0.000000] [mc_global/INFO]   Actor 2 in simcall MUTEX_WAIT(mutex: 0, owner: 2)
24 > [0.000000] [mc_global/INFO]   Actor 3 in simcall MUTEX_ASYNC_LOCK(mutex: 1, owner: 3)
25 > [0.000000] [mc_global/INFO]   Actor 2 in simcall MUTEX_ASYNC_LOCK(mutex: 1, owner: 3)
26 > [0.000000] [mc_global/INFO]   Actor 3 in simcall MUTEX_WAIT(mutex: 1, owner: 3)
27 > [0.000000] [mc_global/INFO]   Actor 3 in simcall MUTEX_ASYNC_LOCK(mutex: 0, owner: 2)
28 > [0.000000] [mc_Session/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'2;2;3;2;3;3'
29 > [0.000000] [mc_dfs/INFO] DFS exploration ended. 21 unique states visited; 3 backtracks (11 transition replays, 35 states visited overall)
30
31
32 # The return code of a replay is not modified
33 ! expect return 0
34 ! output display
35 ! setenv LD_PRELOAD=${libdir:=.}/libsthread.so
36 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/pthread-mutex-simpledeadlock --cfg=model-check/replay:'2;2;3;2;3;3'
37
38 # The output contains build paths, and cannot be tested with tesh, unfortunately
39 # Here, it will produce the following output (if you don't build out of the tree, you'll get another output):
40
41 # $ LD_PRELOAD=${libdir:=.}/libsthread.so ${bindir:=.}/pthread-mutex-simpledeadlock --cfg=model-check/replay:'2;2;3;2;3;3'
42 # sthread is intercepting the execution of ./pthread-mutex-simpledeadlock
43 # [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/replay' to '2;2;3;2;3;3'
44 # [0.000000] [mc_record/INFO] path=2;2;3;2;3;3
45 # All threads are started.
46 # [0.000000] [mc_record/INFO] ***********************************************************************************
47 # [0.000000] [mc_record/INFO] * Path chunk #1 '2/0' Actor thread 1(pid:2): MUTEX_ASYNC_LOCK(mutex_id:0 owner:none)
48 # [0.000000] [mc_record/INFO] ***********************************************************************************
49 # Backtrace (displayed in actor thread 1):
50 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:26
51 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
52 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
53 #   ->  #3 thread_fun1 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:21
54
55 # [0.000000] [mc_record/INFO] ***********************************************************************************
56 # [0.000000] [mc_record/INFO] * Path chunk #2 '2/0' Actor thread 1(pid:2): MUTEX_WAIT(mutex_id:0 owner:2)
57 # [0.000000] [mc_record/INFO] ***********************************************************************************
58 # Backtrace (displayed in actor thread 1):
59 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:29
60 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
61 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
62 #   ->  #3 thread_fun1 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:21
63
64 # [0.000000] [mc_record/INFO] ***********************************************************************************
65 # [0.000000] [mc_record/INFO] * Path chunk #3 '3/0' Actor thread 2(pid:3): MUTEX_ASYNC_LOCK(mutex_id:1 owner:none)
66 # [0.000000] [mc_record/INFO] ***********************************************************************************
67 # Backtrace (displayed in actor thread 2):
68 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:26
69 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
70 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
71 #   ->  #3 thread_fun2 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:31
72
73 # [0.000000] [mc_record/INFO] ***********************************************************************************
74 # [0.000000] [mc_record/INFO] * Path chunk #4 '2/0' Actor thread 1(pid:2): MUTEX_ASYNC_LOCK(mutex_id:1 owner:3)
75 # [0.000000] [mc_record/INFO] ***********************************************************************************
76 # Backtrace (displayed in actor thread 1):
77 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:26
78 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
79 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
80 #   ->  #3 thread_fun1 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:22
81
82 # [0.000000] [mc_record/INFO] ***********************************************************************************
83 # [0.000000] [mc_record/INFO] * Path chunk #5 '3/0' Actor thread 2(pid:3): MUTEX_WAIT(mutex_id:1 owner:3)
84 # [0.000000] [mc_record/INFO] ***********************************************************************************
85 # Backtrace (displayed in actor thread 2):
86 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:29
87 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
88 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
89 #   ->  #3 thread_fun2 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:31
90
91 # [0.000000] [mc_record/INFO] ***********************************************************************************
92 # [0.000000] [mc_record/INFO] * Path chunk #6 '3/0' Actor thread 2(pid:3): MUTEX_ASYNC_LOCK(mutex_id:0 owner:2)
93 # [0.000000] [mc_record/INFO] ***********************************************************************************
94 # Backtrace (displayed in actor thread 2):
95 #   ->  #0 simgrid::s4u::Mutex::lock() at ../../src/s4u/s4u_Mutex.cpp:26
96 #   ->  #1 sthread_mutex_lock at ../../src/sthread/sthread_impl.cpp:188
97 #   ->  #2 pthread_mutex_lock at ../../src/sthread/sthread.c:141
98 #   ->  #3 thread_fun2 at ../../examples/sthread/pthread-mutex-simpledeadlock.c:32
99
100 # [0.000000] [mc_record/INFO] The replay of the trace is complete. DEADLOCK detected.
101 # [0.000000] [ker_engine/INFO] 3 actors are still running, waiting for something.
102 # [0.000000] [ker_engine/INFO] Legend of the following listing: "Actor <pid> (<name>@<host>): <status>"
103 # [0.000000] [ker_engine/INFO] Actor 1 (main thread@Lilibeth) simcall ActorJoin(pid:2)
104 # [0.000000] [ker_engine/INFO] Actor 2 (thread 1@Lilibeth) simcall MUTEX_WAIT(mutex_id:1 owner:3)
105 # [0.000000] [ker_engine/INFO] Actor 3 (thread 2@Lilibeth) simcall MUTEX_WAIT(mutex_id:0 owner:2)
106 # [0.000000] [sthread/INFO] All threads exited. Terminating the simulation.
107 # [0.000000] ../../src/kernel/EngineImpl.cpp:265: [ker_engine/WARNING] Process called exit when leaving - Skipping cleanups
108 # [0.000000] ../../src/kernel/EngineImpl.cpp:265: [ker_engine/WARNING] Process called exit when leaving - Skipping cleanups
109