From ddda2ac2b524c7bf4ae6a357faac4f73c20ebca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Mon, 21 Mar 2016 17:49:05 +0100 Subject: Modernize timetraps --- lib/erl_interface/test/ei_accept_SUITE.erl | 33 +++---------------------- lib/erl_interface/test/ei_connect_SUITE.erl | 37 ++++------------------------ lib/erl_interface/test/ei_tmo_SUITE.erl | 30 +++++----------------- lib/erl_interface/test/erl_connect_SUITE.erl | 35 +++++--------------------- lib/erl_interface/test/erl_eterm_SUITE.erl | 2 +- lib/erl_interface/test/erl_global_SUITE.erl | 24 +++++------------- lib/erl_interface/test/port_call_SUITE.erl | 26 ++++--------------- lib/erl_interface/test/runner.erl | 2 +- 8 files changed, 34 insertions(+), 155 deletions(-) diff --git a/lib/erl_interface/test/ei_accept_SUITE.erl b/lib/erl_interface/test/ei_accept_SUITE.erl index dae73c580f..b34dbd2728 100644 --- a/lib/erl_interface/test/ei_accept_SUITE.erl +++ b/lib/erl_interface/test/ei_accept_SUITE.erl @@ -24,43 +24,18 @@ -include_lib("common_test/include/ct.hrl"). -include("ei_accept_SUITE_data/ei_accept_test_cases.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, ei_accept/1, ei_threaded_accept/1]). -import(runner, [get_term/1,send_term/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> [ei_accept, ei_threaded_accept]. -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) -> - Dog = ?t:timetrap(?t:seconds(30)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - ei_accept(Config) when is_list(Config) -> P = runner:start(?interpret), 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0), diff --git a/lib/erl_interface/test/ei_connect_SUITE.erl b/lib/erl_interface/test/ei_connect_SUITE.erl index 59ffb8c9a5..c4b19c6523 100644 --- a/lib/erl_interface/test/ei_connect_SUITE.erl +++ b/lib/erl_interface/test/ei_connect_SUITE.erl @@ -24,11 +24,7 @@ -include_lib("common_test/include/ct.hrl"). -include("ei_connect_SUITE_data/ei_connect_test_cases.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, ei_send/1, ei_reg_send/1, ei_format_pid/1, @@ -36,41 +32,18 @@ rpc_test/1, ei_send_funs/1, ei_threaded_send/1, - ei_set_get_tracelevel/1 - ]). + ei_set_get_tracelevel/1]). -import(runner, [get_term/1,send_term/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> [ei_send, ei_reg_send, ei_rpc, ei_format_pid, ei_send_funs, ei_threaded_send, ei_set_get_tracelevel]. -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) -> - Dog = ?t:timetrap(?t:minutes(0.25)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - ei_send(Config) when is_list(Config) -> P = runner:start(?interpret), 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0), diff --git a/lib/erl_interface/test/ei_tmo_SUITE.erl b/lib/erl_interface/test/ei_tmo_SUITE.erl index bbaabb5c34..738f69cdbe 100644 --- a/lib/erl_interface/test/ei_tmo_SUITE.erl +++ b/lib/erl_interface/test/ei_tmo_SUITE.erl @@ -27,47 +27,29 @@ -define(dummy_host,test01). --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, framework_check/1, ei_accept_tmo/1, ei_connect_tmo/1, ei_send_tmo/1, ei_recv_tmo/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [framework_check, ei_accept_tmo, ei_connect_tmo, ei_send_tmo, ei_recv_tmo]. -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) -> - Dog = ?t:timetrap(?t:minutes(1)), % test if platform is vxworks_simso {_,Host} = split(node()), Bool = case atom_to_list(Host) of [$v,$x,$s,$i,$m | _] -> true; _ -> false end, - [{vxsim,Bool},{watchdog, Dog}|Config]. + [{vxsim,Bool}|Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. framework_check(doc) -> diff --git a/lib/erl_interface/test/erl_connect_SUITE.erl b/lib/erl_interface/test/erl_connect_SUITE.erl index c2554fbda2..9ed9293501 100644 --- a/lib/erl_interface/test/erl_connect_SUITE.erl +++ b/lib/erl_interface/test/erl_connect_SUITE.erl @@ -24,42 +24,19 @@ -include_lib("common_test/include/ct.hrl"). -include("erl_connect_SUITE_data/erl_connect_test_cases.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, - erl_send/1,erl_reg_send/1, erl_send_cookie_file/1]). +-export([all/0, suite/0, + erl_send/1, erl_reg_send/1, + erl_send_cookie_file/1]). -import(runner, [get_term/1,send_term/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. all() -> [erl_send, erl_reg_send, erl_send_cookie_file]. -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) -> - Dog = ?t:timetrap(?t:minutes(0.25)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. erl_send(Config) when is_list(Config) -> P = runner:start(?interpret), diff --git a/lib/erl_interface/test/erl_eterm_SUITE.erl b/lib/erl_interface/test/erl_eterm_SUITE.erl index 1410b79d73..666c2e12bf 100644 --- a/lib/erl_interface/test/erl_eterm_SUITE.erl +++ b/lib/erl_interface/test/erl_eterm_SUITE.erl @@ -988,7 +988,7 @@ collect_line(Port, Result) -> Chars -> collect_line(Port, Chars++Result) end - after test_server:seconds(5) -> + after 5000 -> test_server:fail("No response from C program") end. diff --git a/lib/erl_interface/test/erl_global_SUITE.erl b/lib/erl_interface/test/erl_global_SUITE.erl index e239c78040..955ffb6a9f 100644 --- a/lib/erl_interface/test/erl_global_SUITE.erl +++ b/lib/erl_interface/test/erl_global_SUITE.erl @@ -24,9 +24,9 @@ -include_lib("common_test/include/ct.hrl"). -include("erl_global_SUITE_data/erl_global_test_cases.hrl"). --export([all/0,suite/0,init_per_suite/1,end_per_suite/1, - init_per_testcase/2,end_per_testcase/2, - erl_global_registration/1, erl_global_whereis/1, erl_global_names/1]). +-export([all/0,suite/0, + erl_global_registration/1, + erl_global_whereis/1, erl_global_names/1]). -import(runner, [get_term/1,send_term/2]). @@ -35,22 +35,10 @@ all() -> [erl_global_registration, erl_global_whereis, erl_global_names]. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 30}}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?t:minutes(0.25)), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. erl_global_registration(Config) when is_list(Config) -> P = runner:start(?interpret), diff --git a/lib/erl_interface/test/port_call_SUITE.erl b/lib/erl_interface/test/port_call_SUITE.erl index 423e558b75..f4c7f10bb7 100644 --- a/lib/erl_interface/test/port_call_SUITE.erl +++ b/lib/erl_interface/test/port_call_SUITE.erl @@ -32,31 +32,18 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --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([all/0, suite/0, basic/1]). + % Private exports -include_lib("common_test/include/ct.hrl"). - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {seconds, 10}}]. 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(suite) -> []; basic(Config) when is_list(Config) -> @@ -73,7 +60,6 @@ basic(Config) when is_list(Config) -> end. do_basic(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), Path = ?config(data_dir, Config), erl_ddll:start(), @@ -105,8 +91,6 @@ do_basic(Config) -> {error, {already_started, _}} = erl_ddll:start(), ok = erl_ddll:stop(), - - test_server:timetrap_cancel(Dog), ok. load_port_call_driver(Path) -> diff --git a/lib/erl_interface/test/runner.erl b/lib/erl_interface/test/runner.erl index ae2598abf8..857923772a 100644 --- a/lib/erl_interface/test/runner.erl +++ b/lib/erl_interface/test/runner.erl @@ -25,7 +25,7 @@ start/1, send_term/2, finish/1, send_eot/1, recv_eot/1, get_term/1, get_term/2]). --define(default_timeout, test_server:seconds(5)). +-define(default_timeout, 5000). %% Executes a test case in a C program. %% -- cgit v1.2.3