diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-03-08 19:35:31 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-03-11 15:43:10 +0100 |
commit | c062dfc485ad0d51d648701950f77ef8f51d4f35 (patch) | |
tree | bc504742a0bdaea8d5cfbe1cd34625b25c78023a /erts/emulator | |
parent | 9042f9f26fc42fc108c3e3711cf3bfdae2d3312d (diff) | |
download | otp-c062dfc485ad0d51d648701950f77ef8f51d4f35.tar.gz otp-c062dfc485ad0d51d648701950f77ef8f51d4f35.tar.bz2 otp-c062dfc485ad0d51d648701950f77ef8f51d4f35.zip |
Modernize use of timetraps
Diffstat (limited to 'erts/emulator')
65 files changed, 430 insertions, 1897 deletions
diff --git a/erts/emulator/test/a_SUITE.erl b/erts/emulator/test/a_SUITE.erl index a9bba9548b..ec0c42db06 100644 --- a/erts/emulator/test/a_SUITE.erl +++ b/erts/emulator/test/a_SUITE.erl @@ -29,30 +29,15 @@ -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, long_timers/1, pollset_size/1]). +-export([all/0, suite/0, + long_timers/1, pollset_size/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [long_timers, pollset_size]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - long_timers(doc) -> []; long_timers(suite) -> @@ -106,5 +91,3 @@ display_check_io(ChkIo) -> get_check_io_info() -> z_SUITE:get_check_io_info(). - - diff --git a/erts/emulator/test/after_SUITE.erl b/erts/emulator/test/after_SUITE.erl index 879fb03927..71edaa25c3 100644 --- a/erts/emulator/test/after_SUITE.erl +++ b/erts/emulator/test/after_SUITE.erl @@ -24,50 +24,25 @@ -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, t_after/1, receive_after/1, receive_after_big/1, receive_after_errors/1, receive_var_zero/1, receive_zero/1, multi_timeout/1, receive_after_32bit/1, receive_after_blast/1]). --export([init_per_testcase/2, end_per_testcase/2]). - %% Internal exports. -export([timeout_g/0]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> [t_after, receive_after, receive_after_big, receive_after_errors, receive_var_zero, receive_zero, multi_timeout, receive_after_32bit, receive_after_blast]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - %% Tests for an old round-off error in 'receive after'." t_after(Config) when is_list(Config) -> ?line spawn(fun frequent_process/0), diff --git a/erts/emulator/test/alloc_SUITE.erl b/erts/emulator/test/alloc_SUITE.erl index 332e2ad67d..75ae687ffc 100644 --- a/erts/emulator/test/alloc_SUITE.erl +++ b/erts/emulator/test/alloc_SUITE.erl @@ -19,8 +19,7 @@ -module(alloc_SUITE). -author('[email protected]'). --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, init_per_testcase/2, end_per_testcase/2]). -export([basic/1, coalesce/1, @@ -34,42 +33,20 @@ cpool/1, migration/1]). --export([init_per_testcase/2, end_per_testcase/2]). - -include_lib("common_test/include/ct.hrl"). --define(DEFAULT_TIMETRAP_SECS, 240). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> [basic, coalesce, threads, realloc_copy, bucket_index, bucket_mask, rbtree, mseg_clear_cache, erts_mmap, cpool, migration]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - - init_per_testcase(Case, Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:seconds(?DEFAULT_TIMETRAP_SECS)), - [{watchdog, Dog}, {testcase, Case}, {debug,false} | Config]. + [{testcase, Case},{debug,false}|Config]. end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/erts/emulator/test/async_ports_SUITE.erl b/erts/emulator/test/async_ports_SUITE.erl index c89b3655ff..9647d87c32 100644 --- a/erts/emulator/test/async_ports_SUITE.erl +++ b/erts/emulator/test/async_ports_SUITE.erl @@ -1,8 +1,10 @@ -module(async_ports_SUITE). --include_lib("common_test/include/ct.hrl"). +-export([all/0, suite/0]). +-export([permanent_busy_test/1]). +-export([run_loop/5]). --compile(export_all). +-include_lib("common_test/include/ct.hrl"). -define(PACKET_SIZE, (10 * 1024 * 8)). -define(CPORT_DELAY, 100). @@ -11,17 +13,15 @@ -define(TEST_PROCS_COUNT, 2). -define(TC_TIMETRAP_SECONDS, 10). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, ?TC_TIMETRAP_SECONDS}}]. all() -> - [ - permanent_busy_test - ]. + [permanent_busy_test]. permanent_busy_test(Config) -> - ct:timetrap({seconds, ?TC_TIMETRAP_SECONDS}), ExePath = filename:join(?config(data_dir, Config), "cport"), - Self = self(), spawn_link( fun() -> @@ -29,17 +29,16 @@ permanent_busy_test(Config) -> Port = open_port(ExePath), - Testers = - lists:map( - fun(_) -> - erlang:spawn_link(?MODULE, run_loop, - [Self, - Port, - Block, - ?TEST_LOOPS_COUNT, - 0]) - end, - lists:seq(1, ?TEST_PROCS_COUNT)), + Testers = lists:map( + fun(_) -> + spawn_link(?MODULE, run_loop, + [Self, + Port, + Block, + ?TEST_LOOPS_COUNT, + 0]) + end, + lists:seq(1, ?TEST_PROCS_COUNT)), Self ! {test_info, Port, Testers}, endless_flush(Port) end), diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl index 9bba5387fa..ccde904fbc 100644 --- a/erts/emulator/test/bif_SUITE.erl +++ b/erts/emulator/test/bif_SUITE.erl @@ -23,9 +23,7 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). --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, display/1, display_huge/0, erl_bif_types/1,guard_bifs_in_erl_bif_types/1, shadow_comments/1, @@ -35,7 +33,9 @@ atom_to_binary/1,min_max/1, erlang_halt/1, is_builtin/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [erl_bif_types, guard_bifs_in_erl_bif_types, shadow_comments, @@ -45,31 +45,6 @@ all() -> atom_to_binary, binary_to_atom, binary_to_existing_atom, min_max, erlang_halt, is_builtin]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(1)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - - display(suite) -> []; display(doc) -> diff --git a/erts/emulator/test/big_SUITE.erl b/erts/emulator/test/big_SUITE.erl index bb77235253..9b611a136c 100644 --- a/erts/emulator/test/big_SUITE.erl +++ b/erts/emulator/test/big_SUITE.erl @@ -20,8 +20,8 @@ -module(big_SUITE). --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, groups/0]). + -export([t_div/1, eq_28/1, eq_32/1, eq_big/1, eq_math/1, big_literals/1, borders/1, negative/1, big_float_1/1, big_float_2/1, shift_limit_1/1, powmod/1, system_limit/1, toobig/1, otp_6692/1]). @@ -32,11 +32,12 @@ -export([fac/1, fib/1, pow/2, gcd/2, lcm/2]). --export([init_per_testcase/2, end_per_testcase/2]). -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [t_div, eq_28, eq_32, eq_big, eq_math, big_literals, @@ -46,27 +47,6 @@ all() -> groups() -> [{big_float, [], [big_float_1, big_float_2]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - %% %% Syntax of data files: %% Expr1 = Expr2. diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl index 1fa7353252..2d93bace15 100644 --- a/erts/emulator/test/bs_construct_SUITE.erl +++ b/erts/emulator/test/bs_construct_SUITE.erl @@ -22,8 +22,7 @@ -module(bs_construct_SUITE). --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, test1/1, test2/1, test3/1, test4/1, test5/1, testf/1, not_used/1, in_guard/1, mem_leak/1, coerce_to_float/1, bjorn/1, @@ -33,7 +32,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [test1, test2, test3, test4, test5, testf, not_used, @@ -42,21 +43,6 @@ all() -> copy_writable_binary, kostis, dynamic, bs_add, otp_7422, zero_width, bad_append, bs_add_overflow]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - big(1) -> 57285702734876389752897683. diff --git a/erts/emulator/test/bs_match_misc_SUITE.erl b/erts/emulator/test/bs_match_misc_SUITE.erl index b161d9544e..967325842c 100644 --- a/erts/emulator/test/bs_match_misc_SUITE.erl +++ b/erts/emulator/test/bs_match_misc_SUITE.erl @@ -19,8 +19,7 @@ %% -module(bs_match_misc_SUITE). --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, bound_var/1,bound_tail/1,t_float/1,little_float/1,sean/1, kenneth/1,encode_binary/1,native/1,happi/1, size_var/1,wiger/1,x0_context/1,huge_float_field/1, @@ -29,7 +28,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [bound_var, bound_tail, t_float, little_float, sean, @@ -37,21 +38,6 @@ all() -> x0_context, huge_float_field, writable_binary_matched, otp_7198, unordered_bindings, float_middle_endian]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - bound_var(doc) -> "Test matching of bound variables."; bound_var(Config) when is_list(Config) -> diff --git a/erts/emulator/test/bs_utf_SUITE.erl b/erts/emulator/test/bs_utf_SUITE.erl index 91e4e30dd2..f03115c3c8 100644 --- a/erts/emulator/test/bs_utf_SUITE.erl +++ b/erts/emulator/test/bs_utf_SUITE.erl @@ -20,9 +20,7 @@ -module(bs_utf_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, utf8_roundtrip/1,utf16_roundtrip/1,utf32_roundtrip/1, utf8_illegal_sequences/1,utf16_illegal_sequences/1, utf32_illegal_sequences/1, @@ -32,37 +30,15 @@ -define(FAIL(Expr), ?line fail_check(catch Expr, ??Expr, [])). -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(6)), - [{watchdog,Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 6}}]. all() -> [utf8_roundtrip, utf16_roundtrip, utf32_roundtrip, utf8_illegal_sequences, utf16_illegal_sequences, utf32_illegal_sequences, bad_construction]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - utf8_roundtrip(Config) when is_list(Config) -> ?line utf8_roundtrip(0, 16#D7FF), ?line utf8_roundtrip(16#E000, 16#10FFFF), diff --git a/erts/emulator/test/busy_port_SUITE.erl b/erts/emulator/test/busy_port_SUITE.erl index 0e81141907..9bd4f7e136 100644 --- a/erts/emulator/test/busy_port_SUITE.erl +++ b/erts/emulator/test/busy_port_SUITE.erl @@ -20,8 +20,7 @@ -module(busy_port_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,end_per_testcase/2, +-export([all/0, suite/0, end_per_testcase/2, io_to_busy/1, message_order/1, send_3/1, system_monitor/1, no_trap_exit/1, no_trap_exit_unlinked/1, trap_exit/1, multiple_writers/1, @@ -34,7 +33,9 @@ %% Internal exports. -export([init/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> [io_to_busy, message_order, send_3, system_monitor, @@ -43,21 +44,6 @@ all() -> scheduling_delay_busy,scheduling_delay_busy_nosuspend, scheduling_busy_link]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - end_per_testcase(_Case, Config) when is_list(Config) -> case whereis(busy_drv_server) of undefined -> @@ -78,15 +64,13 @@ end_per_testcase(_Case, Config) when is_list(Config) -> io_to_busy(suite) -> []; io_to_busy(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(30)), + ct:timetrap({seconds, 30}), ?line start_busy_driver(Config), ?line process_flag(trap_exit, true), ?line Writer = fun_spawn(fun writer/0), ?line Generator = fun_spawn(fun() -> generator(100, Writer) end), ?line wait_for([Writer, Generator]), - - ?line test_server:timetrap_cancel(Dog), ok. generator(N, Writer) -> @@ -132,7 +116,7 @@ forget(_) -> message_order(suite) -> {req, dynamic_loading}; message_order(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line start_busy_driver(Config), ?line Self = self(), @@ -149,8 +133,6 @@ message_order(Config) when is_list(Config) -> Other -> test_server:fail({unexpected_message, Other}) end, - - ?line test_server:timetrap_cancel(Dog), ok. send_to_busy_1(Parent) -> @@ -167,7 +149,7 @@ send_to_busy_1(Parent) -> send_3(suite) -> {req,dynamic_loading}; send_3(doc) -> ["Test the BIF send/3"]; send_3(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), %% ?line start_busy_driver(Config), ?line {Owner,Slave} = get_slave(), @@ -180,15 +162,13 @@ send_3(Config) when is_list(Config) -> ?line ok = erlang:send(Slave, {Owner,{command,"not busy"}}, [nosuspend]), ?line ok = command(stop), - %% - ?line test_server:timetrap_cancel(Dog), ok. %% Test the erlang:system_monitor(Pid, [busy_port]) system_monitor(suite) -> {req,dynamic_loading}; system_monitor(doc) -> ["Test erlang:system_monitor({Pid,[busy_port]})."]; system_monitor(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line Self = self(), %% ?line OldMonitor = erlang:system_monitor(Self, [busy_port]), @@ -226,18 +206,12 @@ system_monitor(Config) when is_list(Config) -> ?line _NewMonitor = erlang:system_monitor(OldMonitor), ?line OldMonitor = erlang:system_monitor(), ?line OldMonitor = erlang:system_monitor(OldMonitor), - %% - ?line test_server:timetrap_cancel(Dog), ok. - - rec(Tag) -> receive X -> X after 1000 -> Tag end. - - %% Assuming the following scenario, %% %% +---------------+ +-----------+ @@ -250,7 +224,7 @@ rec(Tag) -> no_trap_exit(suite) -> []; no_trap_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line process_flag(trap_exit, true), ?line Pid = fun_spawn(fun no_trap_exit_process/3, [self(), linked, Config]), @@ -267,8 +241,6 @@ no_trap_exit(Config) when is_list(Config) -> Other2 -> test_server:fail({unexpected_message, Other2}) end, - - ?line test_server:timetrap_cancel(Dog), ok. %% The same scenario as above, but the port has been explicitly @@ -276,7 +248,7 @@ no_trap_exit(Config) when is_list(Config) -> no_trap_exit_unlinked(suite) -> []; no_trap_exit_unlinked(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line process_flag(trap_exit, true), ?line Pid = fun_spawn(fun no_trap_exit_process/3, [self(), unlink, Config]), @@ -293,7 +265,6 @@ no_trap_exit_unlinked(Config) when is_list(Config) -> Other2 -> test_server:fail({unexpected_message, Other2}) end, - ?line test_server:timetrap_cancel(Dog), ok. no_trap_exit_process(ResultTo, Link, Config) -> @@ -322,7 +293,7 @@ no_trap_exit_process(ResultTo, Link, Config) -> trap_exit(suite) -> []; trap_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line Pid = fun_spawn(fun busy_port_exit_process/2, [self(), Config]), ?line receive {Pid, port_created, Port} -> @@ -339,7 +310,6 @@ trap_exit(Config) when is_list(Config) -> Other2 -> test_server:fail({unexpected_message, Other2}) end, - ?line test_server:timetrap_cancel(Dog), ok. busy_port_exit_process(ResultTo, Config) -> @@ -364,7 +334,7 @@ busy_port_exit_process(ResultTo, Config) -> multiple_writers(suite) -> []; multiple_writers(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line start_busy_driver(Config), ?line process_flag(trap_exit, true), @@ -385,8 +355,6 @@ multiple_writers(Config) when is_list(Config) -> %% Unlock the port. The surviving processes should be become runnable. ?line unlock_slave(), ?line wait_for([W2, W4, W5]), - - ?line test_server:timetrap_cancel(Dog), ok. quick_writer() -> diff --git a/erts/emulator/test/call_trace_SUITE.erl b/erts/emulator/test/call_trace_SUITE.erl index b9f8fe52f3..1b67bcd83e 100644 --- a/erts/emulator/test/call_trace_SUITE.erl +++ b/erts/emulator/test/call_trace_SUITE.erl @@ -21,8 +21,7 @@ -module(call_trace_SUITE). --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, init_per_testcase/2,end_per_testcase/2, hipe/1,process_specs/1,basic/1,flags/1,errors/1,pam/1,change_pam/1, return_trace/1,exception_trace/1,on_load/1,deep_exception/1, @@ -43,7 +42,9 @@ -define(P, 20). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> Common = [errors, on_load], @@ -57,30 +58,10 @@ all() -> false -> NotHipe ++ Common end. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:seconds(30)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - %% Reloading the module will clear all trace patterns, and %% in a debug-compiled emulator run assertions of the counters %% for the number of traced exported functions in this module. diff --git a/erts/emulator/test/code_parallel_load_SUITE.erl b/erts/emulator/test/code_parallel_load_SUITE.erl index 3998d27d04..95cf9ddac4 100644 --- a/erts/emulator/test/code_parallel_load_SUITE.erl +++ b/erts/emulator/test/code_parallel_load_SUITE.erl @@ -19,46 +19,31 @@ %% -module(code_parallel_load_SUITE). --export([ - all/0, - suite/0, - init_per_suite/1, - end_per_suite/1, - init_per_testcase/2, - end_per_testcase/2 - ]). - --export([ - multiple_load_check_purge_repeat/1, - many_load_distributed_only_once/1 - ]). +-export([all/0, + suite/0, + init_per_testcase/2, + end_per_testcase/2]). + +-export([multiple_load_check_purge_repeat/1, + many_load_distributed_only_once/1]). -define(model, code_parallel_load_SUITE_model). -define(interval, 50). -define(number_of_processes, 160). -define(passes, 4). - -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> - [ - multiple_load_check_purge_repeat, - many_load_distributed_only_once - ]. - - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. + [ multiple_load_check_purge_repeat, + many_load_distributed_only_once ]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Func, Config) -> SConf = ?config(save_config, Config), @@ -72,9 +57,7 @@ end_per_testcase(_Func, Config) -> true -> check_and_purge_processes_code(Pids, ?model); _ -> ok end, - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - + ok. multiple_load_check_purge_repeat(_Conf) -> Ts = [v1,v2,v3,v4,v5,v6], diff --git a/erts/emulator/test/crypto_SUITE.erl b/erts/emulator/test/crypto_SUITE.erl index 41fe6a226c..e9498028cb 100644 --- a/erts/emulator/test/crypto_SUITE.erl +++ b/erts/emulator/test/crypto_SUITE.erl @@ -22,40 +22,23 @@ -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, t_md5/1,t_md5_update/1,error/1,unaligned_context/1,random_lists/1, misc_errors/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [t_md5, t_md5_update, error, unaligned_context, random_lists, misc_errors]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - - misc_errors(doc) -> ["Test crc32, adler32 and md5 error cases not covered by other tests"]; misc_errors(suite) -> []; misc_errors(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(2)), + ct:timetrap({minutes, 2}), ?line 1 = erlang:adler32([]), ?line L = lists:duplicate(600,3), ?line 1135871753 = erlang:adler32(L), @@ -78,7 +61,6 @@ misc_errors(Config) when is_list(Config) -> ?line {'EXIT', {badarg,_}} = (catch erlang:adler32_combine(3,3,Big)), ?line {'EXIT', {badarg,_}} = (catch erlang:md5_update(<<"hej">>,<<"hej">>)), ?line {'EXIT', {badarg,_}} = (catch erlang:md5_final(<<"hej">>)), - ?line test_server:timetrap_cancel(Dog), ok. @@ -132,7 +114,7 @@ random_lists(doc) -> random_lists(suite) -> []; random_lists(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(5)), + ct:timetrap({minutes, 5}), ?line Num = erlang:system_info(schedulers_online), ?line B = list_to_binary( lists:duplicate( @@ -232,7 +214,6 @@ random_lists(Config) when is_list(Config) -> fun() -> random_iolist:run2(150,ADLER32_1_L_2,ADLER32_3_L_2) end}, {?LINE, fun() -> random_iolist:run2(150,MD5_1_L_2,MD5_2_L_2) end}], ?line run_in_para(Wlist1,Num), - ?line test_server:timetrap_cancel(Dog), ok. %% diff --git a/erts/emulator/test/ddll_SUITE.erl b/erts/emulator/test/ddll_SUITE.erl index 7ff727bcf5..36c779c8e3 100644 --- a/erts/emulator/test/ddll_SUITE.erl +++ b/erts/emulator/test/ddll_SUITE.erl @@ -31,9 +31,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, ddll_test/1, errors/1, - reference_count/1, +-export([all/0, suite/0, + ddll_test/1, errors/1, reference_count/1, kill_port/1, dont_kill_port/1]). -export([unload_on_process_exit/1, delayed_unload_with_ports/1, unload_due_to_process_exit/1, @@ -54,7 +53,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [ddll_test, errors, reference_count, kill_port, @@ -70,28 +71,11 @@ all() -> no_trap_exit_and_kill_ports, monitor_demonitor, monitor_demonitor_load, new_interface, lock_driver]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - unload_on_process_exit(suite) -> []; unload_on_process_exit(doc) -> ["Check that the driver is unloaded on process exit"]; unload_on_process_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line false = lists:member("echo_drv",element(2,erl_ddll:loaded_drivers())), Parent = self(), @@ -117,7 +101,6 @@ unload_on_process_exit(Config) when is_list(Config) -> end, receive after 500 -> ok end, ?line false = lists:member("echo_drv",element(2,erl_ddll:loaded_drivers())), - ?line test_server:timetrap_cancel(Dog), ok. delayed_unload_with_ports(suite) -> @@ -125,7 +108,6 @@ delayed_unload_with_ports(suite) -> delayed_unload_with_ports(doc) -> ["Check that the driver is unloaded when the last port is closed"]; delayed_unload_with_ports(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line erl_ddll:try_load(Path, echo_drv, []), ?line erl_ddll:try_load(Path, echo_drv, []), @@ -142,7 +124,6 @@ delayed_unload_with_ports(Config) when is_list(Config) -> ?line Port2 ! {self(), close}, ?line ok = receive {Port2,closed} -> ok after 1000 -> false end, ?line ok = receive {'DOWN', Ref, driver, echo_drv, unloaded} -> ok after 1000 -> false end, - ?line test_server:timetrap_cancel(Dog), ok. unload_due_to_process_exit(suite) -> @@ -150,7 +131,6 @@ unload_due_to_process_exit(suite) -> unload_due_to_process_exit(doc) -> ["Check that the driver with ports is unloaded on process exit"]; unload_due_to_process_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line F3 = fun() -> @@ -176,7 +156,6 @@ unload_due_to_process_exit(Config) when is_list(Config) -> Pid ! go, ?line ok = receive {'DOWN', Ref, process, Pid, banan} -> ok after 300 -> error end, ?line ok = receive {got,{'DOWN', Ref2, driver, echo_drv, unloaded}} -> ok after 300 -> error end, - ?line test_server:timetrap_cancel(Dog), ok. no_unload_due_to_process_exit(suite) -> @@ -184,7 +163,6 @@ no_unload_due_to_process_exit(suite) -> no_unload_due_to_process_exit(doc) -> ["Check that a driver with driver loaded in another process is not unloaded on process exit"]; no_unload_due_to_process_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line F3 = fun() -> @@ -213,7 +191,6 @@ no_unload_due_to_process_exit(Config) when is_list(Config) -> ?line ok = receive X -> {error, X} after 300 -> ok end, ?line ok = unload_expect_fast(echo_drv,[]), ?line ok = receive {got,{'DOWN', Ref2, driver, echo_drv, unloaded}} -> ok after 300 -> error end, - ?line test_server:timetrap_cancel(Dog), ok. no_unload_due_to_process_exit_2(suite) -> @@ -221,7 +198,6 @@ no_unload_due_to_process_exit_2(suite) -> no_unload_due_to_process_exit_2(doc) -> ["Check that a driver with open ports in another process is not unloaded on process exit"]; no_unload_due_to_process_exit_2(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line F3 = fun() -> @@ -250,7 +226,6 @@ no_unload_due_to_process_exit_2(Config) when is_list(Config) -> ?line ok = receive X -> {error, X} after 300 -> ok end, ?line erlang:port_close(Port), ?line ok = receive {got,{'DOWN', Ref2, driver, echo_drv, unloaded}} -> ok after 300 -> error end, - ?line test_server:timetrap_cancel(Dog), ok. unload_reload_thingie(suite) -> @@ -258,7 +233,6 @@ unload_reload_thingie(suite) -> unload_reload_thingie(doc) -> ["Check delayed unload and reload"]; unload_reload_thingie(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line {ok, loaded} = erl_ddll:try_load(Path, echo_drv, []), @@ -295,7 +269,6 @@ unload_reload_thingie(Config) when is_list(Config) -> after 300 -> error end, ?line ok = receive X -> {error, X} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. unload_reload_thingie_2(suite) -> @@ -303,7 +276,6 @@ unload_reload_thingie_2(suite) -> unload_reload_thingie_2(doc) -> ["Check delayed unload and reload"]; unload_reload_thingie_2(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line {ok, loaded} = erl_ddll:try_load(Path, echo_drv, []), @@ -339,7 +311,6 @@ unload_reload_thingie_2(Config) when is_list(Config) -> end, ?line ok = unload_expect_fast(echo_drv,[{monitor,pending}]), ?line ok = receive X -> {error, X} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. unload_reload_thingie_3(suite) -> @@ -347,7 +318,6 @@ unload_reload_thingie_3(suite) -> unload_reload_thingie_3(doc) -> ["Check delayed unload and reload failure"]; unload_reload_thingie_3(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line {ok, loaded} = erl_ddll:try_load(Path, echo_drv, []), @@ -385,13 +355,11 @@ unload_reload_thingie_3(Config) when is_list(Config) -> ?line {'EXIT',_} = (catch erl_ddll:info(echo_drv, port_count)), ?line {error, not_loaded} = erl_ddll:try_unload(echo_drv,[{monitor,pending}]), ?line ok = receive X -> {error, X} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. reload_pending(suite) -> []; reload_pending(doc) -> ["Reload a driver that is pending on a user"]; reload_pending(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line F3 = fun() -> @@ -437,13 +405,11 @@ reload_pending(Config) when is_list(Config) -> ?line ok = receive {'UP', Ref3, driver, echo_drv, loaded} -> ok after 300 -> error end, [{Parent,1}] = erl_ddll:info(echo_drv,processes), ?line ok = receive Z -> {error, Z} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. load_fail_init(suite) -> []; load_fail_init(doc) -> ["Tests failure in the init in driver struct."]; load_fail_init(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line PathFailing = ?config(priv_dir, Config), ?line [_|_] = AllFailInits = filelib:wildcard("echo_drv_fail_init.*",Path), @@ -464,14 +430,12 @@ load_fail_init(Config) when is_list(Config) -> after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. reload_pending_fail_init(suite) -> []; reload_pending_fail_init(doc) -> ["Reload a driver that is pending but init fails"]; reload_pending_fail_init(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line PathFailing = ?config(priv_dir, Config), ?line [_|_] = AllFailInits = filelib:wildcard("echo_drv_fail_init.*",Path), @@ -525,14 +489,12 @@ reload_pending_fail_init(Config) when is_list(Config) -> ?line {'EXIT',{badarg,_}} = (catch erl_ddll:info(echo_drv,processes)), ?line ok = receive Z -> {error, Z} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. reload_pending_kill(suite) -> []; reload_pending_kill(doc) -> ["Reload a driver with kill_ports option " "that is pending on a user"]; reload_pending_kill(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line OldFlag = process_flag(trap_exit,true), ?line Path = ?config(data_dir, Config), ?line Parent = self(), @@ -619,7 +581,6 @@ reload_pending_kill(Config) when is_list(Config) -> io:format("Port = ~w, Port2 = ~w, Port3 = ~w~n",[Port,Port2,Port3]), ?line ok = receive Z -> {error, Z} after 300 -> ok end, ?line process_flag(trap_exit,OldFlag), - ?line test_server:timetrap_cancel(Dog), ok. @@ -638,7 +599,6 @@ forced_port_killing(suite) -> forced_port_killing(doc) -> ["Check kill_ports option to try_unload "]; forced_port_killing(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line OldFlag=process_flag(trap_exit,true), ?line Parent = self(), @@ -666,7 +626,6 @@ forced_port_killing(Config) when is_list(Config) -> ?line ok = receive {'DOWN',Ref1, driver, echo_drv, unloaded} -> ok after 300 -> false end, ?line process_flag(trap_exit,OldFlag), ?line ok = receive X -> {error, X} after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. no_trap_exit_and_kill_ports(suite) -> @@ -674,7 +633,6 @@ no_trap_exit_and_kill_ports(suite) -> no_trap_exit_and_kill_ports(doc) -> ["Check delayed unload and reload with no trap_exit"]; no_trap_exit_and_kill_ports(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line Parent = self(), ?line OldFlag=process_flag(trap_exit,true), @@ -707,7 +665,6 @@ no_trap_exit_and_kill_ports(Config) when is_list(Config) -> ?line ok = receive {got,{'DOWN', Ref2, driver, echo_drv, unloaded}} -> ok after 300 -> error end, ?line ok = receive {'EXIT',MyPort,driver_unloaded} -> ok after 300 -> error end, ?line process_flag(trap_exit,OldFlag), - ?line test_server:timetrap_cancel(Dog), ok. monitor_demonitor(suite) -> @@ -715,7 +672,6 @@ monitor_demonitor(suite) -> monitor_demonitor(doc) -> ["Check monitor and demonitor of drivers"]; monitor_demonitor(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line erl_ddll:try_load(Path, echo_drv, []), ?line Ref = erl_ddll:monitor(driver,{echo_drv,unloaded}), @@ -725,7 +681,6 @@ monitor_demonitor(Config) when is_list(Config) -> ?line [] = erl_ddll:info(echo_drv,awaiting_unload), ?line erl_ddll:try_unload(echo_drv,[]), ?line ok = receive _ -> error after 300 -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. monitor_demonitor_load(suite) -> @@ -733,7 +688,6 @@ monitor_demonitor_load(suite) -> monitor_demonitor_load(doc) -> ["Check monitor/demonitor of driver loading"]; monitor_demonitor_load(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line {ok,loaded} = erl_ddll:try_load(Path, echo_drv, []), ?line Port = open_port({spawn, echo_drv}, [eof]), @@ -756,7 +710,6 @@ monitor_demonitor_load(Config) when is_list(Config) -> ?line ok = receive {'DOWN',Ref4,driver,echo_drv,unloaded} -> ok after 300 -> error end, ?line ok = receive _ -> error after 300 -> ok end, ?line ok = unload_expect_fast(echo_drv,[]), - ?line test_server:timetrap_cancel(Dog), ok. new_interface(suite) -> @@ -764,7 +717,6 @@ new_interface(suite) -> new_interface(doc) -> ["Test the new load/unload/reload interface"]; new_interface(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), % Typical scenario ?line ok = erl_ddll:load(Path, echo_drv), @@ -819,14 +771,12 @@ new_interface(Config) when is_list(Config) -> ?line ok = receive X3 -> {error, X3} after 300 -> ok end, ?line ok = erl_ddll:unload(echo_drv), ?line ok = receive {'DOWN', Ref3, driver, echo_drv, unloaded} -> ok after 300 -> error end, - ?line test_server:timetrap_cancel(Dog), ok. ddll_test(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), %?line {error,{already_started,ErlDdllPid}} = erl_ddll:start(), @@ -856,14 +806,11 @@ ddll_test(Config) when is_list(Config) -> ok = unload_echo_driver(L1,L2), %% %?line {error, {already_started, _}} = erl_ddll:start(), - - ?line test_server:timetrap_cancel(Dog), ok. %% Tests errors having to do with bad drivers. errors(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line {ok, L1} = erl_ddll:loaded_drivers(), @@ -885,8 +832,6 @@ errors(Config) when is_list(Config) -> end, ?line {ok, L1} = erl_ddll:loaded_drivers(), - - ?line test_server:timetrap_cancel(Dog), ok. reference_count(doc) -> @@ -894,7 +839,6 @@ reference_count(doc) -> "reaches zero, and that they cannot be unloaded while ", "they are still referenced."]; reference_count(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), %% Spawn a process that loads the driver (and holds a reference @@ -910,8 +854,6 @@ reference_count(Config) when is_list(Config) -> % Verify that the driver was automaticly unloaded when the % process died. ?line {error, not_loaded}=erl_ddll:unload_driver(echo_drv), - - ?line test_server:timetrap_cancel(Dog), ok. % Loads the echo driver, send msg to started, sits and waits to @@ -939,7 +881,6 @@ kill_port(doc) -> ["Test that a port that uses a driver is killed when the ", "process that loaded the driver dies."]; kill_port(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), %% Spawn a process that loads the driver (and holds a reference @@ -969,16 +910,12 @@ kill_port(Config) when is_list(Config) -> after 5000 -> ?line test_server:fail("Echo port did not terminate.") end, - - %% Cleanup and exit. - ?line test_server:timetrap_cancel(Dog), ok. dont_kill_port(doc) -> ["Test that a port that uses a driver is not killed when the ", "process that loaded the driver dies and it's nicely opened."]; dont_kill_port(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), %% Spawn a process that loads the driver (and holds a reference @@ -1012,15 +949,11 @@ dont_kill_port(Config) when is_list(Config) -> after 5000 -> ?line test_server:fail("Echo port did not terminate.") end, - - %% Cleanup and exit. - ?line test_server:timetrap_cancel(Dog), ok. properties(doc) -> ["Test that a process that loaded a driver ", "is the only process that can unload it."]; properties(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), % Let another process load the echo driver. @@ -1044,12 +977,10 @@ properties(Config) when is_list(Config) -> % Unload the driver and terminate dummy process. ?line Pid ! {self(), die}, ?line test_server:sleep(200), % Give time to unload. - ?line test_server:timetrap_cancel(Dog), ok. load_and_unload(doc) -> ["Load two drivers and unload them in load order."]; load_and_unload(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(60)), ?line Path = ?config(data_dir, Config), ?line {ok, Loaded_drivers1} = erl_ddll:loaded_drivers(), ?line ok = erl_ddll:load_driver(Path, echo_drv), @@ -1061,8 +992,6 @@ load_and_unload(Config) when is_list(Config) -> ?line Set2 = ordsets:from_list(Loaded_drivers2), ?line io:format("~p == ~p\n", [Loaded_drivers1, Loaded_drivers2]), ?line [] = ordsets:to_list(ordsets:subtract(Set2, Set1)), - - ?line test_server:timetrap_cancel(Dog), ok. lock_driver(suite) -> @@ -1070,7 +999,6 @@ lock_driver(suite) -> lock_driver(doc) -> ["Check multiple calls to driver_lock_driver"]; lock_driver(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line {ok, _} = erl_ddll:try_load(Path, lock_drv, []), ?line Port1 = open_port({spawn, lock_drv}, [eof]), @@ -1078,7 +1006,6 @@ lock_driver(Config) when is_list(Config) -> ?line true = erl_ddll:info(lock_drv,permanent), ?line erlang:port_close(Port1), ?line erlang:port_close(Port2), - ?line test_server:timetrap_cancel(Dog), ok. diff --git a/erts/emulator/test/decode_packet_SUITE.erl b/erts/emulator/test/decode_packet_SUITE.erl index 58a8d390f0..213234af52 100644 --- a/erts/emulator/test/decode_packet_SUITE.erl +++ b/erts/emulator/test/decode_packet_SUITE.erl @@ -24,13 +24,14 @@ -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,groups/0, init_per_testcase/2,end_per_testcase/2, basic/1, packet_size/1, neg/1, http/1, line/1, ssl/1, otp_8536/1, otp_9389/1, otp_9389_line/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [basic, packet_size, neg, http, line, ssl, otp_8536, @@ -39,28 +40,13 @@ all() -> groups() -> []. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> rand:seed(exsplus), io:format("*** SEED: ~p ***\n", [rand:export_seed()]), - Dog=?t:timetrap(?t:minutes(1)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). +end_per_testcase(_Func, _Config) -> + ok. basic(doc) -> []; basic(suite) -> []; diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl index d562f79bb7..6165cf70bc 100644 --- a/erts/emulator/test/distribution_SUITE.erl +++ b/erts/emulator/test/distribution_SUITE.erl @@ -35,8 +35,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, groups/0, ping/1, bulk_send_small/1, bulk_send_big/1, bulk_send_bigbig/1, local_send_small/1, local_send_big/1, @@ -58,8 +57,6 @@ bad_dist_ext_control/1, bad_dist_ext_connection_id/1]). --export([init_per_testcase/2, end_per_testcase/2]). - %% Internal exports. -export([sender/3, receiver2/2, dummy_waiter/0, dead_process/0, roundtrip/1, bounce/1, do_dist_auto_connect/1, inet_rpc_server/1, @@ -67,7 +64,9 @@ dist_evil_parallel_receiver/0, sendersender/4, sendersender2/4]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> [ping, {group, bulk_send}, {group, local_send}, @@ -90,28 +89,6 @@ groups() -> [bad_dist_ext_receive, bad_dist_ext_process_info, bad_dist_ext_control, bad_dist_ext_connection_id]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - --define(DEFAULT_TIMETRAP, 4*60*1000). - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?DEFAULT_TIMETRAP), - [{watchdog, Dog},{testcase, Func}|Config]. - -end_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - ping(doc) -> ["Tests pinging a node in different ways."]; ping(Config) when is_list(Config) -> @@ -151,7 +128,7 @@ bulk_send_bigbig(Config) when is_list(Config) -> ?line bulk_sendsend(32*5, 4). bulk_send(Terms, BinSize) -> - ?line Dog = test_server:timetrap(test_server:seconds(30)), + ct:timetrap({seconds, 30}), ?line io:format("Sending ~w binaries, each of size ~w K", [Terms, BinSize]), @@ -162,8 +139,6 @@ bulk_send(Terms, BinSize) -> ?line {Elapsed, {Terms, Size}} = test_server:timecall(?MODULE, sender, [Recv, Bin, Terms]), ?line stop_node(Node), - - ?line test_server:timetrap_cancel(Dog), {comment, integer_to_list(trunc(Size/1024/max(1,Elapsed)+0.5)) ++ " K/s"}. bulk_sendsend(Terms, BinSize) -> @@ -188,7 +163,7 @@ bulk_sendsend(Terms, BinSize) -> end. bulk_sendsend2(Terms, BinSize, BusyBufSize) -> - ?line Dog = test_server:timetrap(test_server:seconds(30)), + ct:timetrap({seconds, 30}), ?line io:format("Sending ~w binaries, each of size ~w K", [Terms, BinSize]), @@ -214,8 +189,6 @@ bulk_sendsend2(Terms, BinSize, BusyBufSize) -> end, ?line stop_node(NodeRecv), ?line stop_node(NodeSend), - - ?line test_server:timetrap_cancel(Dog), {trunc(SizeN/1024/Elapsed+0.5), MonitorCount}. sender(To, _Bin, 0) -> @@ -335,7 +308,7 @@ receiver2(Num, TotSize) -> link_to_busy(doc) -> "Test that link/1 to a busy distribution port works."; link_to_busy(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({seconds, 60}), ?line {ok, Node} = start_node(link_to_busy), ?line Recv = spawn(Node, erlang, apply, [fun sink/1, [link_to_busy_sink]]), @@ -364,7 +337,6 @@ link_to_busy(Config) when is_list(Config) -> %% Done. ?line stop_node(Node), ?line stop_busy_dist_port_tracer(Tracer), - ?line test_server:timetrap_cancel(Dog), ok. linker(Pid) -> @@ -382,7 +354,7 @@ tail_applied_linker(Pid) -> exit_to_busy(doc) -> "Test that exit/2 to a busy distribution port works."; exit_to_busy(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({seconds, 60}), ?line {ok, Node} = start_node(exit_to_busy), Tracer = case os:getenv("TRACE_BUSY_DIST_PORT") of @@ -435,7 +407,6 @@ exit_to_busy(Config) when is_list(Config) -> %% Done. ?line stop_node(Node), ?line stop_busy_dist_port_tracer(Tracer), - ?line test_server:timetrap_cancel(Dog), ok. make_busy_data() -> @@ -1002,8 +973,7 @@ dist_parallel_send(Config) when is_list(Config) -> ?line {ok, SNode} = start_node(dist_parallel_sender), ?line WatchDog = spawn_link( fun () -> - TRef = erlang:start_timer((?DEFAULT_TIMETRAP - div 2), + TRef = erlang:start_timer((2*60*1000), self(), oops), receive @@ -1419,10 +1389,7 @@ bad_dist_structure(doc) -> ["Test dist messages with valid structure (binary to term ok) but malformed" "control content"]; bad_dist_structure(Config) when is_list(Config) -> - %process_flag(trap_exit,true), - ODog = ?config(watchdog, Config), - ?t:timetrap_cancel(ODog), - Dog = ?t:timetrap(?t:seconds(15)), + ct:timetrap({seconds, 15}), ?line {ok, Offender} = start_node(bad_dist_structure_offender), ?line {ok, Victim} = start_node(bad_dist_structure_victim), @@ -1535,7 +1502,6 @@ bad_dist_structure(Config) when is_list(Config) -> ?line P ! done, ?line stop_node(Offender), ?line stop_node(Victim), - ?t:timetrap_cancel(Dog), ok. diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl index 8eb555a5b7..23c5114d40 100644 --- a/erts/emulator/test/driver_SUITE.erl +++ b/erts/emulator/test/driver_SUITE.erl @@ -119,22 +119,22 @@ -define(heap_binary_size, 64). init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(2)), case catch erts_debug:get_internal_state(available_internal_state) of true -> ok; _ -> erts_debug:set_internal_state(available_internal_state, true) end, erlang:display({init_per_testcase, Case}), ?line 0 = element(1, erts_debug:get_internal_state(check_io_debug)), - [{watchdog, Dog},{testcase, Case}|Config]. + [{testcase, Case}|Config]. end_per_testcase(Case, Config) -> - Dog = ?config(watchdog, Config), erlang:display({end_per_testcase, Case}), ?line 0 = element(1, erts_debug:get_internal_state(check_io_debug)), - ?t:timetrap_cancel(Dog). + ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> %% Keep a_test first and z_test last... [a_test, outputv_errors, outputv_echo, queue_echo, {group, timer}, @@ -264,7 +264,7 @@ build_iolist(N0, Base) -> outputv_echo(doc) -> ["Test echoing data with a driver that supports outputv."]; outputv_echo(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(10)), + ct:timetrap({minutes, 10}), Name = 'outputv_drv', P = start_driver(Config, Name, true), @@ -304,7 +304,6 @@ outputv_echo(Config) when is_list(Config) -> ?line ov_test(P, [int,{bin,17},int,{bin,?heap_binary_size+1}|{bin,3}]), stop_driver(P, Name), - ?line test_server:timetrap_cancel(Dog), ok. ov_test(Port, Template) -> @@ -379,14 +378,12 @@ compare(Got, Expected) -> timer_measure(doc) -> ["Check that timers time out in good time."]; timer_measure(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(1)), Name = 'timer_drv', ?line Port = start_driver(Config, Name, false), ?line try_timeouts(Port, 8997), ?line stop_driver(Port, Name), - ?line test_server:timetrap_cancel(Dog), ok. try_timeouts(_, 0) -> ok; @@ -411,14 +408,12 @@ try_timeouts(Port, Timeout) -> timer_cancel(doc) -> ["Try cancelling timers set in a driver."]; timer_cancel(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(1)), Name = 'timer_drv', ?line Port = start_driver(Config, Name, false), ?line try_cancel(Port, 10000), ?line stop_driver(Port, Name), - ?line test_server:timetrap_cancel(Dog), ok. try_cancel(Port, Timeout) -> @@ -452,7 +447,6 @@ try_cancel(Port, Timeout) -> %% before setting a timer. timer_delay(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(1)), Name = 'timer_drv', ?line Port = start_driver(Config, Name, false), @@ -480,21 +474,18 @@ timer_delay(Config) when is_list(Config) -> end, ?line stop_driver(Port, Name), - ?line test_server:timetrap_cancel(Dog), ok. %% Test that driver_set_timer with new timout really changes %% the timer (ticket OTP-5942), it didn't work before timer_change(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(1)), Name = 'timer_drv', ?line Port = start_driver(Config, Name, false), ?line try_change_timer(Port, 10000), ?line stop_driver(Port, Name), - ?line test_server:timetrap_cancel(Dog), ok. try_change_timer(_Port, 0) -> ok; @@ -534,7 +525,7 @@ queue_echo(Config) when is_list(Config) -> end. queue_echo_1(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(10)), + ct:timetrap({minutes, 10}), Name = 'queue_drv', ?line P = start_driver(Config, Name, true), @@ -566,7 +557,6 @@ queue_echo_1(Config) -> {?PUSHQV, [{bin,0},{list,1},{bin,1},{bin,319}]}]), ?line stop_driver(P, Name), - ?line test_server:timetrap_cancel(Dog), ok. q_echo(Port, SpecList) -> diff --git a/erts/emulator/test/erl_drv_thread_SUITE.erl b/erts/emulator/test/erl_drv_thread_SUITE.erl index 26d00db7c0..a56741adc6 100644 --- a/erts/emulator/test/erl_drv_thread_SUITE.erl +++ b/erts/emulator/test/erl_drv_thread_SUITE.erl @@ -20,8 +20,7 @@ -module(erl_drv_thread_SUITE). -author('[email protected]'). --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([basic/1, rwlock/1, tsd/1]). @@ -34,21 +33,6 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [basic, rwlock, tsd]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% @@ -97,7 +81,7 @@ drv_case(Config, CaseName, Command, TimeTrap) when is_list(Config), end. run_drv_case(Config, CaseName, Command, TimeTrap) -> - ?line Dog = test_server:timetrap(test_server:seconds(TimeTrap)), + ct:timetrap({seconds, TimeTrap}), ?line DataDir = ?config(data_dir,Config), case erl_ddll:load_driver(DataDir, CaseName) of ok -> ok; @@ -115,7 +99,6 @@ run_drv_case(Config, CaseName, Command, TimeTrap) -> ok end, ?line ok = erl_ddll:unload_driver(CaseName), - ?line test_server:timetrap_cancel(Dog), ?line Result. receive_drv_result(Port, CaseName) -> diff --git a/erts/emulator/test/erl_link_SUITE.erl b/erts/emulator/test/erl_link_SUITE.erl index 56b2c9c6ee..a3f44e7313 100644 --- a/erts/emulator/test/erl_link_SUITE.erl +++ b/erts/emulator/test/erl_link_SUITE.erl @@ -31,8 +31,7 @@ %-define(line_trace, 1). -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, init_per_suite/1, end_per_suite/1]). % Test cases -export([links/1, @@ -78,8 +77,9 @@ }). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [links, dist_links, monitor_nodes, process_monitors, @@ -87,8 +87,15 @@ all() -> busy_dist_port_link, otp_5772_link, otp_5772_dist_link, otp_5772_monitor, otp_5772_dist_monitor, otp_7946]. -groups() -> - []. +init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> + case catch erts_debug:get_internal_state(available_internal_state) of + true -> ok; + _ -> erts_debug:set_internal_state(available_internal_state, true) + end, + Config. + +end_per_testcase(_Func, _Config) -> + ok. init_per_suite(Config) -> Config. @@ -96,12 +103,6 @@ init_per_suite(Config) -> end_per_suite(_Config) -> catch erts_debug:set_internal_state(available_internal_state, false). -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - links(doc) -> ["Tests node local links"]; links(suite) -> []; @@ -690,18 +691,6 @@ forever(Fun) -> Fun(), forever(Fun). -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - ?line Dog = ?t:timetrap(?t:minutes(1)), - case catch erts_debug:get_internal_state(available_internal_state) of - true -> ok; - _ -> erts_debug:set_internal_state(available_internal_state, true) - end, - ?line [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - ?line Dog = ?config(watchdog, Config), - ?line ?t:timetrap_cancel(Dog). - tp_call(Tp, Fun) -> ?line R = make_ref(), ?line Tp ! {call, self(), R, Fun}, diff --git a/erts/emulator/test/erts_debug_SUITE.erl b/erts/emulator/test/erts_debug_SUITE.erl index 440a7950a6..d4814bd8f4 100644 --- a/erts/emulator/test/erts_debug_SUITE.erl +++ b/erts/emulator/test/erts_debug_SUITE.erl @@ -21,41 +21,17 @@ -module(erts_debug_SUITE). -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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, test_size/1,flat_size_big/1,df/1,term_type/1, instructions/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> [test_size, flat_size_big, df, instructions, term_type]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(2)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - test_size(Config) when is_list(Config) -> ConsCell1 = id([a|b]), ConsCell2 = id(ConsCell1), diff --git a/erts/emulator/test/estone_SUITE.erl b/erts/emulator/test/estone_SUITE.erl index 7710424894..2d53cb1cd1 100644 --- a/erts/emulator/test/estone_SUITE.erl +++ b/erts/emulator/test/estone_SUITE.erl @@ -19,9 +19,8 @@ -module(estone_SUITE). %% Test functions --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,estone/1,estone_bench/1]). --export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0, groups/0, + estone/1, estone_bench/1]). %% Internal exports for EStone tests -export([lists/1, @@ -49,9 +48,6 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -%% Test suite defines --define(default_timeout, ?t:minutes(10)). - %% EStone defines -define(TOTAL, (3000 * 1000 * 100)). %% 300 secs -define(BIGPROCS, 2). @@ -66,17 +62,9 @@ str}). %% Header string - - -init_per_testcase(_Case, Config) -> - ?line Dog=test_server: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, 4}}]. all() -> [estone]. @@ -84,18 +72,6 @@ all() -> groups() -> [{estone_bench, [{repeat,50}],[estone_bench]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - estone(suite) -> []; diff --git a/erts/emulator/test/evil_SUITE.erl b/erts/emulator/test/evil_SUITE.erl index 77ee2128b6..95a5ff3f52 100644 --- a/erts/emulator/test/evil_SUITE.erl +++ b/erts/emulator/test/evil_SUITE.erl @@ -19,9 +19,7 @@ -module(evil_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, heap_frag/1, encode_decode_ext/1, decode_integer_ext/1, @@ -35,7 +33,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> [heap_frag, encode_decode_ext, decode_integer_ext, @@ -43,31 +43,6 @@ all() -> decode_small_big_ext_neg, decode_large_big_ext_neg, decode_too_small, decode_pos_neg_zero]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(?t:minutes(0.5)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - heap_frag(Config) when is_list(Config) -> N = 512, Self = self(), @@ -109,7 +84,6 @@ encode_decode_ext(Config) when is_list(Config) -> ?line enc_dec(11, 16#7fffffffffffffff), % largest i64 ?line enc_dec(11,-16#8000000000000000), % smallest i64 ?line enc_dec(11, 16#ffffffffffffffff), % largest u64 - ok. @@ -388,4 +362,3 @@ rnd_term() -> U0 = rand:uniform(), B = <<U0/float>>, {U0,U0 * 2.5 + 3.14,[U0*2.3,B]}. - diff --git a/erts/emulator/test/exception_SUITE.erl b/erts/emulator/test/exception_SUITE.erl index 57ce8fb879..c2b2c50cd5 100644 --- a/erts/emulator/test/exception_SUITE.erl +++ b/erts/emulator/test/exception_SUITE.erl @@ -20,8 +20,7 @@ -module(exception_SUITE). --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, badmatch/1, pending_errors/1, nil_arith/1, stacktrace/1, nested_stacktrace/1, raise/1, gunilla/1, per/1, exception_with_heap_frag/1, line_numbers/1]). @@ -32,29 +31,15 @@ -include_lib("common_test/include/ct.hrl"). -import(lists, [foreach/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [badmatch, pending_errors, nil_arith, stacktrace, nested_stacktrace, raise, gunilla, per, exception_with_heap_frag, line_numbers]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -define(try_match(E), catch ?MODULE:bar(), {'EXIT', {{badmatch, nomatch}, _}} = (catch E = id(nomatch))). diff --git a/erts/emulator/test/float_SUITE.erl b/erts/emulator/test/float_SUITE.erl index bf557f2bca..de889baeab 100644 --- a/erts/emulator/test/float_SUITE.erl +++ b/erts/emulator/test/float_SUITE.erl @@ -22,9 +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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, groups/0, fpe/1,fp_drv/1,fp_drv_thread/1,denormalized/1,match/1, t_mul_add_ops/1, bad_float_unpack/1, write/1, cmp_zero/1, cmp_integer/1, cmp_bignum/1]). @@ -32,16 +30,9 @@ -export([hidden_inf/1]). -export([arith/1]). - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), - [{watchdog, Dog},{testcase,Func}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [fpe, fp_drv, fp_drv_thread, otp_7178, denormalized, @@ -53,19 +44,6 @@ all() -> groups() -> [{comparison, [parallel], [cmp_zero, cmp_integer, cmp_bignum]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - %% %% OTP-7178, list_to_float on very small numbers should give 0.0 %% instead of exception, i.e. ignore underflow. diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl index 6697a86fc5..103244d6ca 100644 --- a/erts/emulator/test/fun_SUITE.erl +++ b/erts/emulator/test/fun_SUITE.erl @@ -21,11 +21,7 @@ -module(fun_SUITE). -compile({nowarn_deprecated_function, {erlang,hash,2}}). --define(default_timeout, ?t:minutes(1)). - --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, bad_apply/1,bad_fun_call/1,badarity/1,ext_badarity/1, equality/1,ordering/1, fun_to_port/1,t_hash/1,t_phash/1,t_phash2/1,md5/1, @@ -37,7 +33,10 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. + all() -> [bad_apply, bad_fun_call, badarity, ext_badarity, @@ -46,31 +45,6 @@ all() -> const_propagation, t_arity, t_is_function2, t_fun_info, t_fun_info_mfa]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - bad_apply(doc) -> "Test that the correct EXIT code is returned for all types of bad funs."; bad_apply(suite) -> []; diff --git a/erts/emulator/test/fun_r13_SUITE.erl b/erts/emulator/test/fun_r13_SUITE.erl index 39e8b3c324..32d58355e0 100644 --- a/erts/emulator/test/fun_r13_SUITE.erl +++ b/erts/emulator/test/fun_r13_SUITE.erl @@ -21,43 +21,18 @@ -module(fun_r13_SUITE). -compile(r13). --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,dist_old_release/1]). +-export([all/0, suite/0, + dist_old_release/1]). --define(default_timeout, ?t:minutes(1)). -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [dist_old_release]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - dist_old_release(Config) when is_list(Config) -> case ?t:is_release_available("r12b") of true -> do_dist_old(Config); diff --git a/erts/emulator/test/gc_SUITE.erl b/erts/emulator/test/gc_SUITE.erl index cb000fd45f..cccd726b1c 100644 --- a/erts/emulator/test/gc_SUITE.erl +++ b/erts/emulator/test/gc_SUITE.erl @@ -23,44 +23,26 @@ -module(gc_SUITE). -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]). - --define(default_timeout, ?t:minutes(10)). +-export([all/0, suite/0]). -export([grow_heap/1, grow_stack/1, grow_stack_heap/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [grow_heap, grow_stack, grow_stack_heap]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - grow_heap(doc) -> ["Produce a growing list of elements, ", "for X calls, then drop one item per call", "until the list is empty."]; grow_heap(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:minutes(40)), + ct:timetrap({minutes, 40}), ok = grow_heap1(256), ok = grow_heap1(512), ok = grow_heap1(1024), ok = grow_heap1(2048), - test_server:timetrap_cancel(Dog), ok. grow_heap1(Len) -> @@ -89,11 +71,10 @@ grow_heap1([_|List], MaxLen, CurLen, down) -> grow_stack(doc) -> ["Increase and decrease stack size, and ", "drop off some garbage from time to time."]; grow_stack(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:minutes(80)), + ct:timetrap({minutes, 80}), show_heap("before:"), grow_stack1(200, 0), show_heap("after:"), - test_server:timetrap_cancel(Dog), ok. grow_stack1(0, _) -> @@ -114,10 +95,9 @@ grow_stack_heap(doc) -> ["While growing the heap, bounces the size ", "of the stack, and while reducing the heap", "bounces the stack usage."]; grow_stack_heap(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:minutes(40)), + ct:timetrap({minutes, 40}), grow_stack_heap1(16), grow_stack_heap1(32), - test_server:timetrap_cancel(Dog), ok. grow_stack_heap1(MaxLen) -> diff --git a/erts/emulator/test/guard_SUITE.erl b/erts/emulator/test/guard_SUITE.erl index 2e03983c4f..78c65c5157 100644 --- a/erts/emulator/test/guard_SUITE.erl +++ b/erts/emulator/test/guard_SUITE.erl @@ -20,8 +20,8 @@ -module(guard_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, bad_arith/1, bad_tuple/1, +-export([all/0, suite/0, + bad_arith/1, bad_tuple/1, test_heap_guards/1, guard_bifs/1, type_tests/1,guard_bif_binary_part/1]). @@ -36,21 +36,6 @@ all() -> [bad_arith, bad_tuple, test_heap_guards, guard_bifs, type_tests, guard_bif_binary_part]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - bad_arith(doc) -> "Test that a bad arithmetic operation in a guard works correctly."; bad_arith(Config) when is_list(Config) -> @@ -81,7 +66,7 @@ bad_tuple1(_) -> test_heap_guards(doc) -> ""; test_heap_guards(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(2)), + ct:timetrap({minutes, 2}), ?line process_flag(trap_exit, true), ?line Tuple = {a, tuple, is, built, here, xxx}, @@ -98,7 +83,7 @@ test_heap_guards(Config) when is_list(Config) -> ?line 'try'(fun receive_test/1, [Tuple], [Tuple]), ?line 'try'(fun receive_test/1, [List], [List, List]), ?line 'try'(fun receive_test/1, [a], [a]), - ?line test_server:timetrap_cancel(Dog). + ok. a_case(V) -> case V of diff --git a/erts/emulator/test/hash_SUITE.erl b/erts/emulator/test/hash_SUITE.erl index 31b10158fb..4c50131108 100644 --- a/erts/emulator/test/hash_SUITE.erl +++ b/erts/emulator/test/hash_SUITE.erl @@ -70,43 +70,19 @@ config(priv_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, +-export([all/0, suite/0, test_basic/1,test_cmp/1,test_range/1,test_spread/1, test_phash2/1,otp_5292/1,bit_level_binaries/1,otp_7127/1, - test_hash_zero/1, - end_per_testcase/2,init_per_testcase/2]). -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(test_server:minutes(10)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. + test_hash_zero/1]). + +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 10}}]. all() -> [test_basic, test_cmp, test_range, test_spread, test_phash2, otp_5292, bit_level_binaries, otp_7127, - test_hash_zero - ]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - + test_hash_zero]. test_basic(suite) -> []; diff --git a/erts/emulator/test/hibernate_SUITE.erl b/erts/emulator/test/hibernate_SUITE.erl index 5138a6ee05..ea4cc79701 100644 --- a/erts/emulator/test/hibernate_SUITE.erl +++ b/erts/emulator/test/hibernate_SUITE.erl @@ -22,45 +22,23 @@ -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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, basic/1,dynamic_call/1,min_heap_size/1,bad_args/1, - messages_in_queue/1,undefined_mfa/1,no_heap/1,wake_up_and_bif_trap/1]). + messages_in_queue/1,undefined_mfa/1,no_heap/1, + wake_up_and_bif_trap/1]). %% Used by test cases. --export([basic_hibernator/1,dynamic_call_hibernator/2,messages_in_queue_restart/2, no_heap_loop/0,characters_to_list_trap/1]). +-export([basic_hibernator/1,dynamic_call_hibernator/2,messages_in_queue_restart/2, + no_heap_loop/0,characters_to_list_trap/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [basic, dynamic_call, min_heap_size, bad_args, messages_in_queue, undefined_mfa, no_heap, wake_up_and_bif_trap]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), - [{watchdog,Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - %%% %%% Testing the basic functionality of erlang:hibernate/3. %%% diff --git a/erts/emulator/test/list_bif_SUITE.erl b/erts/emulator/test/list_bif_SUITE.erl index 544f9c9c1f..c6221b8c66 100644 --- a/erts/emulator/test/list_bif_SUITE.erl +++ b/erts/emulator/test/list_bif_SUITE.erl @@ -21,44 +21,20 @@ -module(list_bif_SUITE). -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, - init_per_testcase/2,end_per_testcase/2]). +-export([all/0, suite/0]). -export([hd_test/1,tl_test/1,t_length/1,t_list_to_pid/1, t_list_to_float/1,t_list_to_integer/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. + all() -> [hd_test, tl_test, t_length, t_list_to_pid, t_list_to_float, t_list_to_integer]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(60)), - [{watchdog,Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - t_list_to_integer(suite) -> []; t_list_to_integer(doc) -> diff --git a/erts/emulator/test/match_spec_SUITE.erl b/erts/emulator/test/match_spec_SUITE.erl index 9e724bdd8c..22425bd66d 100644 --- a/erts/emulator/test/match_spec_SUITE.erl +++ b/erts/emulator/test/match_spec_SUITE.erl @@ -20,8 +20,7 @@ -module(match_spec_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, not_run/1]). +-export([all/0, suite/0, not_run/1]). -export([test_1/1, test_2/1, test_3/1, bad_match_spec_bin/1, trace_control_word/1, silent/1, silent_no_ms/1, silent_test/1, ms_trace2/1, ms_trace3/1, boxed_and_small/1, @@ -41,18 +40,9 @@ -include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, end_per_testcase/2]). - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:seconds(30)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> case test_server:is_native(match_spec_SUITE) of @@ -69,22 +59,6 @@ all() -> true -> [not_run] 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"}. diff --git a/erts/emulator/test/message_queue_data_SUITE.erl b/erts/emulator/test/message_queue_data_SUITE.erl index 96c41a57b5..36a8311cd2 100644 --- a/erts/emulator/test/message_queue_data_SUITE.erl +++ b/erts/emulator/test/message_queue_data_SUITE.erl @@ -20,46 +20,20 @@ -module(message_queue_data_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([basic/1, process_info_messages/1]). -export([basic_test/1]). -include_lib("common_test/include/ct.hrl"). -init_per_testcase(Case, Config) -> - ?line Dog=test_server:timetrap(test_server:minutes(2)), - [{watchdog, Dog}, {testcase, Case}|Config]. - -end_per_testcase(_, 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, 2}}]. all() -> [basic, process_info_messages]. -groups() -> - []. - -init_per_suite(Config) -> -%% erts_debug:set_internal_state(available_internal_state, true), - Config. - -end_per_suite(_Config) -> -%% erts_debug:set_internal_state(available_internal_state, false), - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %% %% %% Test cases diff --git a/erts/emulator/test/module_info_SUITE.erl b/erts/emulator/test/module_info_SUITE.erl index c622a2d8d7..9f07ff9c0c 100644 --- a/erts/emulator/test/module_info_SUITE.erl +++ b/erts/emulator/test/module_info_SUITE.erl @@ -22,9 +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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, exports/1,functions/1,deleted/1,native/1,info/1]). %%-compile(native). @@ -32,37 +30,16 @@ %% Helper. -export([native_proj/1,native_filter/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> modules(). -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - modules() -> [exports, functions, deleted, native, info]. -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), - [{watchdog,Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - %% Should return all functions exported from this module. (local) all_exported() -> All = add_arity(modules()), diff --git a/erts/emulator/test/monitor_SUITE.erl b/erts/emulator/test/monitor_SUITE.erl index 8101908df1..ce4c40ee02 100644 --- a/erts/emulator/test/monitor_SUITE.erl +++ b/erts/emulator/test/monitor_SUITE.erl @@ -22,19 +22,18 @@ -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, groups/0, case_1/1, case_1a/1, case_2/1, case_2a/1, mon_e_1/1, demon_e_1/1, demon_1/1, demon_2/1, demon_3/1, demonitor_flush/1, local_remove_monitor/1, remote_remove_monitor/1, mon_1/1, mon_2/1, large_exit/1, list_cleanup/1, mixer/1, named_down/1, otp_5827/1, monitor_time_offset/1]). --export([init_per_testcase/2, end_per_testcase/2]). - -export([y2/1, g/1, g0/0, g1/0, large_exit_sub/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 15}}]. all() -> [case_1, case_1a, case_2, case_2a, mon_e_1, demon_e_1, @@ -47,27 +46,6 @@ groups() -> [{remove_monitor, [], [local_remove_monitor, remote_remove_monitor]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(15)), - [{watchdog, Dog},{testcase, Func}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - case_1(doc) -> "A monitors B, B kills A and then exits (yielded core dump)"; case_1(suite) -> []; diff --git a/erts/emulator/test/mtx_SUITE.erl b/erts/emulator/test/mtx_SUITE.erl index 87dace4721..c7c043d8e7 100644 --- a/erts/emulator/test/mtx_SUITE.erl +++ b/erts/emulator/test/mtx_SUITE.erl @@ -29,9 +29,8 @@ -include_lib("common_test/include/ct.hrl"). --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, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -export([long_rwlock/1, hammer_ets_rwlock/1, @@ -56,6 +55,28 @@ hammer_sched_freqread_tryrwlock/1, hammer_sched_freqread_tryrwlock_check/1]). +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 15}}]. + +all() -> + [long_rwlock, hammer_rwlock_check, hammer_rwlock, + hammer_tryrwlock_check, hammer_tryrwlock, + hammer_ets_rwlock, hammer_sched_long_rwlock_check, + hammer_sched_long_rwlock, + hammer_sched_long_freqread_rwlock_check, + hammer_sched_long_freqread_rwlock, + hammer_sched_long_tryrwlock_check, + hammer_sched_long_tryrwlock, + hammer_sched_long_freqread_tryrwlock_check, + hammer_sched_long_freqread_tryrwlock, + hammer_sched_rwlock_check, hammer_sched_rwlock, + hammer_sched_freqread_rwlock_check, + hammer_sched_freqread_rwlock, + hammer_sched_tryrwlock_check, hammer_sched_tryrwlock, + hammer_sched_freqread_tryrwlock_check, + hammer_sched_freqread_tryrwlock]. + init_per_suite(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), Lib = filename:join([DataDir, atom_to_list(?MODULE)]), @@ -71,15 +92,13 @@ end_per_suite(Config) when is_list(Config) -> Config. init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?t:minutes(15)), %% Wait for deallocations to complete since we measure %% runtime in test cases. wait_deallocations(), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). + ok. wait_deallocations() -> try @@ -90,36 +109,6 @@ wait_deallocations() -> wait_deallocations() end. -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [long_rwlock, hammer_rwlock_check, hammer_rwlock, - hammer_tryrwlock_check, hammer_tryrwlock, - hammer_ets_rwlock, hammer_sched_long_rwlock_check, - hammer_sched_long_rwlock, - hammer_sched_long_freqread_rwlock_check, - hammer_sched_long_freqread_rwlock, - hammer_sched_long_tryrwlock_check, - hammer_sched_long_tryrwlock, - hammer_sched_long_freqread_tryrwlock_check, - hammer_sched_long_freqread_tryrwlock, - hammer_sched_rwlock_check, hammer_sched_rwlock, - hammer_sched_freqread_rwlock_check, - hammer_sched_freqread_rwlock, - hammer_sched_tryrwlock_check, hammer_sched_tryrwlock, - hammer_sched_freqread_tryrwlock_check, - hammer_sched_freqread_tryrwlock]. - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - long_rwlock(Config) when is_list(Config) -> statistics(runtime), LLRes = long_rw_test(), diff --git a/erts/emulator/test/nested_SUITE.erl b/erts/emulator/test/nested_SUITE.erl index ee6bbf6a55..5b59a9f3d7 100644 --- a/erts/emulator/test/nested_SUITE.erl +++ b/erts/emulator/test/nested_SUITE.erl @@ -20,33 +20,19 @@ -module(nested_SUITE). --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, case_in_case/1, case_in_after/1, catch_in_catch/1, bif_in_bif/1]). -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [case_in_case, case_in_after, catch_in_catch, bif_in_bif]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - case_in_case(suite) -> []; case_in_case(Config) when is_list(Config) -> diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl index c6c617f97f..78922af956 100644 --- a/erts/emulator/test/nif_SUITE.erl +++ b/erts/emulator/test/nif_SUITE.erl @@ -26,10 +26,9 @@ -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, - init_per_testcase/2, - end_per_testcase/2, basic/1, reload/1, upgrade/1, heap_frag/1, +-export([all/0, suite/0, + init_per_testcase/2, end_per_testcase/2, + basic/1, reload/1, upgrade/1, heap_frag/1, types/1, many_args/1, binaries/1, get_string/1, get_atom/1, maps/1, api_macros/1, @@ -77,29 +76,10 @@ all() -> nif_monotonic_time, nif_time_offset, nif_convert_time_unit ]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - init_per_testcase(_Case, Config) -> -% ?line Dog = ?t:timetrap(?t:seconds(60*60*24)), Config. end_per_testcase(_Func, _Config) -> - %%Dog = ?config(watchdog, Config), - %%?t:timetrap_cancel(Dog), P1 = code:purge(nif_mod), Del = code:delete(nif_mod), P2 = code:purge(nif_mod), diff --git a/erts/emulator/test/node_container_SUITE.erl b/erts/emulator/test/node_container_SUITE.erl index dcd0428e65..30f75b4cbc 100644 --- a/erts/emulator/test/node_container_SUITE.erl +++ b/erts/emulator/test/node_container_SUITE.erl @@ -32,10 +32,8 @@ -include_lib("common_test/include/ct.hrl"). -%-compile(export_all). --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, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, node_container_refc_check/1]). -export([term_to_binary_to_term_eq/1, @@ -56,9 +54,10 @@ unique_pid/1, iter_max_procs/1]). --define(DEFAULT_TIMEOUT, ?t:minutes(10)). +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 10}}]. -suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [term_to_binary_to_term_eq, round_trip_eq, cmp, ref_eq, @@ -67,9 +66,6 @@ all() -> timer_refc, otp_4715, pid_wrap, port_wrap, bad_nc, unique_pid, iter_max_procs]. -groups() -> - []. - init_per_suite(Config) -> Config. @@ -78,13 +74,6 @@ end_per_suite(_Config) -> erts_debug:set_internal_state(node_tab_delayed_delete, -1), %% restore original value available_internal_state(false). -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - available_internal_state(Bool) when Bool == true; Bool == false -> case {Bool, (catch erts_debug:get_internal_state(available_internal_state))} of @@ -101,13 +90,10 @@ available_internal_state(Bool) when Bool == true; Bool == false -> end. init_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), available_internal_state(true), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), ok. %%% diff --git a/erts/emulator/test/nofrag_SUITE.erl b/erts/emulator/test/nofrag_SUITE.erl index caa2d30a6c..14851d376f 100644 --- a/erts/emulator/test/nofrag_SUITE.erl +++ b/erts/emulator/test/nofrag_SUITE.erl @@ -22,9 +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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, error_handler/1,error_handler_apply/1, error_handler_fixed_apply/1,error_handler_fun/1, debug_breakpoint/1]). @@ -32,37 +30,15 @@ %% Exported functions for an error_handler module. -export([undefined_function/3,undefined_lambda/3,breakpoint/3]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [error_handler, error_handler_apply, error_handler_fixed_apply, error_handler_fun, debug_breakpoint]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), - [{watchdog,Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - error_handler(Config) when is_list(Config) -> ?line process_flag(error_handler, ?MODULE), %% The term_to_binary/1 - binary_to_term/1 roundtrip is a good way diff --git a/erts/emulator/test/old_scheduler_SUITE.erl b/erts/emulator/test/old_scheduler_SUITE.erl index 272131cb46..d62928c31d 100644 --- a/erts/emulator/test/old_scheduler_SUITE.erl +++ b/erts/emulator/test/old_scheduler_SUITE.erl @@ -22,14 +22,13 @@ -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, init_per_testcase/2, end_per_testcase/2]). -export([equal/1, many_low/1, few_low/1, max/1, high/1]). --define(default_timeout, ?t:minutes(11)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 11}}]. all() -> case catch erlang:system_info(modified_timing_level) of @@ -42,21 +41,6 @@ all() -> _ -> [equal, many_low, few_low, max, high] end. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %%----------------------------------------------------------------------------------- %% TEST SUITE DESCRIPTION @@ -78,18 +62,15 @@ end_per_group(_GroupName, Config) -> %%----------------------------------------------------------------------------------- init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(?default_timeout), %% main test process needs max prio ?line Prio = process_flag(priority, max), ?line MS = erlang:system_flag(multi_scheduling, block), - [{prio,Prio},{watchdog,Dog},{multi_scheduling, MS}|Config]. + [{prio,Prio},{multi_scheduling, MS}|Config]. end_per_testcase(_Case, Config) -> erlang:system_flag(multi_scheduling, unblock), - Dog=?config(watchdog, Config), Prio=?config(prio, Config), process_flag(priority, Prio), - test_server:timetrap_cancel(Dog), ok. ok(Config) when is_list(Config) -> diff --git a/erts/emulator/test/op_SUITE.erl b/erts/emulator/test/op_SUITE.erl index 4e15b27231..9948c13ce2 100644 --- a/erts/emulator/test/op_SUITE.erl +++ b/erts/emulator/test/op_SUITE.erl @@ -22,44 +22,20 @@ -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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, bsl_bsr/1,logical/1,t_not/1,relop_simple/1,relop/1,complex_relop/1]). -export([]). -import(lists, [foldl/3,flatmap/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [bsl_bsr, logical, t_not, relop_simple, relop, complex_relop]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - %% Test the bsl and bsr operators. bsl_bsr(Config) when is_list(Config) -> Vs = [unvalue(V) || V <- [-16#8000009-2,-1,0,1,2,73,16#8000000,bad,[]]], diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl index 5274da301a..365c63b468 100644 --- a/erts/emulator/test/port_SUITE.erl +++ b/erts/emulator/test/port_SUITE.erl @@ -105,7 +105,9 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. all() -> [otp_6224, {group, stream}, basic_ping, slow_writes, @@ -133,9 +135,6 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. - --define(DEFAULT_TIMEOUT, ?t:minutes(5)). - init_per_testcase(Case, Config) -> [{testcase, Case} |Config]. @@ -162,7 +161,7 @@ win_massive(Config) when is_list(Config) -> end. do_win_massive() -> - Dog = test_server:timetrap(test_server:seconds(360)), + ct:timetrap({minutes, 6}), SuiteDir = filename:dirname(code:which(?MODULE)), Ports = " +Q 8192", {ok, Node} = @@ -171,7 +170,6 @@ do_win_massive() -> [{args, " -pa " ++ SuiteDir ++ Ports}]), ok = rpc:call(Node,?MODULE,win_massive_client,[3000]), test_server:stop_node(Node), - test_server:timetrap_cancel(Dog), ok. win_massive_client(N) -> @@ -205,19 +203,14 @@ win_massive_loop(P,N) -> [] end. - - - %% Test that we can send a stream of bytes and get it back. %% We will send only a small amount of data, to avoid deadlock. stream_small(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), stream_ping(Config, 512, "", []), stream_ping(Config, 1777, "", []), stream_ping(Config, 1777, "-s512", []), - test_server:timetrap_cancel(Dog), ok. %% Send big amounts of data (much bigger than the buffer size in port test). @@ -225,22 +218,20 @@ stream_small(Config) when is_list(Config) -> %% non-blocking reads and writes. stream_big(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(180)), + ct:timetrap({seconds, 180}), stream_ping(Config, 43755, "", []), stream_ping(Config, 100000, "", []), stream_ping(Config, 77777, " -s40000", []), - test_server:timetrap_cancel(Dog), ok. %% Sends packet with header size of 1, 2, and 4, with packets of various %% sizes. basic_ping(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(120)), + ct:timetrap({minutes, 2}), ping(Config, sizes(1), 1, "", []), ping(Config, sizes(2), 2, "", []), ping(Config, sizes(4), 4, "", []), - test_server:timetrap_cancel(Dog), ok. %% Let the port program insert delays between characters sent back to @@ -248,17 +239,14 @@ basic_ping(Config) when is_list(Config) -> %% small chunks rather than all at once. slow_writes(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(20)), ping(Config, [8], 4, "-s1", []), ping(Config, [10], 2, "-s2", []), - test_server:timetrap_cancel(Dog), ok. bad_packet(doc) -> ["Test that we get {'EXIT', Port, einval} if we try to send a bigger " "packet than the packet header allows."]; bad_packet(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), PortTest = port_test(Config), process_flag(trap_exit, true), @@ -266,8 +254,6 @@ bad_packet(Config) when is_list(Config) -> bad_packet(PortTest, 1, 257), bad_packet(PortTest, 2, 65536), bad_packet(PortTest, 2, 65537), - - test_server:timetrap_cancel(Dog), ok. bad_packet(PortTest, HeaderSize, PacketSize) -> @@ -288,7 +274,6 @@ make_zero_packet(N) -> %% Test sending bad messages to a port. bad_port_messages(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), PortTest = port_test(Config), process_flag(trap_exit, true), @@ -296,8 +281,6 @@ bad_port_messages(Config) when is_list(Config) -> bad_message(PortTest, {a}), bad_message(PortTest, {self(),{command,bad_command}}), bad_message(PortTest, {self(),{connect,no_pid}}), - - test_server:timetrap_cancel(Dog), ok. bad_message(PortTest, Message) -> @@ -315,7 +298,7 @@ bad_message(PortTest, Message) -> %% Tests the 'binary' option for a port. t_binary(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(300)), + ct:timetrap({seconds, 300}), %% Packet mode. ping(Config, sizes(1), 1, "", [binary]), @@ -326,12 +309,10 @@ t_binary(Config) when is_list(Config) -> stream_ping(Config, 435, "", [binary]), stream_ping(Config, 43755, "", [binary]), stream_ping(Config, 100000, "", [binary]), - - test_server:timetrap_cancel(Dog), ok. name1(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({seconds, 100}), PortTest = port_test(Config), Command = lists:concat([PortTest, " "]), P = open_port({spawn, Command}, []), @@ -348,13 +329,12 @@ name1(Config) when is_list(Config) -> {P, closed} -> ok end, undefined = whereis(myport), - test_server:timetrap_cancel(Dog), ok. %% Test that the 'eof' option works. eof(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({seconds, 100}), PortTest = port_test(Config), Command = lists:concat([PortTest, " -h0 -q"]), P = open_port({spawn, Command}, [eof]), @@ -366,25 +346,23 @@ eof(Config) when is_list(Config) -> receive {P, closed} -> ok end, - test_server:timetrap_cancel(Dog), ok. %% Tests that the 'in' option for a port works. input_only(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(300)), + ct:timetrap({seconds, 300}), expect_input(Config, [0, 1, 10, 13, 127, 128, 255], 1, "", [in]), expect_input(Config, [0, 1, 255, 2048], 2, "", [in]), expect_input(Config, [0, 1, 255, 2048], 4, "", [in]), expect_input(Config, [0, 1, 10, 13, 127, 128, 255], 1, "", [in, binary]), - test_server:timetrap_cancel(Dog), ok. %% Tests that the 'out' option for a port works. output_only(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({seconds, 100}), Dir = ?config(priv_dir, Config), %% First we test that the port program gets the data @@ -399,8 +377,6 @@ output_only(Config) when is_list(Config) -> %% Then we test that any writes to stdout from %% the port program is not sent to erlang output_and_verify(Config, ["-h0"], Data), - - test_server:timetrap_cancel(Dog), ok. output_and_verify(Config, Options, Data) -> @@ -421,11 +397,10 @@ output_and_verify(Config, Options, Data) -> %% Basic test of receiving multiple packages, written in %% one operation by the other end. mul_basic(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(600)), + ct:timetrap({minutes, 10}), expect_input(Config, [0, 1, 255, 10, 13], 1, "", []), expect_input(Config, [0, 10, 13, 1600, 32767, 65535], 2, "", []), expect_input(Config, [10, 70000], 4, "", []), - test_server:timetrap_cancel(Dog), ok. %% Test reading a buffer consisting of several packets, some @@ -434,9 +409,8 @@ mul_basic(Config) when is_list(Config) -> %% delays in between.) mul_slow_writes(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(250)), + ct:timetrap({minutes, 4}), expect_input(Config, [0, 20, 255, 10, 1], 1, "-s64", []), - test_server:timetrap_cancel(Dog), ok. %% Runs several port tests in parallell. Each individual test @@ -444,7 +418,7 @@ mul_slow_writes(Config) when is_list(Config) -> %% should also finish in about 5 seconds. parallell(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(300)), + ct:timetrap({minutes, 5}), Testers = [ fun() -> stream_ping(Config, 1007, "-s100", []) end, fun() -> stream_ping(Config, 10007, "-s1000", []) end, @@ -464,7 +438,6 @@ parallell(Config) when is_list(Config) -> process_flag(trap_exit, true), Pids = lists:map(fun fun_spawn/1, Testers), wait_for(Pids), - test_server:timetrap_cancel(Dog), ok. wait_for([]) -> @@ -483,7 +456,7 @@ wait_for(Pids) -> dying_port(suite) -> []; dying_port(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(150)), + ct:timetrap({minutes, 2}), process_flag(trap_exit, true), P1 = make_dying_port(Config), @@ -504,8 +477,6 @@ dying_port(Config) when is_list(Config) -> wait_for_port_exit(P3), wait_for_port_exit(P4), wait_for_port_exit(P5), - - test_server:timetrap_cancel(Dog), ok. wait_for_port_exit(Port) -> @@ -532,7 +503,7 @@ make_dying_port(Config) when is_list(Config) -> port_program_with_path(suite) -> []; port_program_with_path(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({minutes, 2}), DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -567,7 +538,6 @@ port_program_with_path(Config) when is_list(Config) -> {P, {data, Message}} -> ok end, - test_server:timetrap_cancel(Dog), ok. @@ -575,7 +545,6 @@ port_program_with_path(Config) when is_list(Config) -> %% This used to fail on Windows. open_input_file_port(suite) -> []; open_input_file_port(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), PrivDir = ?config(priv_dir, Config), %% Create a file with the file driver and read it back using @@ -591,13 +560,12 @@ open_input_file_port(Config) when is_list(Config) -> ok end end, - test_server:timetrap_cancel(Dog), ok. %% Tests that files can be written using open_port(Filename, [out]). open_output_file_port(suite) -> []; open_output_file_port(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({minutes, 2}), PrivDir = ?config(priv_dir, Config), %% Create a file with open_port/2 and read it back with @@ -613,8 +581,6 @@ open_output_file_port(Config) when is_list(Config) -> OutputPort ! {self(), close}, {ok, Bin} = file:read_file(MyFile2), FileData2 = binary_to_list(Bin), - - test_server:timetrap_cancel(Dog), ok. %% Tests that all appropriate fd's have been closed in the port program @@ -670,7 +636,7 @@ iter_max_ports(Config) when is_list(Config) -> iter_max_ports_test(Config) -> - Dog = test_server:timetrap(test_server:minutes(30)), + ct:timetrap({minutes, 30}), PortTest = port_test(Config), Command = lists:concat([PortTest, " -h0 -q"]), Iters = case os:type() of @@ -687,7 +653,6 @@ iter_max_ports_test(Config) -> io:format("Result: ~p",[L]), all_equal(L), all_equal(L), - test_server:timetrap_cancel(Dog), {comment, "Max ports: " ++ integer_to_list(hd(L))}. do_iter_max_ports(N, Command) when N > 0 -> @@ -779,14 +744,13 @@ tps_1K(Config) when is_list(Config) -> tps(1024, Config). tps(Size, Config) -> - Dog = test_server:timetrap(test_server:seconds(300)), + ct:timetrap({minutes, 5}), PortTest = port_test(Config), Packet = list_to_binary(random_packet(Size, "e")), Port = open_port({spawn, PortTest}, [binary, {packet, 2}]), Transactions = 10000, {Elapsed, ok} = test_server:timecall(?MODULE, tps, [Port, Packet, Transactions]), - test_server:timetrap_cancel(Dog), {comment, integer_to_list(trunc(Transactions/Elapsed+0.5)) ++ " transactions/s"}. tps(_Port, _Packet, 0) -> ok; @@ -801,8 +765,8 @@ tps(Port, Packet, N) -> %% Line I/O test line(Config) when is_list(Config) -> + ct:timetrap({minutes, 5}), Siz = 110, - Dog = test_server:timetrap(test_server:seconds(300)), Packet1 = random_packet(Siz), Packet2 = random_packet(Siz div 2), %% Test that packets are split into lines @@ -841,7 +805,6 @@ line(Config) when is_list(Config) -> {eol, Packet1}]}], 0, "-d", [{line,Siz}]), %% Test that we get badarg if trying both packet and line bad_argument(Config, [{packet, 5}, {line, 5}]), - test_server:timetrap_cancel(Dog), ok. %%% Redirection of stderr test @@ -850,7 +813,7 @@ stderr_to_stdout(suite) -> stderr_to_stdout(doc) -> "Test that redirection of standard error to standard output works."; stderr_to_stdout(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({minutes, 1}), %% See that it works Packet = random_packet(10), port_expect(Config,[{Packet,[Packet]}], 0, "-e -l10", @@ -858,7 +821,6 @@ stderr_to_stdout(Config) when is_list(Config) -> %% stream_ping(Config, 10, "-e", [stderr_to_stdout]), %% See that it doesn't always happen (will generate garbage on stderr) port_expect(Config,[{Packet,[eof]}], 0, "-e -l10", [line,eof]), - test_server:timetrap_cancel(Dog), ok. @@ -878,7 +840,7 @@ env(suite) -> env(doc) -> ["Test that the 'env' option works"]; env(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({minutes, 1}), Priv = ?config(priv_dir, Config), Temp = filename:join(Priv, "env_fun.bin"), @@ -909,8 +871,6 @@ env(Config) when is_list(Config) -> ExistingList = [{lists:flatten(io_lib:format("V~p_existing",[X])),"a_value"} || X <- lists:seq(1,150)], env_slave(Temp, lists:sort(ExistingList ++ NotExistingList)), - - test_server:timetrap_cancel(Dog), ok. env_slave(File, Env) -> @@ -1013,7 +973,7 @@ cd(suite) -> cd(doc) -> ["Test that the 'cd' option works"]; cd(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({minutes, 1}), Program = atom_to_list(lib:progname()), DataDir = ?config(data_dir, Config), @@ -1048,8 +1008,6 @@ cd(Config) when is_list(Config) -> Other3 -> test_server:fail({env, Other3}) end, - - test_server:timetrap_cancel(Dog), ok. filename_equal(A, B) -> @@ -1287,7 +1245,7 @@ otp_4389(doc) -> []; otp_4389(Config) when is_list(Config) -> case os:type() of {unix, _} -> - Dog = test_server:timetrap(test_server:seconds(240)), + ct:timetrap({minutes, 4}), TCR = self(), case get_true_cmd() of True when is_list(True) -> @@ -1326,7 +1284,6 @@ otp_4389(Config) when is_list(Config) -> end) end, lists:duplicate(1000,[]))), - test_server:timetrap_cancel(Dog), {comment, "This test case doesn't always fail when the bug that " "it tests for is present (it is most likely to fail on" @@ -1363,11 +1320,10 @@ exit_status(suite) -> exit_status(doc) -> ["Test that the 'exit_status' option works"]; exit_status(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(60)), - port_expect(Config,[{"x", - [{exit_status, 5}]}], - 1, "", [exit_status]), - test_server:timetrap_cancel(Dog), + ct:timetrap({minutes, 1}), + port_expect(Config, + [{"x", [{exit_status, 5}]}], + 1, "", [exit_status]), ok. spawn_driver(suite) -> @@ -1375,7 +1331,6 @@ spawn_driver(suite) -> spawn_driver(doc) -> ["Test spawning a driver specifically"]; spawn_driver(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), ok = load_driver(Path, "echo_drv"), Port = erlang:open_port({spawn_driver, "echo_drv"}, []), @@ -1404,7 +1359,6 @@ spawn_driver(Config) when is_list(Config) -> {'EXIT',{badarg,_}} = (catch erlang:open_port({spawn_driver, "ls"}, [])), {'EXIT',{badarg,_}} = (catch erlang:open_port({spawn_driver, "cmd"}, [])), {'EXIT',{badarg,_}} = (catch erlang:open_port({spawn_driver, os:find_executable("erl")}, [])), - test_server:timetrap_cancel(Dog), ok. parallelism_option(suite) -> @@ -1412,7 +1366,6 @@ parallelism_option(suite) -> parallelism_option(doc) -> ["Test parallelism option of open_port"]; parallelism_option(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), ?line Path = ?config(data_dir, Config), ?line ok = load_driver(Path, "echo_drv"), ?line Port = erlang:open_port({spawn_driver, "echo_drv"}, @@ -1441,7 +1394,6 @@ parallelism_option(Config) when is_list(Config) -> end, ?line Port2 ! {self(), close}, ?line receive {Port2, closed} -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. spawn_executable(suite) -> @@ -1449,7 +1401,6 @@ spawn_executable(suite) -> spawn_executable(doc) -> ["Test spawning an executable specifically"]; spawn_executable(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), DataDir = ?config(data_dir, Config), EchoArgs1 = filename:join([DataDir,"echo_args"]), ExactFile1 = filename:nativename(os:find_executable(EchoArgs1)), @@ -1555,7 +1506,6 @@ spawn_executable(Config) when is_list(Config) -> {unix,_} -> test_sh_file(SpaceDir) end, - test_server:timetrap_cancel(Dog), ok. unregister_name(Config) when is_list(Config) -> @@ -1691,7 +1641,6 @@ mix_up_ports(suite) -> mix_up_ports(doc) -> ["Test that the emulator does not mix up ports when the port table wraps"]; mix_up_ports(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), ok = load_driver(Path, "echo_drv"), Port = erlang:open_port({spawn, "echo_drv"}, []), @@ -1724,7 +1673,6 @@ mix_up_ports(Config) when is_list(Config) -> after 1000 -> ok end, - test_server:timetrap_cancel(Dog), ok. loop(Stop, Stop, Fun) when is_function(Fun) -> @@ -1739,7 +1687,6 @@ otp_5112(doc) -> ["Test that link to connected process is taken away when port calls", "driver_exit() also when the port index has wrapped"]; otp_5112(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), ok = load_driver(Path, "exit_drv"), Port = otp_5112_get_wrapped_port(), @@ -1753,7 +1700,6 @@ otp_5112(Config) when is_list(Config) -> {links, Links2} = process_info(self(),links), ?t:format("Links2: ~p~n",[Links2]), false = lists:member(Port, Links2), %% This used to fail - test_server:timetrap_cancel(Dog), ok. otp_5112_get_wrapped_port() -> @@ -1787,7 +1733,6 @@ otp_5119(suite) -> otp_5119(doc) -> ["Test that port index is not unnecessarily wrapped"]; otp_5119(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), ok = load_driver(Path, "exit_drv"), PI1 = port_ix(otp_5119_fill_empty_port_tab([])), @@ -1806,7 +1751,6 @@ otp_5119(Config) when is_list(Config) -> ?t:format("MaxPorts = ~p~n", [MaxPorts]), true = PortIx2 > PortIx1, true = PortIx2 =< PortIx1 + MaxPorts, - test_server:timetrap_cancel(Dog), ok. otp_5119_fill_empty_port_tab(Ports) -> @@ -1833,7 +1777,6 @@ port_ix(Port) when is_port(Port) -> otp_6224(doc) -> ["Check that port command failure doesn't crash the emulator"]; otp_6224(suite) -> []; otp_6224(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), ok = load_driver(Path, "failure_drv"), Go = make_ref(), @@ -1855,7 +1798,6 @@ otp_6224(Config) when is_list(Config) -> Reason}) end end, - test_server:timetrap_cancel(Dog), ok. otp_6224_loop() -> @@ -1872,7 +1814,7 @@ exit_status_multi_scheduling_block(Config) when is_list(Config) -> Repeat = 3, case ?t:os_type() of {unix, _} -> - Dog = ?t:timetrap(test_server:minutes(2*Repeat)), + ct:timetrap({minutes, 2*Repeat}), SleepSecs = 6, try lists:foreach(fun (_) -> @@ -1884,7 +1826,6 @@ exit_status_multi_scheduling_block(Config) when is_list(Config) -> %% Wait for the system to recover (regardless %% of success or not) otherwise later testcases %% may unnecessarily fail. - ?t:timetrap_cancel(Dog), receive after SleepSecs+500 -> ok end end; _ -> {skip, "Not implemented for this OS"} @@ -2400,7 +2341,7 @@ close_deaf_port(doc) -> ["Send data to port program that does not read it, then "Primary targeting Windows to test threaded_handle_closer in sys.c"]; close_deaf_port(suite) -> []; close_deaf_port(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(100)), + ct:timetrap({minutes, 2}), DataDir = ?config(data_dir, Config), DeadPort = os:find_executable("dead_port", DataDir), Port = open_port({spawn,DeadPort++" 60"},[]), @@ -2410,7 +2351,6 @@ close_deaf_port(Config) when is_list(Config) -> Res = close_deaf_port_1(0, DeadPort), io:format("Waiting for OS procs to terminate...\n"), receive after 5*1000 -> ok end, - test_server:timetrap_cancel(Dog), Res. close_deaf_port_1(200, _) -> diff --git a/erts/emulator/test/port_bif_SUITE.erl b/erts/emulator/test/port_bif_SUITE.erl index 9215d7f720..c7659eed9e 100644 --- a/erts/emulator/test/port_bif_SUITE.erl +++ b/erts/emulator/test/port_bif_SUITE.erl @@ -21,8 +21,8 @@ -module(port_bif_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, command/1, +-export([all/0, suite/0, groups/0, + command/1, command_e_1/1, command_e_2/1, command_e_3/1, command_e_4/1, port_info1/1, port_info2/1, port_info_os_pid/1, port_info_race/1, @@ -30,11 +30,11 @@ -export([do_command_e_1/1, do_command_e_2/1, do_command_e_4/1]). --export([init_per_testcase/2, end_per_testcase/2]). - -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 10}}]. all() -> [command, {group, port_info}, connect, control, @@ -46,27 +46,6 @@ groups() -> {port_info, [], [port_info1, port_info2, port_info_os_pid, port_info_race]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - - -init_per_testcase(_Func, Config) when is_list(Config) -> - Dog=test_server:timetrap(test_server:minutes(10)), - [{watchdog, Dog}|Config]. -end_per_testcase(_Func, Config) when is_list(Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog). - command(Config) when is_list(Config) -> load_control_drv(Config), @@ -410,7 +389,7 @@ test_op(P, Op) -> <<Op:32>> = list_to_binary(R). echo_to_busy(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), load_control_drv(Config), P = open_port({spawn, control_drv}, []), erlang:port_control(P, $b, [1]), % Set to busy. @@ -426,7 +405,6 @@ echo_to_busy(Config) when is_list(Config) -> Other -> test_server:fail({unexpected_message, Other}) end, - test_server:timetrap_cancel(Dog), ok. echoer(P, ReplyTo) -> diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl index 862fe78b85..d0af5f39b1 100644 --- a/erts/emulator/test/process_SUITE.erl +++ b/erts/emulator/test/process_SUITE.erl @@ -67,7 +67,9 @@ -export([hangaround/2, processes_bif_test/0, do_processes/1, processes_term_proc_list_test/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 9}}]. all() -> [spawn_with_binaries, t_exit_1, {group, t_exit_2}, @@ -128,12 +130,10 @@ end_per_group(_GroupName, Config) -> Config. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(10)), - [{watchdog, Dog},{testcase, Func}|Config]. + [{testcase, Func}|Config]. end_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). + ok. fun_spawn(Fun) -> spawn_link(erlang, apply, [Fun, []]). @@ -158,11 +158,10 @@ binary_owner(Bin) when is_binary(Bin) -> %% Tests exit/1 with a big message. t_exit_1(Config) when is_list(Config) -> + ct:timetrap({seconds, 20}), start_spawner(), - Dog = test_server:timetrap(test_server:seconds(20)), process_flag(trap_exit, true), test_server:do_times(10, fun t_exit_1/0), - test_server:timetrap_cancel(Dog), stop_spawner(), ok. @@ -176,11 +175,10 @@ t_exit_1() -> %% Tests exit/2 with a lot of data in the exit message. t_exit_2_other(Config) when is_list(Config) -> + ct:timetrap({seconds, 20}), start_spawner(), - Dog = test_server:timetrap(test_server:seconds(20)), process_flag(trap_exit, true), test_server:do_times(10, fun t_exit_2_other/0), - test_server:timetrap_cancel(Dog), stop_spawner(), ok. @@ -194,7 +192,7 @@ t_exit_2_other() -> %% Tests that exit(Pid, normal) does not kill another process.; t_exit_2_other_normal(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(20)), + ct:timetrap({seconds, 20}), process_flag(trap_exit, true), Pid = fun_spawn(fun() -> receive x -> ok end end), exit(Pid, normal), @@ -211,17 +209,15 @@ t_exit_2_other_normal(Config) when is_list(Config) -> ok end, exit(Pid, kill), - test_server:timetrap_cancel(Dog), ok. %% Tests that we can trap an exit message sent with exit/2 from %% the same process. self_exit(Config) when is_list(Config) -> + ct:timetrap({seconds, 10}), start_spawner(), - Dog = test_server:timetrap(test_server:seconds(10)), process_flag(trap_exit, true), test_server:do_times(200, fun self_exit/0), - test_server:timetrap_cancel(Dog), stop_spawner(), ok. @@ -270,11 +266,10 @@ t_exit_2_catch(Config) when is_list(Config) -> %% Tests trapping of an 'EXIT' message generated by a bad argument to %% the abs/1 bif. The 'EXIT' message will intentionally be very big. trap_exit_badarg(Config) when is_list(Config) -> + ct:timetrap({seconds, 10}), start_spawner(), - Dog = test_server:timetrap(test_server:seconds(10)), process_flag(trap_exit, true), test_server:do_times(10, fun trap_exit_badarg/0), - test_server:timetrap_cancel(Dog), stop_spawner(), ok. @@ -320,10 +315,9 @@ big_binary(N, Acc) -> %% Test receiving an EXIT message when spawning a BIF with bad arguments. trap_exit_badarg_in_bif(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), process_flag(trap_exit, true), test_server:do_times(10, fun trap_exit_badarg_bif/0), - test_server:timetrap_cancel(Dog), ok. trap_exit_badarg_bif() -> @@ -345,15 +339,13 @@ trap_exit_badarg_bif() -> %% 3) The process will crash the next time it executes 'receive'. exit_and_timeout(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(20)), + ct:timetrap({seconds, 20}), process_flag(trap_exit, true), Parent = self(), Low = fun_spawn(fun() -> eat_low(Parent) end), High = fun_spawn(fun() -> eat_high(Low) end), eat_wait_for(Low, High), - - test_server:timetrap_cancel(Dog), ok. @@ -397,14 +389,12 @@ loop(StopTime) -> %% Tries to send two different exit messages to a process. %% (The second one should be ignored.) exit_twice(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(20)), + ct:timetrap({seconds, 20}), process_flag(trap_exit, true), Low = fun_spawn(fun etwice_low/0), High = fun_spawn(fun() -> etwice_high(Low) end), etwice_wait_for(Low, High), - - test_server:timetrap_cancel(Dog), ok. etwice_wait_for(Low, High) -> diff --git a/erts/emulator/test/receive_SUITE.erl b/erts/emulator/test/receive_SUITE.erl index 635c3d27c5..d471bbecc9 100644 --- a/erts/emulator/test/receive_SUITE.erl +++ b/erts/emulator/test/receive_SUITE.erl @@ -24,13 +24,12 @@ -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, call_with_huge_message_queue/1,receive_in_between/1]). --export([init_per_testcase/2,end_per_testcase/2]). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [call_with_huge_message_queue, receive_in_between]. @@ -38,27 +37,6 @@ all() -> groups() -> []. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - call_with_huge_message_queue(Config) when is_list(Config) -> Pid = spawn_link(fun echo_loop/0), diff --git a/erts/emulator/test/ref_SUITE.erl b/erts/emulator/test/ref_SUITE.erl index 6d4a998094..1bf94b9a3f 100644 --- a/erts/emulator/test/ref_SUITE.erl +++ b/erts/emulator/test/ref_SUITE.erl @@ -20,45 +20,20 @@ -module(ref_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([wrap_1/1]). -export([loop_ref/1]). -include_lib("common_test/include/ct.hrl"). -init_per_testcase(_, Config) -> - ?line Dog=test_server:timetrap(test_server:minutes(2)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_, 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, 2}}]. all() -> [wrap_1]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - wrap_1(doc) -> "Check that refs don't wrap around easily."; wrap_1(Config) when is_list(Config) -> ?line spawn_link(?MODULE, loop_ref, [self()]), diff --git a/erts/emulator/test/register_SUITE.erl b/erts/emulator/test/register_SUITE.erl index 53bf02e085..68b36f99c3 100644 --- a/erts/emulator/test/register_SUITE.erl +++ b/erts/emulator/test/register_SUITE.erl @@ -26,44 +26,17 @@ -include_lib("common_test/include/ct.hrl"). %-compile(export_all). --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([otp_8099/1]). --define(DEFAULT_TIMEOUT, ?t:minutes(2)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> [otp_8099]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Case, Config) when is_list(Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, Dog}, {testcase, Case} | Config]. - -end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - %% %% Test cases %% diff --git a/erts/emulator/test/scheduler_SUITE.erl b/erts/emulator/test/scheduler_SUITE.erl index f998e7d4d2..03e546c00d 100644 --- a/erts/emulator/test/scheduler_SUITE.erl +++ b/erts/emulator/test/scheduler_SUITE.erl @@ -34,9 +34,9 @@ -include_lib("common_test/include/ct.hrl"). %-compile(export_all). --export([all/0, suite/0,groups/0,init_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2, end_per_testcase/2, end_per_suite/1]). +-export([all/0, suite/0, groups/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -export([equal/1, few_low/1, @@ -60,11 +60,9 @@ dirty_scheduler_exit/1, reader_groups/1]). --define(DEFAULT_TIMEOUT, ?t:minutes(15)). - --define(MIN_SCHEDULER_TEST_TIMEOUT, ?t:minutes(1)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 15}}]. all() -> [equal, few_low, many_low, equal_with_part_time_high, @@ -89,12 +87,6 @@ end_per_suite(Config) -> catch erts_debug:set_internal_state(available_internal_state, false), Config. -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - init_per_testcase(update_cpu_info, Config) -> case os:find_executable("taskset") of false -> @@ -106,15 +98,12 @@ init_per_testcase(Case, Config) when is_list(Config) -> init_per_tc(Case, Config). init_per_tc(Case, Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), process_flag(priority, max), erlang:display({'------------', ?MODULE, Case, '------------'}), OkRes = ok, - [{watchdog, Dog}, {testcase, Case}, {ok_res, OkRes} |Config]. + [{testcase, Case}, {ok_res, OkRes} |Config]. end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), ok. -define(ERTS_RUNQ_CHECK_BALANCE_REDS_PER_SCHED, (2000*2000)). @@ -1328,10 +1317,9 @@ scheduler_suspend_basic_test() -> scheduler_suspend(Config) when is_list(Config) -> - ?line Dog = ?t:timetrap(?t:minutes(5)), + ct:timetrap({minutes, 5}), ?line lists:foreach(fun (S) -> scheduler_suspend_test(Config, S) end, [64, 32, 16, default]), - ?line ?t:timetrap_cancel(Dog), ?line ok. scheduler_suspend_test(Config, Schedulers) -> ?line Cmd = case Schedulers of @@ -2044,8 +2032,8 @@ do_it(Tracer, Low, Normal, High, Max, RedsPerSchedLimit) -> EndWait = erlang:monotonic_time(milli_seconds), BalanceWait = EndWait-StartWait, erlang:display({balance_wait, BalanceWait}), - Timeout = ?DEFAULT_TIMEOUT - ?t:minutes(4) - BalanceWait, - Res = case Timeout < ?MIN_SCHEDULER_TEST_TIMEOUT of + Timeout = (15 - 4)*60*1000 - BalanceWait, + Res = case Timeout < 60*1000 of true -> stop_work(Low, Normal, High, Max), too_slow; diff --git a/erts/emulator/test/send_term_SUITE.erl b/erts/emulator/test/send_term_SUITE.erl index 63c11519b8..de453e090a 100644 --- a/erts/emulator/test/send_term_SUITE.erl +++ b/erts/emulator/test/send_term_SUITE.erl @@ -20,43 +20,19 @@ -module(send_term_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,basic/1]). --export([init_per_testcase/2,end_per_testcase/2]). +-export([all/0, suite/0]). -export([generate_external_terms_files/1]). -include_lib("common_test/include/ct.hrl"). -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(3)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 3}}]. all() -> [basic]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - basic(Config) when is_list(Config) -> Drv = "send_term_drv", ?line P = start_driver(Config, Drv), diff --git a/erts/emulator/test/sensitive_SUITE.erl b/erts/emulator/test/sensitive_SUITE.erl index 29517cdcb8..a5cc25f55a 100644 --- a/erts/emulator/test/sensitive_SUITE.erl +++ b/erts/emulator/test/sensitive_SUITE.erl @@ -22,9 +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, - init_per_testcase/2,end_per_testcase/2, +-export([all/0, suite/0, stickiness/1,send_trace/1,recv_trace/1,proc_trace/1,call_trace/1, meta_trace/1,running_trace/1,gc_trace/1,seq_trace/1, t_process_info/1,t_process_display/1,save_calls/1]). @@ -33,15 +31,9 @@ -import(lists, [keysearch/3,foreach/2,sort/1]). -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(5)), - [{watchdog,Dog}|Config]. - -end_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 5}}]. all() -> [stickiness, send_trace, recv_trace, proc_trace, @@ -49,22 +41,6 @@ all() -> seq_trace, t_process_info, t_process_display, save_calls]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - stickiness(Config) when is_list(Config) -> ?line {Tracer,Mref} = spawn_monitor(fun() -> receive after infinity -> ok end diff --git a/erts/emulator/test/signal_SUITE.erl b/erts/emulator/test/signal_SUITE.erl index e176fe52d6..63996fb9f2 100644 --- a/erts/emulator/test/signal_SUITE.erl +++ b/erts/emulator/test/signal_SUITE.erl @@ -28,12 +28,10 @@ -module(signal_SUITE). -author('[email protected]'). --define(DEFAULT_TIMEOUT_SECONDS, 120). - %-define(line_trace, 1). -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,init_per_suite/1, end_per_suite/1]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases -export([xm_sig_order/1, @@ -51,16 +49,12 @@ pending_exit_group_leader/1, exit_before_pending_exit/1]). --export([init_per_testcase/2, end_per_testcase/2]). - init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - ?line Dog = ?t:timetrap(?t:seconds(?DEFAULT_TIMEOUT_SECONDS)), available_internal_state(true), - ?line [{testcase, Func},{watchdog, Dog}|Config]. + [{testcase, Func}|Config]. end_per_testcase(_Func, Config) -> - ?line Dog = ?config(watchdog, Config), - ?line ?t:timetrap_cancel(Dog). + ok. init_per_suite(Config) -> Config. @@ -70,7 +64,9 @@ end_per_suite(_Config) -> catch erts_debug:set_internal_state(not_running_optimization, true), available_internal_state(false). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> [xm_sig_order, pending_exit_unlink_process, @@ -83,16 +79,6 @@ all() -> pending_exit_process_info_2, pending_exit_group_leader, exit_before_pending_exit]. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - xm_sig_order(doc) -> ["Test that exit signals and messages are received " "in correct order"]; xm_sig_order(suite) -> []; diff --git a/erts/emulator/test/smoke_test_SUITE.erl b/erts/emulator/test/smoke_test_SUITE.erl index 2df19cd20b..751129c7bb 100644 --- a/erts/emulator/test/smoke_test_SUITE.erl +++ b/erts/emulator/test/smoke_test_SUITE.erl @@ -23,35 +23,18 @@ -include_lib("common_test/include/ct.hrl"). %-compile(export_all). --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, init_per_testcase/2, end_per_testcase/2]). -export([boot_combo/1, native_atomics/1, jump_table/1]). --define(DEFAULT_TIMEOUT, ?t:minutes(2)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> [boot_combo, native_atomics, jump_table]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - init_per_testcase(boot_combo = Case, Config) when is_list(Config) -> case erlang:system_info(build_type) of opt -> @@ -63,12 +46,9 @@ init_per_testcase(Case, Config) when is_list(Config) -> init_per_tc(Case, Config). init_per_tc(Case, Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), - [{testcase, Case},{watchdog, Dog}|Config]. + [{testcase, Case}|Config]. end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), ok. %%% diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl index df96b018a1..12b35cbcdf 100644 --- a/erts/emulator/test/statistics_SUITE.erl +++ b/erts/emulator/test/statistics_SUITE.erl @@ -41,15 +41,14 @@ -include_lib("common_test/include/ct.hrl"). init_per_testcase(_, Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(300)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> [{group, wall_clock}, {group, runtime}, reductions, @@ -77,12 +76,8 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. - - %%% Testing statistics(wall_clock). - - wall_clock_zero_diff(doc) -> "Tests that the 'Wall clock since last call' element of the result " "is zero when statistics(runtime) is called twice in succession."; diff --git a/erts/emulator/test/system_info_SUITE.erl b/erts/emulator/test/system_info_SUITE.erl index ae18b280cf..e6bef8f14f 100644 --- a/erts/emulator/test/system_info_SUITE.erl +++ b/erts/emulator/test/system_info_SUITE.erl @@ -33,47 +33,19 @@ -include_lib("common_test/include/ct.hrl"). -%-compile(export_all). --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([process_count/1, system_version/1, misc_smoke_tests/1, heap_size/1, wordsize/1, memory/1, - ets_limit/1]). +-export([process_count/1, system_version/1, misc_smoke_tests/1, + heap_size/1, wordsize/1, memory/1, ets_limit/1]). --define(DEFAULT_TIMEOUT, ?t:minutes(2)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> [process_count, system_version, misc_smoke_tests, heap_size, wordsize, memory, ets_limit]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - %%% %%% The test cases ------------------------------------------------------------- %%% diff --git a/erts/emulator/test/system_profile_SUITE.erl b/erts/emulator/test/system_profile_SUITE.erl index c63a119f9d..4ac48872df 100644 --- a/erts/emulator/test/system_profile_SUITE.erl +++ b/erts/emulator/test/system_profile_SUITE.erl @@ -23,54 +23,25 @@ -module(system_profile_SUITE). --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, system_profile_on_and_off/1, - runnable_procs/1, - runnable_ports/1, + runnable_procs/1, runnable_ports/1, dont_profile_profiler/1, - scheduler/1 - ]). - --export([init_per_testcase/2, end_per_testcase/2]). + scheduler/1]). -export([profiler_process/1, ring_loop/1, port_echo_start/0, list_load/0, run_load/2]). -include_lib("common_test/include/ct.hrl"). --define(default_timeout, ?t:minutes(1)). - -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() -> [system_profile_on_and_off, runnable_procs, runnable_ports, scheduler, dont_profile_profiler]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - %% No specification clause needed for an init function in a conf case!!! %% Test switching system_profiling on and off. diff --git a/erts/emulator/test/timer_bif_SUITE.erl b/erts/emulator/test/timer_bif_SUITE.erl index f4615d6810..dca44a1891 100644 --- a/erts/emulator/test/timer_bif_SUITE.erl +++ b/erts/emulator/test/timer_bif_SUITE.erl @@ -20,8 +20,7 @@ -module(timer_bif_SUITE). --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, init_per_suite/1, end_per_suite/1, init_per_testcase/2,end_per_testcase/2]). -export([start_timer_1/1, send_after_1/1, send_after_2/1, send_after_3/1, cancel_timer_1/1, @@ -40,16 +39,13 @@ -define(AUTO_CANCEL_YIELD_LIMIT, 100). init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(30)), case catch erts_debug:get_internal_state(available_internal_state) of true -> ok; _ -> erts_debug:set_internal_state(available_internal_state, true) end, - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. init_per_suite(Config) -> @@ -59,7 +55,9 @@ init_per_suite(Config) -> end_per_suite(_Config) -> catch erts_debug:set_internal_state(available_internal_state, false). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 5}}]. all() -> [start_timer_1, send_after_1, send_after_2, @@ -72,15 +70,6 @@ all() -> % same_time_yielding_with_cancel_other_accessor, auto_cancel_yielding]. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - start_timer_1(doc) -> ["Basic start_timer/3 functionality"]; start_timer_1(Config) when is_list(Config) -> diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl index 02c2c7a93a..b74d1b383a 100644 --- a/erts/emulator/test/trace_SUITE.erl +++ b/erts/emulator/test/trace_SUITE.erl @@ -24,8 +24,8 @@ %%% Tests the trace BIF. %%% --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, receive_trace/1, self_send/1, +-export([all/0, suite/0, + receive_trace/1, self_send/1, timeout_trace/1, send_trace/1, procs_trace/1, dist_procs_trace/1, suspend/1, mutual_suspend/1, suspend_exit/1, suspender_exit/1, @@ -43,7 +43,9 @@ %%% Internal exports -export([process/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 5}}]. all() -> [cpu_timestamp, receive_trace, self_send, timeout_trace, @@ -54,31 +56,13 @@ all() -> set_on_first_spawn, system_monitor_args, more_system_monitor_args, system_monitor_long_gc_1, system_monitor_long_gc_2, system_monitor_large_heap_1, - system_monitor_long_schedule, + system_monitor_long_schedule, system_monitor_large_heap_2, bad_flag, trace_delivered]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - %% No longer testing anything, just reporting whether cpu_timestamp %% is enabled or not. cpu_timestamp(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - %% Test whether cpu_timestamp is implemented on this platform. ?line Works = try erlang:trace(all, true, [cpu_timestamp]) of _ -> @@ -87,8 +71,6 @@ cpu_timestamp(Config) when is_list(Config) -> catch error:badarg -> false end, - - ?line test_server:timetrap_cancel(Dog), {comment,case Works of false -> "cpu_timestamp is NOT implemented/does not work"; true -> "cpu_timestamp works" @@ -98,7 +80,6 @@ cpu_timestamp(Config) when is_list(Config) -> %% Tests that trace(Pid, How, ['receive']) works. receive_trace(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Receiver = fun_spawn(fun receiver/0), ?line process_flag(trap_exit, true), @@ -121,15 +102,11 @@ receive_trace(Config) when is_list(Config) -> ?line Receiver ! {hello, there}, ?line Receiver ! any_garbage, ?line receive_nothing(), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. self_send(doc) -> ["Test that traces are generated for messages sent ", "and received to/from self()."]; self_send(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Fun = fun(Self, Parent) -> receive go_ahead -> @@ -150,28 +127,21 @@ self_send(Config) when is_list(Config) -> end, ?line receive {trace,SelfSender,send,done,Self} -> ok end, ?line receive done -> ok end, - - ?line test_server:timetrap_cancel(Dog), ok. %% Test that we can receive timeout traces. timeout_trace(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - ?line Process = fun_spawn(fun process/0), ?line 1 = erlang:trace(Process, true, ['receive']), ?line Process ! timeout_please, ?line {trace, Process, 'receive', timeout_please} = receive_first(), ?line {trace, Process, 'receive', timeout} = receive_first(), ?line receive_nothing(), - - ?line test_server:timetrap_cancel(Dog), ok. %% Tests that trace(Pid, How, [send]) works. send_trace(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line process_flag(trap_exit, true), ?line Sender = fun_spawn(fun sender/0), ?line Receiver = fun_spawn(fun receiver/0), @@ -222,14 +192,10 @@ send_trace(Config) when is_list(Config) -> ?line Sender ! {send_please, self(), to_myself_again}, ?line receive to_myself_again -> ok end, ?line receive_nothing(), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. %% Test trace(Pid, How, [procs]). procs_trace(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Name = list_to_atom(atom_to_list(?MODULE)++"_procs_trace"), ?line Self = self(), ?line process_flag(trap_exit, true), @@ -310,14 +276,11 @@ procs_trace(Config) when is_list(Config) -> ?line Proc2 ! {exit_please, Reason2}, ?line {trace, Proc2, exit, Reason2} = receive_first(), ?line receive_nothing(), - %% - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. dist_procs_trace(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(15)), + ct:timetrap({seconds, 15}), ?line OtherName = atom_to_list(?MODULE)++"_dist_procs_trace", ?line {ok, OtherNode} = start_node(OtherName), ?line Self = self(), @@ -379,7 +342,6 @@ dist_procs_trace(Config) when is_list(Config) -> %% %% Done. ?line true = stop_node(OtherNode), - ?line test_server:timetrap_cancel(Dog), ok. @@ -388,7 +350,6 @@ dist_procs_trace(Config) when is_list(Config) -> %% Tests trace(Pid, How, [set_on_spawn]). set_on_spawn(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Listener = fun_spawn(fun process/0), %% Create and trace a process with the set_on_spawn flag. @@ -407,15 +368,12 @@ set_on_spawn(Config) when is_list(Config) -> [Child11, Child12] = spawn_children(Child1, 2), ?line true = is_send_traced(Child11, Listener, child11), ?line true = is_send_traced(Child12, Listener, child12), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. %% Tests trace(Pid, How, [set_on_first_spawn]). set_on_first_spawn(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(10)), + ct:timetrap({seconds, 10}), ?line Listener = fun_spawn(fun process/0), %% Create and trace a process with the set_on_first_spawn flag. @@ -431,16 +389,12 @@ set_on_first_spawn(Config) when is_list(Config) -> ?line false = is_send_traced(Child2, Listener, child2), ?line false = is_send_traced(Child3, Listener, child3), ?line receive_nothing(), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. system_monitor_args(doc) -> ["Tests arguments to erlang:system_monitor/0-2)"]; system_monitor_args(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Self = self(), %% ?line OldMonitor = erlang:system_monitor(undefined), @@ -498,24 +452,17 @@ system_monitor_args(Config) when is_list(Config) -> (catch erlang:system_monitor(Self,[{large_heap,-1}])), ?line {'EXIT',{badarg,_}} = (catch erlang:system_monitor({Self,[{large_heap,atom}]})), - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. more_system_monitor_args(doc) -> ["Tests arguments to erlang:system_monitor/0-2)"]; more_system_monitor_args(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - ?line try_l(64000), ?line try_l(16#7ffffff), ?line try_l(16#3fffffff), ?line try_l(16#7fffffff), ?line try_l(16#ffffffff), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. try_l(Val) -> @@ -746,7 +693,7 @@ system_monitor_large_heap_2(Config) when is_list(Config) -> ?line large_heap(LoadFun, true). large_heap(LoadFun, ExpectMonMsg) -> - ?line Dog = test_server:timetrap(test_server:seconds(20)), + ct:timetrap({seconds, 20}), %% ?line Size = 65535, ?line Self = self(), @@ -766,8 +713,6 @@ large_heap(LoadFun, ExpectMonMsg) -> {undefined, true} -> ?line ?t:fail(no_system_monitor_message_received) end, - %% - ?line test_server:timetrap_cancel(Dog), ok. large_heap_check(Pid, Size, Result) -> @@ -844,14 +789,10 @@ spawn_children(Parent, Number, Result) -> suspend(doc) -> "Test erlang:suspend/1 and erlang:resume/1."; suspend(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(2)), - + ct:timetrap({minutes,2}), ?line Worker = fun_spawn(fun worker/0), %% Suspend a process and test that it is suspended. ?line ok = do_suspend(Worker, 10000), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. do_suspend(_Pid, 0) -> @@ -880,7 +821,7 @@ mutual_suspend(suite) -> []; mutual_suspend(Config) when is_list(Config) -> ?line TimeoutSecs = 5*60, - ?line Dog = test_server:timetrap(test_server:minutes(TimeoutSecs)), + ct:timetrap({seconds, TimeoutSecs}), ?line Parent = self(), ?line Fun = fun () -> receive @@ -913,8 +854,6 @@ mutual_suspend(Config) when is_list(Config) -> ?line unlink(P2), exit(P2, bang), ?line done = Res1, ?line done = Res2, - %% Done. - ?line test_server:timetrap_cancel(Dog), ?line ok. do_mutual_suspend(_Pid, 0) -> @@ -932,10 +871,9 @@ suspend_exit(doc) -> suspend_exit(suite) -> []; suspend_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(2)), + ct:timetrap({minutes, 2}), rand:seed(exsplus, {4711,17,4711}), ?line do_suspend_exit(5000), - ?line test_server:timetrap_cancel(Dog), ?line ok. do_suspend_exit(0) -> @@ -990,7 +928,7 @@ suspender_exit(doc) -> suspender_exit(suite) -> []; suspender_exit(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(3)), + ct:timetrap({minutes, 3}), ?line P1 = spawn_link(fun () -> receive after infinity -> ok end end), ?line {'EXIT', _} = (catch erlang:resume_process(P1)), ?line {P2, M2} = spawn_monitor( @@ -1093,7 +1031,6 @@ suspender_exit(Config) when is_list(Config) -> end, ?line unlink(P1), ?line exit(P1, bong), - ?line test_server:timetrap_cancel(Dog), ?line ok. suspend_system_limit(doc) -> @@ -1103,12 +1040,11 @@ suspend_system_limit(suite) -> suspend_system_limit(Config) when is_list(Config) -> case os:getenv("ERL_EXTREME_TESTING") of "true" -> - ?line Dog = test_server:timetrap(test_server:minutes(3*60)), + ct:timetrap({minutes, 3*60}), ?line P = spawn_link(fun () -> receive after infinity -> ok end end), ?line suspend_until_system_limit(P), ?line unlink(P), ?line exit(P, bye), - ?line test_server:timetrap_cancel(Dog), ?line ok; _ -> {skip, "Takes too long time for normal testing"} @@ -1163,7 +1099,7 @@ suspend_opts(doc) -> suspend_opts(suite) -> []; suspend_opts(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(3)), + ct:timetrap({minutes, 3}), ?line Self = self(), ?line wait_for_empty_runq(10), ?line Tok = spawn_link(fun () -> @@ -1275,7 +1211,6 @@ suspend_opts(Config) when is_list(Config) -> end, ?line unlink(Tok), ?line exit(Tok, bang), - ?line test_server:timetrap_cancel(Dog), ?line ok. suspend_count(Suspendee) -> @@ -1312,24 +1247,16 @@ repeat_acc(Fun, N, M, Acc) -> suspend_waiting(doc) -> "Test that a waiting process can be suspended."; suspend_waiting(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - ?line Process = fun_spawn(fun process/0), ?line receive after 1 -> ok end, ?line true = erlang:suspend_process(Process), ?line {status, suspended} = process_info(Process, status), - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. - new_clear(doc) -> "Test that erlang:trace(new, true, ...) is cleared when tracer dies."; new_clear(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), - ?line Tracer = spawn(fun receiver/0), ?line 0 = erlang:trace(new, true, [send, {tracer, Tracer}]), ?line {flags, [send]} = erlang:trace_info(new, flags), @@ -1341,10 +1268,6 @@ new_clear(Config) when is_list(Config) -> end, ?line {flags, []} = erlang:trace_info(new, flags), ?line {tracer, []} = erlang:trace_info(new, tracer), - - %% Done. - ?line test_server:timetrap_cancel(Dog), - ok. @@ -1352,7 +1275,6 @@ new_clear(Config) when is_list(Config) -> existing_clear(doc) -> "Test that erlang:trace(all, false, ...) works without tracer."; existing_clear(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(5)), ?line Self = self(), ?line Tracer = fun_spawn(fun receiver/0), @@ -1365,9 +1287,6 @@ existing_clear(Config) when is_list(Config) -> ?line {flags, []} = erlang:trace_info(Self, flags), ?line {tracer, []} = erlang:trace_info(Self, tracer), ?line M = N + 1, % Since trace could not be enabled on the tracer. - - %% Done. - ?line test_server:timetrap_cancel(Dog), ok. bad_flag(doc) -> "Test that an invalid flag cause badarg"; @@ -1382,7 +1301,7 @@ bad_flag(Config) when is_list(Config) -> trace_delivered(doc) -> "Test erlang:trace_delivered/1"; trace_delivered(suite) -> []; trace_delivered(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(60)), + ct:timetrap({minutes, 1}), ?line TokLoops = 10000, ?line Go = make_ref(), ?line Parent = self(), @@ -1401,7 +1320,6 @@ trace_delivered(Config) when is_list(Config) -> Msg -> ?line ?t:fail({unexpected_message, Msg}) after 1000 -> - ?line test_server:timetrap_cancel(Dog), ?line ok end. diff --git a/erts/emulator/test/trace_call_count_SUITE.erl b/erts/emulator/test/trace_call_count_SUITE.erl index e358791f1f..251836831e 100644 --- a/erts/emulator/test/trace_call_count_SUITE.erl +++ b/erts/emulator/test/trace_call_count_SUITE.erl @@ -70,18 +70,17 @@ config(priv_dir,_) -> pause_and_restart/1, combo/1]). init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(30)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> +end_per_testcase(_Case, _Config) -> erlang:trace_pattern({'_','_','_'}, false, [local,meta,call_count]), erlang:trace_pattern(on_load, false, [local,meta,call_count]), erlang:trace(all, false, [all]), - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 4}}]. all() -> case test_server:is_native(trace_call_count_SUITE) of diff --git a/erts/emulator/test/trace_call_time_SUITE.erl b/erts/emulator/test/trace_call_time_SUITE.erl index a802aa12b8..59a819fe2a 100644 --- a/erts/emulator/test/trace_call_time_SUITE.erl +++ b/erts/emulator/test/trace_call_time_SUITE.erl @@ -61,29 +61,27 @@ -include_lib("common_test/include/ct.hrl"). %% 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, +-export([all/0, suite/0, init_per_testcase/2, end_per_testcase/2, not_run/1]). -export([basic/1, on_and_off/1, info/1, pause_and_restart/1, scheduling/1, called_function/1, combo/1, bif/1, nif/1]). init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(400)), erlang:trace_pattern({'_','_','_'}, false, [local,meta,call_time,call_count]), erlang:trace_pattern(on_load, false, [local,meta,call_time,call_count]), timer:now_diff(now(),now()), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> +end_per_testcase(_Case, _Config) -> erlang:trace_pattern({'_','_','_'}, false, [local,meta,call_time,call_count]), erlang:trace_pattern(on_load, false, [local,meta,call_time,call_count]), erlang:trace(all, false, [all]), - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 10}}]. all() -> case test_server:is_native(trace_call_time_SUITE) of @@ -93,22 +91,6 @@ all() -> combo, bif, nif, called_function, dead_tracer] 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"}. diff --git a/erts/emulator/test/trace_local_SUITE.erl b/erts/emulator/test/trace_local_SUITE.erl index 503a773545..193efba99c 100644 --- a/erts/emulator/test/trace_local_SUITE.erl +++ b/erts/emulator/test/trace_local_SUITE.erl @@ -29,48 +29,25 @@ -export([exported/1, exported_wrap/1, loop/4, apply_slave_async/5, match/2, clause/2, id/1, undef/1, lists_reverse/2]). -%% -%% Define to run outside of test server -%% -%% (rotten feature) -%% -%%-define(STANDALONE,1). - + %% %% Define for debug output %% %%-define(debug,1). --ifdef(STANDALONE). --define(config(A,B),config(A,B)). --export([config/2]). --define(DEFAULT_RECEIVE_TIMEOUT, 1000). --else. -include_lib("common_test/include/ct.hrl"). -define(DEFAULT_RECEIVE_TIMEOUT, infinity). --endif. -ifdef(debug). --ifdef(STANDALONE). --define(line, erlang:display({?MODULE,?LINE}), ). --endif. -define(dbgformat(A,B),io:format(A,B)). -else. --ifdef(STANDALONE). --define(line, noop, ). --endif. -define(dbgformat(A,B),noop). -endif. --ifdef(STANDALONE). -config(priv_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, basic/1, bit_syntax/1, +-export([all/0, suite/0, + basic/1, bit_syntax/1, return/1, on_and_off/1, systematic_on_off/1, stack_grow/1,info/1, delete/1, exception/1, exception_apply/1, @@ -84,14 +61,12 @@ config(priv_dir,_) -> exception_meta_nocatch_apply_function/1, concurrency/1, init_per_testcase/2, end_per_testcase/2]). + init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(test_server:minutes(2)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, Config) -> shutdown(), - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), %% Reloading the module will clear all trace patterns, and %% in a debug-compiled emulator run assertions of the counters @@ -99,9 +74,9 @@ end_per_testcase(_Case, Config) -> c:l(?MODULE). - - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> case test_server:is_native(trace_local_SUITE) of @@ -122,21 +97,6 @@ all() -> concurrency] 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"}. @@ -258,9 +218,6 @@ exception_meta_nocatch_apply_function(doc) -> exception_meta_nocatch_apply_function(Config) when is_list(Config) -> exception_test([meta,nocatch,apply,function]). --endif. - - %%% Message patterns and expect functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/erts/emulator/test/trace_meta_SUITE.erl b/erts/emulator/test/trace_meta_SUITE.erl index 8f732f0a5f..eababe02fe 100644 --- a/erts/emulator/test/trace_meta_SUITE.erl +++ b/erts/emulator/test/trace_meta_SUITE.erl @@ -66,22 +66,21 @@ config(priv_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, +-export([all/0, suite/0, init_per_testcase/2, end_per_testcase/2, not_run/1]). -export([basic/1, return/1, on_and_off/1, stack_grow/1, info/1, tracer/1, combo/1, nosilent/1]). init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(test_server:minutes(5)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, Config) -> shutdown(), - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. + +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 5}}]. all() -> case test_server:is_native(trace_meta_SUITE) of @@ -91,21 +90,6 @@ case test_server:is_native(trace_meta_SUITE) of combo, nosilent] 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"}. diff --git a/erts/emulator/test/trace_port_SUITE.erl b/erts/emulator/test/trace_port_SUITE.erl index b169a264be..e4c58860ad 100644 --- a/erts/emulator/test/trace_port_SUITE.erl +++ b/erts/emulator/test/trace_port_SUITE.erl @@ -21,9 +21,7 @@ -module(trace_port_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, call_trace/1, return_trace/1, send/1, @@ -40,7 +38,11 @@ -include_lib("common_test/include/ct.hrl"). -test_cases() -> +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. + +all() -> [call_trace, return_trace, send, receive_trace, process_events, schedule, fake_schedule, fake_schedule_after_register, @@ -48,35 +50,6 @@ test_cases() -> fake_schedule_after_getting_unlinked, gc, default_tracer, tracer_port_crash]. -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - test_cases(). - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> - Dog = ?t:timetrap(?t:seconds(30)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). - call_trace(doc) -> "Test sending call trace messages to a port."; call_trace(Config) when is_list(Config) -> case test_server:is_native(?MODULE) orelse diff --git a/erts/emulator/test/unique_SUITE.erl b/erts/emulator/test/unique_SUITE.erl index bbbcf3fa2a..ac69e283ae 100644 --- a/erts/emulator/test/unique_SUITE.erl +++ b/erts/emulator/test/unique_SUITE.erl @@ -20,9 +20,7 @@ -module(unique_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, init_per_suite/1, end_per_suite/1]). -export([unique_monotonic_integer_white_box/1, unique_integer_white_box/1]). @@ -33,25 +31,14 @@ -define(PRINT(V), print_ret_val(?FILE, ?LINE, V)). - -init_per_testcase(Case, Config) -> - ?line Dog=test_server:timetrap(test_server:minutes(2)), - [{watchdog, Dog}, {testcase, Case}|Config]. - -end_per_testcase(_, 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, 4}}]. all() -> [unique_monotonic_integer_white_box, unique_integer_white_box]. -groups() -> - []. - init_per_suite(Config) -> erts_debug:set_internal_state(available_internal_state, true), Config. @@ -60,12 +47,6 @@ end_per_suite(_Config) -> erts_debug:set_internal_state(available_internal_state, false), ok. -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %% %% %% Unique counter white box test case diff --git a/erts/emulator/test/z_SUITE.erl b/erts/emulator/test/z_SUITE.erl index 0037a9a477..3e32f56aeb 100644 --- a/erts/emulator/test/z_SUITE.erl +++ b/erts/emulator/test/z_SUITE.erl @@ -32,48 +32,20 @@ -include_lib("common_test/include/ct.hrl"). -%-compile(export_all). --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([schedulers_alive/1, node_container_refc_check/1, long_timers/1, pollset_size/1, check_io_debug/1, get_check_io_info/0]). --define(DEFAULT_TIMEOUT, ?t:minutes(5)). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 5}}]. all() -> [schedulers_alive, node_container_refc_check, long_timers, pollset_size, check_io_debug]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?t:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) when is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - %%% %%% The test cases ------------------------------------------------------------- %%% |