diff options
author | Micael Karlberg <[email protected]> | 2019-08-01 11:47:27 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-08-01 11:47:27 +0200 |
commit | 1f09c724bcc29e94bc3a1992420bab89a7f768ba (patch) | |
tree | 8632c35ae8853ecffe7aff3974eb35eff3daae81 /lib/megaco/test/megaco_test_lib.erl | |
parent | c7ac8d9bf26cbb04c2942e792f766a2ba6d8b07e (diff) | |
parent | 369718a77d4bd14dc92e3613e896cfcc10802f7b (diff) | |
download | otp-1f09c724bcc29e94bc3a1992420bab89a7f768ba.tar.gz otp-1f09c724bcc29e94bc3a1992420bab89a7f768ba.tar.bz2 otp-1f09c724bcc29e94bc3a1992420bab89a7f768ba.zip |
Merge branch 'bmk/megaco/20190710/test_tweaking' into maint
Diffstat (limited to 'lib/megaco/test/megaco_test_lib.erl')
-rw-r--r-- | lib/megaco/test/megaco_test_lib.erl | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 0617b96456..7c8c287e7c 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -318,9 +318,9 @@ t({Mod, {group, Name} = Group, Groups}, Config) [Name, Error]), [{failed, {Mod, Group}, Error}] catch - exit:{skipped, SkipReason} -> + exit:{skip, SkipReason} -> io:format(" => skipping group: ~p~n", [SkipReason]), - [{skipped, {Mod, Group}, SkipReason, 0}]; + [{skip, {Mod, Group}, SkipReason, 0}]; error:undef -> [t({Mod, Case, Groups}, Config) || Case <- GroupsAndCases]; @@ -383,9 +383,9 @@ t(Mod, Config) when is_atom(Mod) -> io:format(" => suite init failed: ~p~n", [Error]), [{failed, {Mod, init_per_suite}, Error}] catch - exit:{skipped, SkipReason} -> + exit:{skip, SkipReason} -> io:format(" => skipping suite: ~p~n", [SkipReason]), - [{skipped, {Mod, init_per_suite}, SkipReason, 0}]; + [{skip, {Mod, init_per_suite}, SkipReason, 0}]; error:undef -> [t({Mod, Case, Groups}, Config) || Case <- Cases]; T:E -> @@ -458,10 +458,10 @@ wait_for_evaluator(Pid, Mod, Fun, Config, Errors, AccTime) -> megaco:report_event(20, Mod, ?MODULE, Label ++ " failed", [TestCase, Config, {return, Fail}, Errors]), {failed, {Mod,Fun}, Fail, Time}; - {'EXIT', Pid, {skipped, Reason}, Time} -> + {'EXIT', Pid, {skip, Reason}, Time} -> megaco:report_event(20, Mod, ?MODULE, Label ++ " skipped", - [TestCase, Config, {skipped, Reason}]), - {skipped, {Mod, Fun}, Errors, Time}; + [TestCase, Config, {skip, Reason}]), + {skip, {Mod, Fun}, Errors, Time}; {'EXIT', Pid, Reason, Time} -> megaco:report_event(20, Mod, ?MODULE, Label ++ " crashed", [TestCase, Config, {'EXIT', Reason}]), @@ -492,14 +492,14 @@ do_eval(ReplyTo, Mod, Fun, Config) -> error:undef -> %% p("do_eval -> error - undef", []), ReplyTo ! {'EXIT', self(), undef, 0}; - exit:{skipped, Reason} -> + exit:{skip, Reason} -> %% p("do_eval -> exit - skipped" %% "~n Reason: ~p", [Reason]), T2 = os:timestamp(), Time = timer:now_diff(T2, T1), display_tc_time(Time), display_system_info("after (skipped)", Mod, Fun), - ReplyTo ! {'EXIT', self(), {skipped, Reason}, Time}; + ReplyTo ! {'EXIT', self(), {skip, Reason}, Time}; exit:{suite_failed, Reason} -> %% p("do_eval -> exit - suite-failed" %% "~n Reason: ~p", [Reason]), @@ -616,9 +616,9 @@ display_result(Res) when is_list(Res) -> Ok = [{MF, Time} || {ok, MF, _, Time} <- Res], Nyi = [MF || {nyi, MF, _, _Time} <- Res], SkippedGrps = [{{M,G}, Reason} || - {skipped, {M, {group, G}}, Reason, _Time} <- Res], + {skip, {M, {group, G}}, Reason, _Time} <- Res], SkippedCases = [{MF, Reason} || - {skipped, {_M, F} = MF, Reason, _Time} <- Res, + {skip, {_M, F} = MF, Reason, _Time} <- Res, is_atom(F)], FailedGrps = [{{M,G}, Reason} || {failed, {M, {group, G}}, Reason, _Time} <- Res], @@ -730,15 +730,18 @@ log(Format, Args, Mod, Line) -> [self(), Mod, Line] ++ Args) end. +skip(Reason) -> + exit({skip, Reason}). + skip(Actual, File, Line) -> - log("Skipping test case~n", [], File, Line), - String = lists:flatten(io_lib:format("Skipping test case ~p(~p): ~p~n", - [File, Line, Actual])), - exit({skipped, String}). + log("Skipping test case: ~p~n", [Actual], File, Line), + String = f("~p(~p): ~p~n", [File, Line, Actual]), + skip(String). fatal_skip(Actual, File, Line) -> error(Actual, File, Line), - exit({skipped, {fatal, Actual, File, Line}}). + skip({fatal, Actual, File, Line}). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -750,7 +753,8 @@ flush() -> after 1000 -> [] end. - + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Check if process is alive and kicking still_alive(Pid) -> @@ -988,11 +992,14 @@ node_to_name_and_host(Node) -> start_nodes([Node | Nodes], File, Line) -> case net_adm:ping(Node) of pong -> + p("node ~p already running", [Node]), start_nodes(Nodes, File, Line); pang -> [Name, Host] = node_to_name_and_host(Node), + p("try start node ~p", [Node]), case slave:start_link(Host, Name) of {ok, NewNode} when NewNode =:= Node -> + p("node ~p started - now set path, cwd and sync", [Node]), Path = code:get_path(), {ok, Cwd} = file:get_cwd(), true = rpc:call(Node, code, set_path, [Path]), @@ -1001,6 +1008,7 @@ start_nodes([Node | Nodes], File, Line) -> {_, []} = rpc:multicall(global, sync, []), start_nodes(Nodes, File, Line); Other -> + p("failed starting node ~p: ~p", [Node, Other]), fatal_skip({cannot_start_node, Node, Other}, File, Line) end end; @@ -1014,4 +1022,4 @@ f(F, A) -> lists:flatten(io_lib:format(F, A)). p(F, A) -> - io:format("~p~w:" ++ F ++ "~n", [self(), ?MODULE |A]). + io:format("~s ~p " ++ F ++ "~n", [?FTS(), self() | A]). |