From 1924817788f381da1b8356e336d62f4687717ee4 Mon Sep 17 00:00:00 2001 From: Andrzej Telezynski Date: Wed, 24 Aug 2011 23:56:37 +0200 Subject: More robust testing of tracing with 'local' option. --- lib/observer/test/client.erl | 1 - lib/observer/test/ttb_SUITE.erl | 11 ++++++++--- lib/observer/test/ttb_helper.erl | 13 +++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/observer/test/client.erl b/lib/observer/test/client.erl index 5d8f0b30df..e756f9d6e8 100644 --- a/lib/observer/test/client.erl +++ b/lib/observer/test/client.erl @@ -2,7 +2,6 @@ -compile(export_all). init(Node) -> - io:format(user, "Initing~p~n", [Node]), application:start(runtime_tools), net_kernel:connect_node(Node). diff --git a/lib/observer/test/ttb_SUITE.erl b/lib/observer/test/ttb_SUITE.erl index 5c85f143f9..4c7010e427 100644 --- a/lib/observer/test/ttb_SUITE.erl +++ b/lib/observer/test/ttb_SUITE.erl @@ -778,7 +778,7 @@ marking_call_handler() -> (_,_,_,_) -> ok end, initial}. counter_call_handler() -> - {fun(_, A={trace_ts, _, call, _, _} ,_,State) -> State + 1; + {fun(_, {trace_ts, _, call, _, _} ,_,State) -> State + 1; (A, end_of_trace, _, State) -> io:format(A,"~p.~n", [State]) end, 0}. ret_caller_call_handler() -> @@ -886,7 +886,12 @@ begin_trace_local(ServerNode, ClientNode, Dest) -> check_size(N, Dest, Output, ServerNode, ClientNode) -> ?line begin_trace(ServerNode, ClientNode, Dest), - ?line ttb_helper:msgs(N), + ?line case Dest of + {local, _} -> + ?line ttb_helper:msgs_ip(N); + _ -> + ?line ttb_helper:msgs(N) + end, ?line {_, D} = ttb:stop([fetch, return_fetch_dir]), ?line ttb:format(D, [{out, Output}, {handler, simple_call_handler()}]), ?line {ok, Ret} = file:consult(Output), @@ -955,7 +960,7 @@ logfile_name_in_fetch_dir(Config) when is_list(Config) -> ?line ?t:stop_node(ClientNode), ?line P1 = lists:nth(3, string:tokens(filename:basename(Dir), "_")), ?line P2 = hd(string:tokens(P1, "-")), - ?line File = P2. + ?line _File = P2. upload_to_my_logdir(suite) -> []; diff --git a/lib/observer/test/ttb_helper.erl b/lib/observer/test/ttb_helper.erl index 3885812ba1..570ce934ab 100644 --- a/lib/observer/test/ttb_helper.erl +++ b/lib/observer/test/ttb_helper.erl @@ -7,7 +7,7 @@ %%msgs(N) -> N times client:put(test_msg) %%clear() -> restart server %%ensure_running() / stop() -> start/stop nodes -%%node(atom) -> return atom@hostname +%%get_node(atom) -> return atom@hostname -define(NODE_CMD(Name), "erl -sname " ++ atom_to_list(Name) ++ @@ -65,7 +65,12 @@ stop() -> msgs(N) -> [c(client, put, [test_msg]) || _ <- lists:seq(1, N)], s(server, received, [a,b]), - [dbg:flush_trace_port(Node) || Node <- [client@ariel, server@ariel]]. + [dbg:flush_trace_port(Node) || Node <- [get_node(client), get_node(server)]]. + +msgs_ip(N) -> + [c(client, put, [test_msg]) || _ <- lists:seq(1, N)], + s(server, received, [a,b]), + timer:sleep(100). %% allow trace messages to arrive over tcp/ip run() -> ttb({local, "A"}), @@ -87,7 +92,7 @@ trace_setup() -> ttb() -> ttb("A"). ttb(File) -> - ttb:tracer([server@ariel, client@ariel], [{file, File}, resume]), + ttb:tracer([get_node(client), get_node(server)], [{file, File}, resume]), ttb:p(all, [call, timestamp]), ttb:tp(client, put, []), ttb:tp(client, get, []), @@ -116,7 +121,7 @@ show_handler() -> {fun(A,B,_,_) -> io:format(A, "~p~n", [B]) end, []}. opts() -> - [[client@ariel, server@ariel], + [[get_node(client), get_node(server)], [{server, received, '_', []}, {client, put, '_', []}, {client, get, '_', []}], -- cgit v1.2.3