diff options
Diffstat (limited to 'lib/tools/test/instrument_SUITE.erl')
-rw-r--r-- | lib/tools/test/instrument_SUITE.erl | 149 |
1 files changed, 73 insertions, 76 deletions
diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index 773d805cd0..bf541023ed 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -28,7 +28,7 @@ -include_lib("common_test/include/ct.hrl"). init_per_testcase(_Case, Config) -> - ?line Dog=?t:timetrap(10000), + Dog=?t:timetrap(10000), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> @@ -60,92 +60,89 @@ end_per_group(_GroupName, Config) -> '+Mim true'(doc) -> ["Check that memory data can be read and processed"]; '+Mim true'(suite) -> []; '+Mim true'(Config) when is_list(Config) -> - ?line Node = start_slave("+Mim true"), - ?line MD = rpc:call(Node, instrument, memory_data, []), - ?line [{total,[{sizes,S1,S2,S3},{blocks,B1,B2,B3}]}] + Node = start_slave("+Mim true"), + MD = rpc:call(Node, instrument, memory_data, []), + [{total,[{sizes,S1,S2,S3},{blocks,B1,B2,B3}]}] = rpc:call(Node, instrument, memory_status, [total]), - ?line stop_slave(Node), - ?line true = S1 =< S2, - ?line true = S2 =< S3, - ?line true = B1 =< B2, - ?line true = B2 =< B3, - ?line MDS = instrument:sort(MD), - ?line {Low, High} = instrument:mem_limits(MDS), - ?line true = Low < High, - ?line {_, AL} = MDS, - ?line SumBlocks = instrument:sum_blocks(MD), - ?line case SumBlocks of - N when is_integer(N) -> - ?line N = lists:foldl(fun ({_,_,Size,_}, Sum) -> - Size+Sum - end, - 0, - AL), - ?line N =< S3; - Other -> - ?line ?t:fail(Other) - end, - ?line lists:foldl( - fun ({TDescr,Addr,Size,Proc}, MinAddr) -> - ?line true = TDescr /= invalid_type, - ?line true = is_integer(TDescr), - ?line true = is_integer(Addr), - ?line true = is_integer(Size), - ?line true = Addr >= MinAddr, - ?line case Proc of - {0, Number, Serial} -> - ?line true = is_integer(Number), - ?line true = is_integer(Serial); - undefined -> - ok; - BadProc -> - ?line ?t:fail({badproc, BadProc}) - end, - ?line NextMinAddr = Addr+Size, - ?line true = NextMinAddr =< High, - ?line NextMinAddr - end, - Low, - AL), - ?line {_, DAL} = instrument:descr(MDS), - ?line lists:foreach( - fun ({TDescr,_,_,Proc}) -> - ?line true = TDescr /= invalid_type, - ?line true = is_atom(TDescr) orelse is_list(TDescr), - ?line true = is_pid(Proc) orelse Proc == undefined - end, - DAL), - ?line ASL = lists:map(fun ({_,A,S,_}) -> {A,S} end, AL), - ?line ASL = lists:map(fun ({_,A,S,_}) -> {A,S} end, DAL), - ?line instrument:holes(MDS), - ?line {comment, + stop_slave(Node), + true = S1 =< S2, + true = S2 =< S3, + true = B1 =< B2, + true = B2 =< B3, + MDS = instrument:sort(MD), + {Low, High} = instrument:mem_limits(MDS), + true = Low < High, + {_, AL} = MDS, + SumBlocks = instrument:sum_blocks(MD), + case SumBlocks of + N when is_integer(N) -> + N = lists:foldl(fun ({_,_,Size,_}, Sum) -> + Size+Sum + end, + 0, + AL), + N =< S3; + Other -> + ?t:fail(Other) + end, + lists:foldl( + fun ({TDescr,Addr,Size,Proc}, MinAddr) -> + true = TDescr /= invalid_type, + true = is_integer(TDescr), + true = is_integer(Addr), + true = is_integer(Size), + true = Addr >= MinAddr, + case Proc of + {0, Number, Serial} -> + true = is_integer(Number), + true = is_integer(Serial); + undefined -> + ok; + BadProc -> + ?t:fail({badproc, BadProc}) + end, + NextMinAddr = Addr+Size, + true = NextMinAddr =< High, + NextMinAddr + end, Low, AL), + {_, DAL} = instrument:descr(MDS), + lists:foreach( + fun ({TDescr,_,_,Proc}) -> + true = TDescr /= invalid_type, + true = is_atom(TDescr) orelse is_list(TDescr), + true = is_pid(Proc) orelse Proc == undefined + end, DAL), + ASL = lists:map(fun ({_,A,S,_}) -> {A,S} end, AL), + ASL = lists:map(fun ({_,A,S,_}) -> {A,S} end, DAL), + instrument:holes(MDS), + {comment, "total status - sum of blocks = " ++ integer_to_list(S1-SumBlocks)}. '+Mis true'(doc) -> ["Check that memory data can be read and processed"]; '+Mis true'(suite) -> []; '+Mis true'(Config) when is_list(Config) -> - ?line Node = start_slave("+Mis true"), - ?line [{total,[{sizes,S1,S2,S3},{blocks,B1,B2,B3}]}] + Node = start_slave("+Mis true"), + [{total,[{sizes,S1,S2,S3},{blocks,B1,B2,B3}]}] = rpc:call(Node, instrument, memory_status, [total]), - ?line true = S1 =< S2, - ?line true = S2 =< S3, - ?line true = B1 =< B2, - ?line true = B2 =< B3, - ?line true = is_list(rpc:call(Node,instrument,memory_status,[allocators])), - ?line true = is_list(rpc:call(Node,instrument,memory_status,[classes])), - ?line true = is_list(rpc:call(Node,instrument,memory_status,[types])), - ?line ok. + true = S1 =< S2, + true = S2 =< S3, + true = B1 =< B2, + true = B2 =< B3, + true = is_list(rpc:call(Node,instrument,memory_status,[allocators])), + true = is_list(rpc:call(Node,instrument,memory_status,[classes])), + true = is_list(rpc:call(Node,instrument,memory_status,[types])), + ok. start_slave(Args) -> - ?line {A, B, C} = now(), - ?line MicroSecs = A*1000000000000 + B*1000000 + C, - ?line Name = "instr_" ++ integer_to_list(MicroSecs), - ?line Pa = filename:dirname(code:which(?MODULE)), - ?line {ok, Node} = ?t:start_node(list_to_atom(Name), + {A, B, C} = now(), + MicroSecs = A*1000000000000 + B*1000000 + C, + Name = "instr_" ++ integer_to_list(MicroSecs), + Pa = filename:dirname(code:which(?MODULE)), + {ok, Node} = ?t:start_node(list_to_atom(Name), slave, [{args, "-pa " ++ Pa ++ " " ++ Args}]), - ?line Node. + Node. stop_slave(Node) -> - ?line true = ?t:stop_node(Node). + true = ?t:stop_node(Node). |