diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-04-06 18:30:53 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-04-06 18:30:53 +0200 |
commit | 146dfa9ddc3b31649ef581d65f3cb00ef95af10f (patch) | |
tree | 8d104e6c9f51f26db19f10ed483dbca5566a289a /lib/tools/test/cprof_SUITE.erl | |
parent | 2ea950f70bb3c2bee32be7f98442df8d8d2f008a (diff) | |
download | otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.tar.gz otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.tar.bz2 otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.zip |
Remove ?line macros
Diffstat (limited to 'lib/tools/test/cprof_SUITE.erl')
-rw-r--r-- | lib/tools/test/cprof_SUITE.erl | 271 |
1 files changed, 134 insertions, 137 deletions
diff --git a/lib/tools/test/cprof_SUITE.erl b/lib/tools/test/cprof_SUITE.erl index 8beaf4f399..1dd4634303 100644 --- a/lib/tools/test/cprof_SUITE.erl +++ b/lib/tools/test/cprof_SUITE.erl @@ -44,7 +44,7 @@ -else. -include_lib("common_test/include/ct.hrl"). -endif. - + -ifdef(debug). -ifdef(STANDALONE). -define(line, erlang:display({?MODULE,?LINE}), ). @@ -56,7 +56,7 @@ -endif. -define(dbgformat(A,B),noop). -endif. - + -ifdef(STANDALONE). config(priv_dir, _) -> "."; @@ -65,13 +65,13 @@ config(data_dir, _) -> -else. %% When run in test server. -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2, end_per_testcase/2, - not_run/1]). + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + not_run/1]). -export([basic/1, on_load/1, modules/1]). - + init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(30)), + Dog=test_server:timetrap(test_server:seconds(30)), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> @@ -86,8 +86,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> case test_server:is_native(cprof_SUITE) of - true -> [not_run]; - false -> [basic, on_load, modules] + true -> [not_run]; + false -> [basic, on_load, modules] end. groups() -> @@ -137,164 +137,163 @@ modules(Config) when is_list(Config) -> %%% basic_test() -> - ?line M = 1000, + M = 1000, %% - ?line M2 = M*2, - ?line M3 = M*3, - ?line M2__1 = M2 + 1, - ?line M3__1 = M3 + 1, - ?line N = cprof:stop(), + M2 = M*2, + M3 = M*3, + M2__1 = M2 + 1, + M3__1 = M3 + 1, + N = cprof:stop(), %% - ?line 2 = cprof:start(?MODULE, seq_r), - ?line 1 = cprof:start(?MODULE, seq, 3), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), - ?line L = lists:reverse(Lr), + 2 = cprof:start(?MODULE, seq_r), + 1 = cprof:start(?MODULE, seq, 3), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), + L = lists:reverse(Lr), %% - ?line io:format("~p~n~p~n~p~n", - [erlang:trace_info({?MODULE,sec_r,3}, all), - erlang:trace_info({?MODULE,sec_r,4}, all), - erlang:trace_info({?MODULE,sec,3}, all)]), + io:format("~p~n~p~n~p~n", + [erlang:trace_info({?MODULE,sec_r,3}, all), + erlang:trace_info({?MODULE,sec_r,4}, all), + erlang:trace_info({?MODULE,sec,3}, all)]), %% - ?line ModAna1 = {?MODULE,M2__1,[{{?MODULE,seq_r,4},M}, - {{?MODULE,seq,3},M}, - {{?MODULE,seq_r,3},1}]}, - ?line ModAna1 = cprof:analyse(?MODULE,0), - ?line {M2__1, [ModAna1]} = cprof:analyse(), - ?line ModAna1 = cprof:analyse(?MODULE, 1), - ?line {M2__1, [ModAna1]} = cprof:analyse(1), + ModAna1 = {?MODULE,M2__1,[{{?MODULE,seq_r,4},M}, + {{?MODULE,seq,3},M}, + {{?MODULE,seq_r,3},1}]}, + ModAna1 = cprof:analyse(?MODULE,0), + {M2__1, [ModAna1]} = cprof:analyse(), + ModAna1 = cprof:analyse(?MODULE, 1), + {M2__1, [ModAna1]} = cprof:analyse(1), %% - ?line ModAna2 = {?MODULE,M2__1,[{{?MODULE,seq_r,4},M}, - {{?MODULE,seq,3},M}]}, - ?line ModAna2 = cprof:analyse(?MODULE, 2), - ?line {M2__1, [ModAna2]} = cprof:analyse(2), + ModAna2 = {?MODULE,M2__1,[{{?MODULE,seq_r,4},M}, + {{?MODULE,seq,3},M}]}, + ModAna2 = cprof:analyse(?MODULE, 2), + {M2__1, [ModAna2]} = cprof:analyse(2), %% 2 = cprof:pause(?MODULE, seq_r), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), %% - ?line ModAna3 = {?MODULE,M3__1,[{{?MODULE,seq,3},M2}, - {{?MODULE,seq_r,4},M}, - {{?MODULE,seq_r,3},1}]}, - ?line ModAna3 = cprof:analyse(?MODULE), + ModAna3 = {?MODULE,M3__1,[{{?MODULE,seq,3},M2}, + {{?MODULE,seq_r,4},M}, + {{?MODULE,seq_r,3},1}]}, + ModAna3 = cprof:analyse(?MODULE), %% - ?line N = cprof:pause(), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), + N = cprof:pause(), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), %% - ?line {M3__1, [ModAna3]} = cprof:analyse(), + {M3__1, [ModAna3]} = cprof:analyse(), %% - ?line N = cprof:restart(), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), + N = cprof:restart(), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), %% - ?line ModAna1 = cprof:analyse(?MODULE), + ModAna1 = cprof:analyse(?MODULE), %% - ?line N = cprof:stop(), - ?line {?MODULE,0,[]} = cprof:analyse(?MODULE), - ?line {0,[]} = cprof:analyse(), + N = cprof:stop(), + {?MODULE,0,[]} = cprof:analyse(?MODULE), + {0,[]} = cprof:analyse(), ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% on_load_test(Config) -> - ?line Priv = ?config(priv_dir, Config), - ?line Data = ?config(data_dir, Config), - ?line File = filename:join(Data, "cprof_SUITE_test"), - ?line Module = cprof_SUITE_test, - ?line M = 1000, + Priv = ?config(priv_dir, Config), + Data = ?config(data_dir, Config), + File = filename:join(Data, "cprof_SUITE_test"), + Module = cprof_SUITE_test, + M = 1000, %% - ?line M2 = M*2, - ?line M2__1 = M2 + 1, - ?line N1 = cprof:start(), + M2 = M*2, + M2__1 = M2 + 1, + N1 = cprof:start(), - ?line {ok,Module} = c:c(File, [{outdir,Priv}]), + {ok,Module} = c:c(File, [{outdir,Priv}]), %% If this system is hipe-enabled, the loader may have called module_info/1 %% when Module was loaded above. Reset the call count to avoid seeing %% the call in the analysis below. - ?line 1 = cprof:restart(Module, module_info, 1), - - ?line L = Module:seq(1, M, fun succ/1), - ?line Lr = Module:seq_r(1, M, fun succ/1), - ?line Lr = lists:reverse(L), - ?line N2 = cprof:pause(), - ?line N3 = cprof:pause(Module), - ?line {Module,M2__1,[{{Module,seq_r,4},M}, - {{Module,seq,3},M}, - {{Module,seq_r,3},1}]} = cprof:analyse(Module), - ?line io:format("~p ~p ~p~n", [N1, N2, N3]), - ?line code:purge(Module), - ?line code:delete(Module), - ?line N4 = N2 - N3, + 1 = cprof:restart(Module, module_info, 1), + + L = Module:seq(1, M, fun succ/1), + Lr = Module:seq_r(1, M, fun succ/1), + Lr = lists:reverse(L), + N2 = cprof:pause(), + N3 = cprof:pause(Module), + {Module,M2__1,[{{Module,seq_r,4},M}, + {{Module,seq,3},M}, + {{Module,seq_r,3},1}]} = cprof:analyse(Module), + io:format("~p ~p ~p~n", [N1, N2, N3]), + code:purge(Module), + code:delete(Module), + N4 = N2 - N3, %% - ?line N4 = cprof:restart(), - ?line {ok,Module} = c:c(File, [{outdir,Priv}]), - ?line L = Module:seq(1, M, fun succ/1), - ?line Lr = Module:seq_r(1, M, fun succ/1), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), - ?line N2 = cprof:pause(), - ?line {Module,0,[]} = cprof:analyse(Module), - ?line M_1 = M - 1, - ?line M4__4 = M*4 - 4, - ?line M10_7 = M*10 - 7, - ?line {?MODULE,M10_7,[{{?MODULE,succ,1},M4__4}, - {{?MODULE,seq_r,4},M}, - {{?MODULE,seq,3},M}, - {{?MODULE,'-on_load_test/1-fun-5-',1},M_1}, - {{?MODULE,'-on_load_test/1-fun-4-',1},M_1}, - {{?MODULE,'-on_load_test/1-fun-3-',1},M_1}, - {{?MODULE,'-on_load_test/1-fun-2-',1},M_1}, - {{?MODULE,seq_r,3},1}]} - = cprof:analyse(?MODULE), - ?line N2 = cprof:stop(), + N4 = cprof:restart(), + {ok,Module} = c:c(File, [{outdir,Priv}]), + L = Module:seq(1, M, fun succ/1), + Lr = Module:seq_r(1, M, fun succ/1), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), + N2 = cprof:pause(), + {Module,0,[]} = cprof:analyse(Module), + M_1 = M - 1, + M4__4 = M*4 - 4, + M10_7 = M*10 - 7, + {?MODULE,M10_7,[{{?MODULE,succ,1},M4__4}, + {{?MODULE,seq_r,4},M}, + {{?MODULE,seq,3},M}, + {{?MODULE,'-on_load_test/1-fun-5-',1},M_1}, + {{?MODULE,'-on_load_test/1-fun-4-',1},M_1}, + {{?MODULE,'-on_load_test/1-fun-3-',1},M_1}, + {{?MODULE,'-on_load_test/1-fun-2-',1},M_1}, + {{?MODULE,seq_r,3},1}]} + = cprof:analyse(?MODULE), + N2 = cprof:stop(), ok. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% modules_test(Config) -> - ?line Priv = ?config(priv_dir, Config), - ?line Data = ?config(data_dir, Config), - ?line File = filename:join(Data, "cprof_SUITE_test"), - ?line Module = cprof_SUITE_test, - ?line {ok,Module} = c:c(File, [{outdir,Priv}]), - ?line M = 10, + Priv = ?config(priv_dir, Config), + Data = ?config(data_dir, Config), + File = filename:join(Data, "cprof_SUITE_test"), + Module = cprof_SUITE_test, + {ok,Module} = c:c(File, [{outdir,Priv}]), + M = 10, %% - ?line M2 = M*2, - ?line M2__1 = M2 + 1, - ?line erlang:yield(), - ?line N = cprof:start(), - ?line L = Module:seq(1, M, fun succ/1), - ?line Lr = Module:seq_r(1, M, fun succ/1), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), - ?line N = cprof:pause(), - ?line Lr = lists:reverse(L), - ?line M_1 = M - 1, - ?line M4_4 = M*4 - 4, - ?line M10_7 = M*10 - 7, - ?line M2__1 = M*2 + 1, - ?line {Tot,ModList} = cprof:analyse(), - ?line {value,{?MODULE,M10_7,[{{?MODULE,succ,1},M4_4}, - {{?MODULE,seq_r,4},M}, - {{?MODULE,seq,3},M}, - {{?MODULE,'-modules_test/1-fun-3-',1},M_1}, - {{?MODULE,'-modules_test/1-fun-2-',1},M_1}, - {{?MODULE,'-modules_test/1-fun-1-',1},M_1}, - {{?MODULE,'-modules_test/1-fun-0-',1},M_1}, - {{?MODULE,seq_r,3},1}]}} = - lists:keysearch(?MODULE, 1, ModList), - ?line {value,{Module,M2__1,[{{Module,seq_r,4},M}, - {{Module,seq,3},M}, - {{Module,seq_r,3},1}]}} = - lists:keysearch(Module, 1, ModList), - ?line Tot = lists:foldl(fun ({_,C,_}, A) -> C+A end, 0, ModList), - ?line {cprof,_,Prof} = cprof:analyse(cprof), - ?line {value,{{cprof,pause,0},1}} = - lists:keysearch({cprof,pause,0}, 1, Prof), - ?line N = cprof:stop(), + M2 = M*2, + M2__1 = M2 + 1, + erlang:yield(), + N = cprof:start(), + L = Module:seq(1, M, fun succ/1), + Lr = Module:seq_r(1, M, fun succ/1), + L = seq(1, M, fun succ/1), + Lr = seq_r(1, M, fun succ/1), + N = cprof:pause(), + Lr = lists:reverse(L), + M_1 = M - 1, + M4_4 = M*4 - 4, + M10_7 = M*10 - 7, + M2__1 = M*2 + 1, + {Tot,ModList} = cprof:analyse(), + {value,{?MODULE,M10_7,[{{?MODULE,succ,1},M4_4}, + {{?MODULE,seq_r,4},M}, + {{?MODULE,seq,3},M}, + {{?MODULE,'-modules_test/1-fun-3-',1},M_1}, + {{?MODULE,'-modules_test/1-fun-2-',1},M_1}, + {{?MODULE,'-modules_test/1-fun-1-',1},M_1}, + {{?MODULE,'-modules_test/1-fun-0-',1},M_1}, + {{?MODULE,seq_r,3},1}]}} = + lists:keysearch(?MODULE, 1, ModList), + {value,{Module,M2__1,[{{Module,seq_r,4},M}, + {{Module,seq,3},M}, + {{Module,seq_r,3},1}]}} = + lists:keysearch(Module, 1, ModList), + Tot = lists:foldl(fun ({_,C,_}, A) -> C+A end, 0, ModList), + {cprof,_,Prof} = cprof:analyse(cprof), + {value,{{cprof,pause,0},1}} = lists:keysearch({cprof,pause,0}, 1, Prof), + N = cprof:stop(), ok. @@ -303,7 +302,6 @@ modules_test(Config) -> %% Local helpers - %% Stack recursive seq seq(Stop, Stop, Succ) when is_function(Succ) -> [Stop]; @@ -322,6 +320,5 @@ seq_r(Start, Stop, Succ, R) -> seq_r(Succ(Start), Stop, Succ, [Start | R]). - %% Successor succ(X) -> X+1. |