From 146dfa9ddc3b31649ef581d65f3cb00ef95af10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 6 Apr 2016 18:30:53 +0200 Subject: Remove ?line macros --- lib/tools/test/instrument_SUITE.erl | 149 ++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 76 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') 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). -- cgit v1.2.3 From 8ccea1c2c756d8bc548ee6ba3e10f5a583aca7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 6 Apr 2016 19:46:34 +0200 Subject: Modernize use of timetraps --- lib/tools/test/instrument_SUITE.erl | 40 ++++++------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index bf541023ed..b4ace283d6 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -19,43 +19,18 @@ %% -module(instrument_SUITE). --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]). - +-export([all/0, suite/0]). -export(['+Mim true'/1, '+Mis true'/1]). -include_lib("common_test/include/ct.hrl"). -init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(10000), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{seconds,10}}]. all() -> ['+Mim true', '+Mis true']. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - '+Mim true'(doc) -> ["Check that memory data can be read and processed"]; '+Mim true'(suite) -> []; @@ -78,9 +53,7 @@ end_per_group(_GroupName, Config) -> N when is_integer(N) -> N = lists:foldl(fun ({_,_,Size,_}, Sum) -> Size+Sum - end, - 0, - AL), + end, 0, AL), N =< S3; Other -> ?t:fail(Other) @@ -115,8 +88,7 @@ end_per_group(_GroupName, Config) -> 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)}. + {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) -> []; -- cgit v1.2.3 From 6e810f587a35606e1031e4f8e673a62c96015efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 6 Apr 2016 20:09:47 +0200 Subject: Eliminate erlang:now/0 --- lib/tools/test/instrument_SUITE.erl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index b4ace283d6..619ef9597d 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -106,9 +106,8 @@ all() -> ok. start_slave(Args) -> - {A, B, C} = now(), - MicroSecs = A*1000000000000 + B*1000000 + C, - Name = "instr_" ++ integer_to_list(MicroSecs), + MicroSecs = erlang:monotonic_time(), + Name = "instr" ++ integer_to_list(MicroSecs), Pa = filename:dirname(code:which(?MODULE)), {ok, Node} = ?t:start_node(list_to_atom(Name), slave, -- cgit v1.2.3 From c9f6f5b9c20ada3dfa1e682cf49c09e3311db248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 6 Apr 2016 20:18:57 +0200 Subject: Eliminate use of test_server:fail/0,1 --- lib/tools/test/instrument_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index 619ef9597d..db19a6912c 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -56,7 +56,7 @@ all() -> end, 0, AL), N =< S3; Other -> - ?t:fail(Other) + ct:fail(Other) end, lists:foldl( fun ({TDescr,Addr,Size,Proc}, MinAddr) -> @@ -72,7 +72,7 @@ all() -> undefined -> ok; BadProc -> - ?t:fail({badproc, BadProc}) + ct:fail({badproc, BadProc}) end, NextMinAddr = Addr+Size, true = NextMinAddr =< High, -- cgit v1.2.3 From fba6f786f26aac535fe2c9f3c10472efe841cb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 7 Apr 2016 15:54:06 +0200 Subject: Replace ?t with test_server The macro ?t is deprecated. Replace its use with 'test_server'. --- lib/tools/test/instrument_SUITE.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index db19a6912c..0105c00099 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -109,11 +109,11 @@ start_slave(Args) -> MicroSecs = erlang:monotonic_time(), 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}]), + {ok, Node} = test_server:start_node(list_to_atom(Name), + slave, + [{args, "-pa " ++ Pa ++ " " ++ Args}]), Node. stop_slave(Node) -> - true = ?t:stop_node(Node). + true = test_server:stop_node(Node). -- cgit v1.2.3 From e660be75fdaa3d7e98da94194063494ac92ab807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 7 Apr 2016 16:20:53 +0200 Subject: Eliminate use of doc and suite clauses Those clause are obsolete and never used by common_test. --- lib/tools/test/instrument_SUITE.erl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index 0105c00099..573625bff7 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -32,8 +32,7 @@ all() -> ['+Mim true', '+Mis true']. -'+Mim true'(doc) -> ["Check that memory data can be read and processed"]; -'+Mim true'(suite) -> []; +%% Check that memory data can be read and processed '+Mim true'(Config) when is_list(Config) -> Node = start_slave("+Mim true"), MD = rpc:call(Node, instrument, memory_data, []), @@ -90,8 +89,7 @@ all() -> 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) -> []; +%% Check that memory data can be read and processed '+Mis true'(Config) when is_list(Config) -> Node = start_slave("+Mis true"), [{total,[{sizes,S1,S2,S3},{blocks,B1,B2,B3}]}] -- cgit v1.2.3 From 58d3cc32ac36b33c4b634035d53137758bff03d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 7 Apr 2016 16:21:33 +0200 Subject: Fix instruments_SUITE sumblock check --- lib/tools/test/instrument_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/tools/test/instrument_SUITE.erl') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index 573625bff7..40d86f3fbb 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -53,7 +53,7 @@ all() -> N = lists:foldl(fun ({_,_,Size,_}, Sum) -> Size+Sum end, 0, AL), - N =< S3; + true = N =< S3; Other -> ct:fail(Other) end, -- cgit v1.2.3