aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-11-01 12:24:28 +0100
committerBjörn Gustavsson <[email protected]>2012-11-07 14:14:00 +0100
commit983b1a407119f427a9203769bb94784b1bf0563b (patch)
tree768060a206b11c9a2dfb4f044f6737d3f670a492 /lib/test_server
parente6c3f2c107366c12edcd7a9b26e08642501fc888 (diff)
downloadotp-983b1a407119f427a9203769bb94784b1bf0563b.tar.gz
otp-983b1a407119f427a9203769bb94784b1bf0563b.tar.bz2
otp-983b1a407119f427a9203769bb94784b1bf0563b.zip
Handle ct:abort_current_testcase/1 when executing parallel groups
ct:abort_current_testcase/1 (which is a wrapper for the function with the same name in test_server_ctrl) would not work as expected when a group with parallel test cases was executing. Essentially, the abort_current_testcase message would be ignored until the group has finished and would then abort the end_per_group testcase for the group. Since there is no unique current testcase when a parallel group is executing, we must handle the abort_current_testcase message and return an error tuple. Also fix the bug that test_server_ctrl:abort_current_testcase/1 would always return 'ok'.
Diffstat (limited to 'lib/test_server')
-rw-r--r--lib/test_server/src/test_server_ctrl.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl
index 6ea69b5e58..fe9ee003d1 100644
--- a/lib/test_server/src/test_server_ctrl.erl
+++ b/lib/test_server/src/test_server_ctrl.erl
@@ -463,8 +463,7 @@ wait_finish() ->
ok.
abort_current_testcase(Reason) ->
- controller_call({abort_current_testcase,Reason}),
- ok.
+ controller_call({abort_current_testcase,Reason}).
abort() ->
OldTrap = process_flag(trap_exit, true),
@@ -3705,6 +3704,11 @@ handle_io_and_exit_loop(_, [], Ok,Skip,Fail) ->
handle_io_and_exits(Main, CurrPid, CaseNum, Mod, Func, Cases) ->
receive
+ {abort_current_testcase=Tag,_Reason,From} ->
+ %% If a parallel group is executing, there is no unique
+ %% current test case, so we must generate an error.
+ From ! {self(),Tag,{error,parallel_group}},
+ handle_io_and_exits(Main, CurrPid, CaseNum, Mod, Func, Cases);
%% end of io session from test case executed by main process
{finished,_,Main,CaseNum,Mod,Func,Result,_RetVal} ->
test_server_io:print_buffered(CurrPid),