summaryrefslogtreecommitdiff
path: root/erts/emulator/test/trace_bif_SUITE.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <egil@erlang.org>2016-03-10 18:19:16 +0100
committerBjörn-Egil Dahlberg <egil@erlang.org>2016-03-11 15:46:44 +0100
commit20ae6a9238d3fd09587bd3f4179a8ae25f1e3aea (patch)
treeb3c60da26fdd5ab270c5c5bb0db3a6eb1dfb8d70 /erts/emulator/test/trace_bif_SUITE.erl
parent33b0c5f37b7b5baa42d4999d1a2be32470fb1bc8 (diff)
downloaderlang-20ae6a9238d3fd09587bd3f4179a8ae25f1e3aea.tar.gz
Remove ?line macros
Diffstat (limited to 'erts/emulator/test/trace_bif_SUITE.erl')
-rw-r--r--erts/emulator/test/trace_bif_SUITE.erl244
1 files changed, 114 insertions, 130 deletions
diff --git a/erts/emulator/test/trace_bif_SUITE.erl b/erts/emulator/test/trace_bif_SUITE.erl
index 7995c1831a..b774210456 100644
--- a/erts/emulator/test/trace_bif_SUITE.erl
+++ b/erts/emulator/test/trace_bif_SUITE.erl
@@ -22,8 +22,7 @@
-include_lib("common_test/include/ct.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2]).
+-export([all/0, suite/0]).
-export([trace_bif/1, trace_bif_timestamp/1, trace_on_and_off/1,
trace_bif_local/1,
trace_bif_timestamp_local/1, trace_bif_return/1, not_run/1,
@@ -42,40 +41,25 @@ all() ->
trace_bif_return, trace_info_old_code]
end.
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
not_run(Config) when is_list(Config) ->
{skipped,"Native code"}.
%% Tests switching tracing on and off.
trace_on_and_off(Config) when is_list(Config) ->
- ?line Pid = spawn(?MODULE, bif_process, []),
- ?line Self = self(),
- ?line 1 = erlang:trace(Pid, true, [call,timestamp]),
- ?line {flags, Flags} = erlang:trace_info(Pid,flags),
- ?line [call,timestamp] = lists:sort(Flags),
- ?line {tracer, Self} = erlang:trace_info(Pid,tracer),
- ?line 1 = erlang:trace(Pid, false, [timestamp]),
- ?line {flags,[call]} = erlang:trace_info(Pid,flags),
- ?line {tracer, Self} = erlang:trace_info(Pid,tracer),
- ?line 1 = erlang:trace(Pid, false, [call]),
- ?line {flags,[]} = erlang:trace_info(Pid,flags),
- ?line {tracer, []} = erlang:trace_info(Pid,tracer),
- ?line exit(Pid,kill),
+ Pid = spawn(?MODULE, bif_process, []),
+ Self = self(),
+ 1 = erlang:trace(Pid, true, [call,timestamp]),
+ {flags, Flags} = erlang:trace_info(Pid,flags),
+ [call,timestamp] = lists:sort(Flags),
+ {tracer, Self} = erlang:trace_info(Pid,tracer),
+ 1 = erlang:trace(Pid, false, [timestamp]),
+ {flags,[call]} = erlang:trace_info(Pid,flags),
+ {tracer, Self} = erlang:trace_info(Pid,tracer),
+ 1 = erlang:trace(Pid, false, [call]),
+ {flags,[]} = erlang:trace_info(Pid,flags),
+ {tracer, []} = erlang:trace_info(Pid,tracer),
+ exit(Pid,kill),
ok.
%% Test tracing BIFs.
@@ -87,52 +71,52 @@ trace_bif_local(Config) when is_list(Config) ->
do_trace_bif([local]).
do_trace_bif(Flags) ->
- ?line Pid = spawn(?MODULE, bif_process, []),
- ?line 1 = erlang:trace(Pid, true, [call]),
- ?line erlang:trace_pattern({erlang,'_','_'}, [], Flags),
- ?line Pid ! {do_bif, time, []},
- ?line receive_trace_msg({trace,Pid,call,{erlang,time, []}}),
- ?line Pid ! {do_bif, statistics, [runtime]},
- ?line receive_trace_msg({trace,Pid,call,
- {erlang,statistics, [runtime]}}),
-
- ?line Pid ! {do_time_bif},
- ?line receive_trace_msg({trace,Pid,call,
- {erlang,time, []}}),
-
- ?line Pid ! {do_statistics_bif},
- ?line receive_trace_msg({trace,Pid,call,
- {erlang,statistics, [runtime]}}),
-
- ?line 1 = erlang:trace(Pid, false, [call]),
- ?line erlang:trace_pattern({erlang,'_','_'}, false, Flags),
- ?line exit(Pid, die),
+ Pid = spawn(?MODULE, bif_process, []),
+ 1 = erlang:trace(Pid, true, [call]),
+ erlang:trace_pattern({erlang,'_','_'}, [], Flags),
+ Pid ! {do_bif, time, []},
+ receive_trace_msg({trace,Pid,call,{erlang,time, []}}),
+ Pid ! {do_bif, statistics, [runtime]},
+ receive_trace_msg({trace,Pid,call,
+ {erlang,statistics, [runtime]}}),
+
+ Pid ! {do_time_bif},
+ receive_trace_msg({trace,Pid,call,
+ {erlang,time, []}}),
+
+ Pid ! {do_statistics_bif},
+ receive_trace_msg({trace,Pid,call,
+ {erlang,statistics, [runtime]}}),
+
+ 1 = erlang:trace(Pid, false, [call]),
+ erlang:trace_pattern({erlang,'_','_'}, false, Flags),
+ exit(Pid, die),
ok.
%% Test tracing BIFs with timestamps.
trace_bif_timestamp(Config) when is_list(Config) ->
do_trace_bif_timestamp([], timestamp, [timestamp]),
do_trace_bif_timestamp([], timestamp,
- [timestamp,
- monotonic_timestamp,
- strict_monotonic_timestamp]),
+ [timestamp,
+ monotonic_timestamp,
+ strict_monotonic_timestamp]),
do_trace_bif_timestamp([], strict_monotonic_timestamp,
- [strict_monotonic_timestamp]),
+ [strict_monotonic_timestamp]),
do_trace_bif_timestamp([], strict_monotonic_timestamp,
- [monotonic_timestamp, strict_monotonic_timestamp]),
+ [monotonic_timestamp, strict_monotonic_timestamp]),
do_trace_bif_timestamp([], monotonic_timestamp, [monotonic_timestamp]).
-
+
%% Test tracing BIFs with timestamps and local flag.
trace_bif_timestamp_local(Config) when is_list(Config) ->
do_trace_bif_timestamp([local], timestamp, [timestamp]),
do_trace_bif_timestamp([local], timestamp,
- [timestamp,
- monotonic_timestamp,
- strict_monotonic_timestamp]),
+ [timestamp,
+ monotonic_timestamp,
+ strict_monotonic_timestamp]),
do_trace_bif_timestamp([local], strict_monotonic_timestamp,
- [strict_monotonic_timestamp]),
+ [strict_monotonic_timestamp]),
do_trace_bif_timestamp([local], strict_monotonic_timestamp,
- [monotonic_timestamp, strict_monotonic_timestamp]),
+ [monotonic_timestamp, strict_monotonic_timestamp]),
do_trace_bif_timestamp([local], monotonic_timestamp, [monotonic_timestamp]).
do_trace_bif_timestamp(Flags, TsType, TsFlags) ->
@@ -144,22 +128,22 @@ do_trace_bif_timestamp(Flags, TsType, TsFlags) ->
Ts0 = make_ts(TsType),
Pid ! {do_bif, time, []},
Ts1 = receive_trace_msg_ts({trace_ts,Pid,call,{erlang,time,[]}},
- Ts0,TsType),
+ Ts0,TsType),
Pid ! {do_bif, statistics, [runtime]},
Ts2 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,statistics, [runtime]}},
- Ts1, TsType),
+ {erlang,statistics, [runtime]}},
+ Ts1, TsType),
Pid ! {do_time_bif},
Ts3 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,time, []}},
- Ts2, TsType),
+ {erlang,time, []}},
+ Ts2, TsType),
Pid ! {do_statistics_bif},
Ts4 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,statistics, [runtime]}},
- Ts3, TsType),
+ {erlang,statistics, [runtime]}},
+ Ts3, TsType),
check_ts(TsType, Ts4, make_ts(TsType)),
@@ -168,11 +152,11 @@ do_trace_bif_timestamp(Flags, TsType, TsFlags) ->
Pid ! {do_statistics_bif},
receive_trace_msg({trace,Pid,call,
- {erlang,statistics, [runtime]}}),
+ {erlang,statistics, [runtime]}}),
Pid ! {do_bif, statistics, [runtime]},
receive_trace_msg({trace,Pid,call,
- {erlang,statistics, [runtime]}}),
+ {erlang,statistics, [runtime]}}),
1 = erlang:trace(Pid, false, [call]),
erlang:trace_pattern({erlang,'_','_'}, false, Flags),
@@ -184,13 +168,13 @@ do_trace_bif_timestamp(Flags, TsType, TsFlags) ->
trace_bif_return(Config) when is_list(Config) ->
do_trace_bif_return(timestamp, [timestamp]),
do_trace_bif_return(timestamp,
- [timestamp,
- monotonic_timestamp,
- strict_monotonic_timestamp]),
+ [timestamp,
+ monotonic_timestamp,
+ strict_monotonic_timestamp]),
do_trace_bif_return(strict_monotonic_timestamp,
- [strict_monotonic_timestamp]),
+ [strict_monotonic_timestamp]),
do_trace_bif_return(strict_monotonic_timestamp,
- [monotonic_timestamp, strict_monotonic_timestamp]),
+ [monotonic_timestamp, strict_monotonic_timestamp]),
do_trace_bif_return(monotonic_timestamp, [monotonic_timestamp]).
do_trace_bif_return(TsType, TsFlags) ->
@@ -198,59 +182,59 @@ do_trace_bif_return(TsType, TsFlags) ->
Pid=spawn(?MODULE, bif_process, []),
1 = erlang:trace(Pid, true, [call,return_to]++TsFlags),
erlang:trace_pattern({erlang,'_','_'}, [{'_',[],[{return_trace}]}],
- [local]),
+ [local]),
Ts0 = make_ts(TsType),
Pid ! {do_bif, time, []},
Ts1 = receive_trace_msg_ts({trace_ts,Pid,call,{erlang,time,[]}},
- Ts0, TsType),
+ Ts0, TsType),
Ts2 = receive_trace_msg_ts_return_from({trace_ts,Pid,return_from,
- {erlang,time,0}},
- Ts1, TsType),
+ {erlang,time,0}},
+ Ts1, TsType),
Ts3 = receive_trace_msg_ts_return_to({trace_ts,Pid,return_to,
- {?MODULE, bif_process,0}},
- Ts2, TsType),
-
-
+ {?MODULE, bif_process,0}},
+ Ts2, TsType),
+
+
Pid ! {do_bif, statistics, [runtime]},
Ts4 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,statistics, [runtime]}},
- Ts3, TsType),
+ {erlang,statistics, [runtime]}},
+ Ts3, TsType),
Ts5 = receive_trace_msg_ts_return_from({trace_ts,Pid,return_from,
- {erlang,statistics,1}},
- Ts4, TsType),
+ {erlang,statistics,1}},
+ Ts4, TsType),
Ts6 = receive_trace_msg_ts_return_to({trace_ts,Pid,return_to,
- {?MODULE, bif_process,0}},
- Ts5, TsType),
-
-
+ {?MODULE, bif_process,0}},
+ Ts5, TsType),
+
+
Pid ! {do_time_bif},
Ts7 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,time, []}},
- Ts6, TsType),
+ {erlang,time, []}},
+ Ts6, TsType),
Ts8 = receive_trace_msg_ts_return_from({trace_ts,Pid,return_from,
- {erlang,time,0}},
- Ts7, TsType),
+ {erlang,time,0}},
+ Ts7, TsType),
Ts9 = receive_trace_msg_ts_return_to({trace_ts,Pid,return_to,
- {?MODULE, bif_process,0}},
- Ts8, TsType),
+ {?MODULE, bif_process,0}},
+ Ts8, TsType),
Pid ! {do_statistics_bif},
Ts10 = receive_trace_msg_ts({trace_ts,Pid,call,
- {erlang,statistics, [runtime]}},
- Ts9, TsType),
+ {erlang,statistics, [runtime]}},
+ Ts9, TsType),
Ts11 = receive_trace_msg_ts_return_from({trace_ts,Pid,return_from,
- {erlang,statistics,1}},
- Ts10, TsType),
+ {erlang,statistics,1}},
+ Ts10, TsType),
Ts12 = receive_trace_msg_ts_return_to({trace_ts,Pid,return_to,
- {?MODULE, bif_process,0}},
- Ts11, TsType),
+ {?MODULE, bif_process,0}},
+ Ts11, TsType),
check_ts(TsType, Ts12, make_ts(TsType)),
ok.
-
-
+
+
receive_trace_msg(Mess) ->
receive
Mess ->
@@ -327,37 +311,37 @@ check_ts(strict_monotonic_timestamp, PrevTs, Ts) ->
bif_process() ->
receive
- {do_bif, Name, Args} ->
- apply(erlang, Name, Args),
- bif_process();
- {do_time_bif} ->
- %% Match the return value to ensure that the time() call
- %% is not optimized away.
- {_,_,_} = time(),
- bif_process();
- {do_statistics_bif} ->
- statistics(runtime),
- bif_process();
- _Stuff ->
- bif_process()
+ {do_bif, Name, Args} ->
+ apply(erlang, Name, Args),
+ bif_process();
+ {do_time_bif} ->
+ %% Match the return value to ensure that the time() call
+ %% is not optimized away.
+ {_,_,_} = time(),
+ bif_process();
+ {do_statistics_bif} ->
+ statistics(runtime),
+ bif_process();
+ _Stuff ->
+ bif_process()
end.
-
+
%% trace_info on deleted module (OTP-5057).
trace_info_old_code(Config) when is_list(Config) ->
- ?line MFA = {M,F,0} = {test,foo,0},
- ?line Fname = atom_to_list(M)++".erl",
- ?line AbsForms =
- [{attribute,a(1),module,M}, % -module(M).
- {attribute,a(2),export,[{F,0}]}, % -export([F/0]).
- {function,a(3),F,0, % F() ->
- [{clause,a(4),[],[],[{atom,a(4),F}]}]}], % F.
+ MFA = {M,F,0} = {test,foo,0},
+ Fname = atom_to_list(M)++".erl",
+ AbsForms =
+ [{attribute,a(1),module,M}, % -module(M).
+ {attribute,a(2),export,[{F,0}]}, % -export([F/0]).
+ {function,a(3),F,0, % F() ->
+ [{clause,a(4),[],[],[{atom,a(4),F}]}]}], % F.
%%
- ?line {ok,M,Mbin} = compile:forms(AbsForms),
- ?line {module,M} = code:load_binary(M, Fname, Mbin),
- ?line true = erlang:delete_module(M),
- ?line {traced,undefined} = erlang:trace_info(MFA, traced),
+ {ok,M,Mbin} = compile:forms(AbsForms),
+ {module,M} = code:load_binary(M, Fname, Mbin),
+ true = erlang:delete_module(M),
+ {traced,undefined} = erlang:trace_info(MFA, traced),
ok.
a(L) ->