diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-04-01 17:43:39 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-04-01 17:43:39 +0200 |
commit | 400d41eda5eca53b6b752c5b442d0f548266ce23 (patch) | |
tree | 4d2f1022071d3ccf70d4c3959236a6c00f2f71af /lib/os_mon | |
parent | 5d8ec8313876352d128c2fb6e368b77e85b479f0 (diff) | |
download | otp-400d41eda5eca53b6b752c5b442d0f548266ce23.tar.gz otp-400d41eda5eca53b6b752c5b442d0f548266ce23.tar.bz2 otp-400d41eda5eca53b6b752c5b442d0f548266ce23.zip |
Modernize use of timetraps
Diffstat (limited to 'lib/os_mon')
-rw-r--r-- | lib/os_mon/test/cpu_sup_SUITE.erl | 26 | ||||
-rw-r--r-- | lib/os_mon/test/disksup_SUITE.erl | 26 | ||||
-rw-r--r-- | lib/os_mon/test/memsup_SUITE.erl | 52 | ||||
-rw-r--r-- | lib/os_mon/test/os_mon_SUITE.erl | 36 | ||||
-rw-r--r-- | lib/os_mon/test/os_mon_mib_SUITE.erl | 28 | ||||
-rw-r--r-- | lib/os_mon/test/os_sup_SUITE.erl | 28 |
6 files changed, 45 insertions, 151 deletions
diff --git a/lib/os_mon/test/cpu_sup_SUITE.erl b/lib/os_mon/test/cpu_sup_SUITE.erl index e061fd87c6..597e53044d 100644 --- a/lib/os_mon/test/cpu_sup_SUITE.erl +++ b/lib/os_mon/test/cpu_sup_SUITE.erl @@ -21,7 +21,7 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). +-export([all/0, suite/0]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -31,9 +31,6 @@ -export([port/1]). -export([terminate/1, unavailable/1, restart/1]). -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). - init_per_suite(Config) when is_list(Config) -> ok = application:start(os_mon), Config. @@ -46,18 +43,17 @@ init_per_testcase(unavailable, Config) -> terminate(Config), init_per_testcase(dummy, Config); init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. end_per_testcase(unavailable, Config) -> restart(Config), end_per_testcase(dummy, Config); -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> case test_server:os_type() of @@ -71,16 +67,6 @@ all() -> _OS -> [unavailable] end. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - load_api(suite) -> []; load_api(doc) -> diff --git a/lib/os_mon/test/disksup_SUITE.erl b/lib/os_mon/test/disksup_SUITE.erl index 8e2825ec26..8e44122f47 100644 --- a/lib/os_mon/test/disksup_SUITE.erl +++ b/lib/os_mon/test/disksup_SUITE.erl @@ -21,7 +21,7 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). +-export([all/0, suite/0]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -32,9 +32,6 @@ -export([otp_5910/1]). -export([posix_only/1]). -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). - init_per_suite(Config) when is_list(Config) -> ok = application:start(os_mon), Config. @@ -47,19 +44,18 @@ init_per_testcase(unavailable, Config) -> terminate(Config), init_per_testcase(dummy, Config); init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog,Dog} | Config]. + Config. end_per_testcase(TC, Config) when TC =:= unavailable; TC =:= posix_only -> restart(Config), end_per_testcase(dummy, Config); -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> Bugs = [otp_5910], @@ -70,16 +66,6 @@ all() -> _OS -> [unavailable] end. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - api(suite) -> []; api(doc) -> ["Test of API functions"]; api(Config) when is_list(Config) -> diff --git a/lib/os_mon/test/memsup_SUITE.erl b/lib/os_mon/test/memsup_SUITE.erl index 1c1e898538..4a740a1c17 100644 --- a/lib/os_mon/test/memsup_SUITE.erl +++ b/lib/os_mon/test/memsup_SUITE.erl @@ -21,7 +21,7 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). +-export([all/0, suite/0]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -30,9 +30,6 @@ -export([config/1, timeout/1, unavailable/1, port/1]). -export([otp_5910/1]). -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). - init_per_suite(Config) when is_list(Config) -> ok = application:start(os_mon), Config. @@ -42,15 +39,14 @@ end_per_suite(Config) when is_list(Config) -> Config. init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog,Dog} | Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), Config. -suite() -> [{ct_hooks,[ts_install_cth]}]. +end_per_testcase(_Case, _Config) -> + ok. + +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> All = case test_server:os_type() of @@ -64,15 +60,6 @@ all() -> Bugs = [otp_5910], All ++ Bugs. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - api(suite) -> []; @@ -96,24 +83,23 @@ api(Config) when is_list(Config) -> %% get_system_memory_data() ExtMemData = memsup:get_system_memory_data(), - Tags = [ total_memory, - free_memory, - system_total_memory, - largest_free, - number_of_free, - free_swap, - total_swap, - cached_memory, - buffered_memory, - shared_memory], + Tags = [total_memory, + free_memory, + system_total_memory, + largest_free, + number_of_free, + free_swap, + total_swap, + cached_memory, + buffered_memory, + shared_memory], true = lists:all(fun({Tag,Value}) when is_atom(Tag), is_integer(Value) -> lists:member(Tag, Tags); (_) -> false - end, - ExtMemData), + end, ExtMemData), %% get_os_wordsize() ok = case memsup:get_os_wordsize() of @@ -180,7 +166,7 @@ alarm1(Config) when is_list(Config) -> io:format("alarm1: Total: ~p, Alloc: ~p~n", [Total, Alloc]), SysUsage = Alloc/Total, if - SysUsage>0.99 -> + SysUsage > 0.99 -> {skip, sys_mem_too_high}; true -> alarm1(Config, SysUsage) diff --git a/lib/os_mon/test/os_mon_SUITE.erl b/lib/os_mon/test/os_mon_SUITE.erl index a80d30f6b0..af70dc2a6c 100644 --- a/lib/os_mon/test/os_mon_SUITE.erl +++ b/lib/os_mon/test/os_mon_SUITE.erl @@ -21,26 +21,14 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). --export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0]). %% Test cases -export([app_file/1, appup_file/1, config/1]). -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). - -init_per_testcase(_Case, Config) -> - Dog = test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> case test_server:os_type() of @@ -48,22 +36,6 @@ all() -> _OS -> [app_file, appup_file] end. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - app_file(suite) -> []; app_file(doc) -> diff --git a/lib/os_mon/test/os_mon_mib_SUITE.erl b/lib/os_mon/test/os_mon_mib_SUITE.erl index f966e5ec58..4927389a58 100644 --- a/lib/os_mon/test/os_mon_mib_SUITE.erl +++ b/lib/os_mon/test/os_mon_mib_SUITE.erl @@ -35,9 +35,8 @@ -include_lib("snmp/include/snmp_types.hrl"). % Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0, groups/0, + init_per_suite/1, end_per_suite/1]). % Test cases must be exported. @@ -53,7 +52,6 @@ large_erl_process_mem64/1, disk_descr/1, disk_kbytes/1, disk_capacity/1]). --export([]). -export([otp_6351/1, otp_7441/1]). -define(TRAP_UDP, 5000). @@ -65,17 +63,11 @@ -define(MGR_PORT, 5001). %%--------------------------------------------------------------------- -init_per_testcase(_Case, Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:minutes(6)), - [{watchdog, Dog}|Config]. -end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - Config. - -suite() -> [{ct_hooks,[ts_install_cth]}, - {require, snmp_mgr_agent, snmp}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,6}}, + {require, snmp_mgr_agent, snmp}]. all() -> [load_unload, get_mem_sys_mark, get_mem_proc_mark, @@ -94,12 +86,6 @@ groups() -> {get_next_disk_table, [], [disk_descr, disk_kbytes, disk_capacity]}]. -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %%--------------------------------------------------------------------- %%-------------------------------------------------------------------- @@ -198,8 +184,6 @@ otp_6351(Config) when is_list(Config) -> ok. - - %%--------------------------------------------------------------------- get_mem_sys_mark(doc) -> ["Simulates a get call to test the instrumentation function " diff --git a/lib/os_mon/test/os_sup_SUITE.erl b/lib/os_mon/test/os_sup_SUITE.erl index 56bd67563c..39e3c7e815 100644 --- a/lib/os_mon/test/os_sup_SUITE.erl +++ b/lib/os_mon/test/os_sup_SUITE.erl @@ -21,17 +21,13 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). +-export([all/0, suite/0]). -export([init_per_suite/1, end_per_suite/1]). --export([init_per_testcase/2, end_per_testcase/2]). %% Test cases -export([message/1]). -export([config/1, port/1]). -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). - -define(TAG, test_tag). -define(MFA, {?MODULE, test_mfa, [?TAG]}). @@ -55,16 +51,9 @@ end_per_suite(Config) when is_list(Config) -> exit(whereis(message_receptor), done), Config. -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{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,{minutes,1}}]. all() -> case test_server:os_type() of @@ -76,15 +65,6 @@ all() -> {skip, lists:flatten(Str)} end. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - message(suite) -> []; |