From a219c06f31e082449a1e001c051661370fa00a5d Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 11 Mar 2015 09:41:11 +0100 Subject: Replace all calls to now/0 in CT with new time API functions --- .../cth/tests/ct_update_config_SUITE.erl | 8 +++++--- .../ct_hooks_SUITE_data/cth/tests/empty_cth.erl | 2 +- .../cth/tests/update_config_cth.erl | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'lib/common_test/test/ct_hooks_SUITE_data/cth/tests') diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl index 3c1f5669e8..f8c8725602 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl @@ -26,21 +26,23 @@ -include("ct.hrl"). +-define(now, os:timestamp()). + %% Test server callback functions init_per_suite(Config) -> - [{init_per_suite,now()}|Config]. + [{init_per_suite,?now}|Config]. end_per_suite(_Config) -> ok. init_per_testcase(_TestCase, Config) -> - [{init_per_testcase,now()}|Config]. + [{init_per_testcase,?now}|Config]. end_per_testcase(_TestCase, _Config) -> ok. init_per_group(GroupName, Config) -> - [{init_per_group,now()}|Config]. + [{init_per_group,?now}|Config]. end_per_group(GroupName, Config) -> ok. diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl index 6caac7e447..615d33f7b1 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl @@ -85,7 +85,7 @@ init(Id, Opts) -> id(Opts) -> gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(), data = {?MODULE, id, [Opts]}}), - now(). + os:timestamp(). %% @doc Called before init_per_suite is called. Note that this callback is %% only called if the CTH is added before init_per_suite is run (eg. in a test diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl index 2ee0d7da9c..55a1b9a130 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl @@ -24,6 +24,7 @@ -include_lib("common_test/src/ct_util.hrl"). -include_lib("common_test/include/ct_event.hrl"). +-define(now, os:timestamp()). %% CT Hooks -compile(export_all). @@ -33,44 +34,44 @@ init(Id, Opts) -> pre_init_per_suite(Suite, Config, State) -> empty_cth:pre_init_per_suite(Suite,Config,State), - {[{pre_init_per_suite,now()}|Config],State}. + {[{pre_init_per_suite,?now}|Config],State}. post_init_per_suite(Suite,Config,Return,State) -> empty_cth:post_init_per_suite(Suite,Config,Return,State), - {[{post_init_per_suite,now()}|Return],State}. + {[{post_init_per_suite,?now}|Return],State}. pre_end_per_suite(Suite,Config,State) -> empty_cth:pre_end_per_suite(Suite,Config,State), - {[{pre_end_per_suite,now()}|Config],State}. + {[{pre_end_per_suite,?now}|Config],State}. post_end_per_suite(Suite,Config,Return,State) -> empty_cth:post_end_per_suite(Suite,Config,Return,State), - NewConfig = [{post_end_per_suite,now()}|Config], + NewConfig = [{post_end_per_suite,?now}|Config], {NewConfig,NewConfig}. pre_init_per_group(Group,Config,State) -> empty_cth:pre_init_per_group(Group,Config,State), - {[{pre_init_per_group,now()}|Config],State}. + {[{pre_init_per_group,?now}|Config],State}. post_init_per_group(Group,Config,Return,State) -> empty_cth:post_init_per_group(Group,Config,Return,State), - {[{post_init_per_group,now()}|Return],State}. + {[{post_init_per_group,?now}|Return],State}. pre_end_per_group(Group,Config,State) -> empty_cth:pre_end_per_group(Group,Config,State), - {[{pre_end_per_group,now()}|Config],State}. + {[{pre_end_per_group,?now}|Config],State}. post_end_per_group(Group,Config,Return,State) -> empty_cth:post_end_per_group(Group,Config,Return,State), - {[{post_end_per_group,now()}|Config],State}. + {[{post_end_per_group,?now}|Config],State}. pre_init_per_testcase(TC,Config,State) -> empty_cth:pre_init_per_testcase(TC,Config,State), - {[{pre_init_per_testcase,now()}|Config],State}. + {[{pre_init_per_testcase,?now}|Config],State}. post_end_per_testcase(TC,Config,Return,State) -> empty_cth:post_end_per_testcase(TC,Config,Return,State), - {[{post_end_per_testcase,now()}|Config],State}. + {[{post_end_per_testcase,?now}|Config],State}. on_tc_fail(TC, Reason, State) -> empty_cth:on_tc_fail(TC,Reason,State). -- cgit v1.2.3