aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server/src/test_server.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-11-15 10:15:24 +0100
committerSiri Hansen <[email protected]>2012-11-16 11:45:38 +0100
commit1a8e644f07418f27fad173201381012cb827282f (patch)
tree0767185b185a3ee7447e326a27617937c32f6c78 /lib/test_server/src/test_server.erl
parent15ae7c1f17f4516475e9ea60942fb60464a7e3de (diff)
downloadotp-1a8e644f07418f27fad173201381012cb827282f.tar.gz
otp-1a8e644f07418f27fad173201381012cb827282f.tar.bz2
otp-1a8e644f07418f27fad173201381012cb827282f.zip
[test_server] Cancel timetrap for break in end_per_testcase
Any call to test_server:break/1 should cancel all active timetramps. In some cases, Suite:end_per_testcase/2 is executed on a different process than the test case itself, and if test_server:break/1 would be called from there, the timetraps would not be cancelled. This has been corrected.
Diffstat (limited to 'lib/test_server/src/test_server.erl')
-rw-r--r--lib/test_server/src/test_server.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl
index 1d3394e0ca..14cdfd391a 100644
--- a/lib/test_server/src/test_server.erl
+++ b/lib/test_server/src/test_server.erl
@@ -724,9 +724,11 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) ->
Data = {Mod,Func,TCPid,TCExitReason,Loc},
EndConfProc =
fun() ->
+ process_flag(trap_exit,true), % to catch timetraps
Supervisor = self(),
EndConfApply =
fun() ->
+ timetrap(TVal),
case catch apply(Mod,end_per_testcase,[Func,Conf]) of
{'EXIT',Why} ->
timer:sleep(1),
@@ -745,14 +747,14 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) ->
{Pid,end_conf} ->
Starter ! {self(),{call_end_conf,Data,ok}};
{'EXIT',Pid,Reason} ->
- Starter ! {self(),{call_end_conf,Data,{error,Reason}}}
- after TVal ->
- exit(Pid, kill),
group_leader() ! {printout,12,
"WARNING! ~p:end_per_testcase(~p, ~p)"
- " failed!\n\tReason: timetrap timeout"
- " after ~w ms!\n", [Mod,Func,Conf,TVal]},
- Starter ! {self(),{call_end_conf,Data,{error,timeout}}}
+ " failed!\n\tReason: ~p\n",
+ [Mod,Func,Conf,Reason]},
+ Starter ! {self(),{call_end_conf,Data,{error,Reason}}};
+ {'EXIT',_OtherPid,Reason} ->
+ %% Probably the parent - not much to do about that
+ exit(Reason)
end
end,
spawn_link(EndConfProc).