Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
u3s committed Jul 3, 2023
2 parents c5b1f6e + 5e1dd94 commit 239b892
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 136 deletions.
25 changes: 18 additions & 7 deletions lib/common_test/src/test_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,16 @@ run_test_case_msgloop(#st{ref=Ref,pid=Pid,end_conf_pid=EndConfPid0}=St0) ->
handle_tc_exit(Reason, St0)
end,
run_test_case_msgloop(St);
{EndConfPid0,{call_end_conf,Data,_Result}} ->
#st{mf={Mod,Func},config=CurrConf} = St0,
{EndConfPid0,{call_end_conf,Data,EndConf,_Result}} ->
#st{mf={Mod,Func},config=CurrConfFromState} = St0,
CurrConf = case EndConf of
[] ->
%% use latest stored Config
CurrConfFromState;
_ ->
%% use latest Config prepared in pre_end_per_testcase
EndConf
end,
case CurrConf of
_ when is_list(CurrConf) ->
{_Mod,_Func,TCPid,TCExitReason,Loc} = Data,
Expand Down Expand Up @@ -742,7 +750,7 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) ->
case erlang:function_exported(Mod,end_per_testcase,2) of
false ->
spawn_link(fun() ->
Starter ! {self(),{call_end_conf,Data,ok}}
Starter ! {self(),{call_end_conf,Data,[],ok}}
end);
true ->
do_call_end_conf(Starter,Mod,Func,Data,TCExitReason,Conf,TVal)
Expand Down Expand Up @@ -776,15 +784,18 @@ do_call_end_conf(Starter,Mod,Func,Data,TCExitReason,Conf,TVal) ->
print_end_conf_result(Mod,Func,Conf,
"crashed",Error)
end,
Supervisor ! {self(),end_conf}
Supervisor ! {self(),end_conf, EndConf}
end,
Pid = spawn_link(EndConfApply),
receive
{Pid,end_conf} ->
Starter ! {self(),{call_end_conf,Data,ok}};
{Pid,end_conf, EndConf} ->
%% Return EndConf to parent process to
%% post_end_per_testcase callback can receive latest
%% Config returned from pre_end_per_testcase
Starter ! {self(),{call_end_conf,Data,EndConf,ok}};
{'EXIT',Pid,Reason} ->
print_end_conf_result(Mod,Func,Conf,"failed",Reason),
Starter ! {self(),{call_end_conf,Data,{error,Reason}}};
Starter ! {self(),{call_end_conf,Data,[],{error,Reason}}};
{'EXIT',_OtherPid,Reason} ->
%% Probably the parent - not much to do about that
exit(Reason)
Expand Down
Loading

0 comments on commit 239b892

Please sign in to comment.