diff options
Diffstat (limited to 'lib/test_server/src')
-rw-r--r-- | lib/test_server/src/test_server.erl | 30 | ||||
-rw-r--r-- | lib/test_server/src/test_server_ctrl.erl | 10 | ||||
-rw-r--r-- | lib/test_server/src/test_server_line.erl | 17 | ||||
-rw-r--r-- | lib/test_server/src/test_server_sup.erl | 23 |
4 files changed, 59 insertions, 21 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index 99e24205ae..f918f47415 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(test_server). @@ -760,6 +760,10 @@ run_test_case_msgloop(Ref, Pid, CaptureStdout, Terminate, Comment) -> spawn_fw_call(undefined,undefined,Pid,testcase_aborted_or_killed, unknown,self(),Comment), run_test_case_msgloop(Ref,Pid,CaptureStdout,Terminate,Comment); + {fw_error,{FwMod,FwFunc,FwError}} -> + spawn_fw_call(FwMod,FwFunc,Pid,{framework_error,FwError}, + unknown,self(),Comment), + run_test_case_msgloop(Ref,Pid,CaptureStdout,Terminate,Comment); _ -> %% the testcase has terminated because of Reason (e.g. an exit %% because a linked process failed) @@ -859,6 +863,22 @@ spawn_fw_call(Mod,{end_per_testcase,Func},Pid,{timetrap_timeout,TVal}=Why, "</font>"]}} end, spawn_link(FwCall); + +spawn_fw_call(FwMod,FwFunc,_Pid,{framework_error,FwError},_,SendTo,_Comment) -> + FwCall = + fun() -> + test_server_sup:framework_call(report, [framework_error, + {{FwMod,FwFunc},FwError}]), + Comment = + lists:flatten( + io_lib:format("<font color=\"red\">" + "WARNING! ~w:~w failed!</font>", [FwMod,FwFunc])), + %% finished, report back + SendTo ! {self(),fw_notify_done, + {died,{error,{FwMod,FwFunc,FwError}},{FwMod,FwFunc},[],Comment}} + end, + spawn_link(FwCall); + spawn_fw_call(Mod,Func,Pid,Error,Loc,SendTo,Comment) -> FwCall = fun() -> diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 667d0cc051..4cb5863955 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(test_server_ctrl). diff --git a/lib/test_server/src/test_server_line.erl b/lib/test_server/src/test_server_line.erl index 26ef3a3040..848a9c23dd 100644 --- a/lib/test_server/src/test_server_line.erl +++ b/lib/test_server/src/test_server_line.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(test_server_line). @@ -347,6 +347,10 @@ munge_expr({'fun',Line,{clauses,Clauses}}, Vars) -> %% Only for Vsn=raw_abstract_v1 {MungedClauses,Vars2}=munge_clauses(Clauses, Vars, []), {{'fun',Line,{clauses,MungedClauses}}, Vars2}; +munge_expr({bc,Line,Expr,LC}, Vars) -> + {MungedExpr, Vars2} = munge_expr(Expr, Vars), + {MungedLC, Vars3} = munge_lc(LC, Vars2, []), + {{bc,Line,MungedExpr,MungedLC}, Vars3}; munge_expr(Form, Vars) -> % var|char|integer|float|string|atom|nil|bin|eof {Form, Vars}. @@ -363,6 +367,9 @@ munge_exprs([], Vars, MungedExprs) -> munge_lc([{generate,Line,Pattern,Expr}|LC], Vars, MungedLC) -> {MungedExpr, Vars2} = munge_expr(Expr, Vars), munge_lc(LC, Vars2, [{generate,Line,Pattern,MungedExpr}|MungedLC]); +munge_lc([{b_generate,Line,Pattern,Expr}|LC], Vars, MungedLC) -> + {MungedExpr, Vars2} = munge_expr(Expr, Vars), + munge_lc(LC, Vars2, [{b_generate,Line,Pattern,MungedExpr}|MungedLC]); munge_lc([Expr|LC], Vars, MungedLC) -> {MungedExpr, Vars2} = munge_expr(Expr, Vars), munge_lc(LC, Vars2, [MungedExpr|MungedLC]); diff --git a/lib/test_server/src/test_server_sup.erl b/lib/test_server/src/test_server_sup.erl index c665f185fd..89edb0f881 100644 --- a/lib/test_server/src/test_server_sup.erl +++ b/lib/test_server/src/test_server_sup.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -497,7 +497,18 @@ framework_call(Callback,Func,Args,DefaultReturn) -> end, case erlang:function_exported(Mod,Func,length(Args)) of true -> - apply(Mod,Func,Args); + EH = fun(Reason) -> exit({fw_error,{Mod,Func,Reason}}) end, + try apply(Mod,Func,Args) of + Result -> + Result + catch + exit:Why -> + EH(Why); + error:Why -> + EH({Why,erlang:get_stacktrace()}); + throw:Why -> + EH(Why) + end; false -> DefaultReturn end. |