From 6afac8386a0feefab34126997a064a631af8b40a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 25 Jun 2019 12:57:03 +0200 Subject: [megaco|test] Attempt to avoid race on slow VMs --- lib/megaco/test/megaco_examples_test.erl | 2 +- lib/megaco/test/megaco_mib_test.erl | 4 ++-- lib/megaco/test/megaco_test_lib.hrl | 3 ++- lib/megaco/test/megaco_timer_test.erl | 11 ++--------- 4 files changed, 7 insertions(+), 13 deletions(-) (limited to 'lib/megaco/test') diff --git a/lib/megaco/test/megaco_examples_test.erl b/lib/megaco/test/megaco_examples_test.erl index 815e315c27..10ca0375f6 100644 --- a/lib/megaco/test/megaco_examples_test.erl +++ b/lib/megaco/test/megaco_examples_test.erl @@ -357,6 +357,6 @@ d(F, A) -> d(get(dbg), F, A). d(true, F, A) -> - io:format("DBG: ~s " ++ F ++ "~n", [?FT() | A]); + io:format("DBG: ~s " ++ F ++ "~n", [?FTS() | A]); d(_, _F, _A) -> ok. diff --git a/lib/megaco/test/megaco_mib_test.erl b/lib/megaco/test/megaco_mib_test.erl index a19e2acbd1..06ac7c08ed 100644 --- a/lib/megaco/test/megaco_mib_test.erl +++ b/lib/megaco/test/megaco_mib_test.erl @@ -1714,7 +1714,7 @@ print(Severity, Verbosity, P, F, A) -> print(printable(Severity,Verbosity), P, F, A). print(true, P, F, A) -> - io:format("~s~p:~s:~s: " ++ F ++ "~n", [P, self(), get(sname), ?FT() | A]); + io:format("~s~p:~s:~s: " ++ F ++ "~n", [P, self(), get(sname), ?FTS() | A]); print(_, _, _, _) -> ok. @@ -1723,7 +1723,7 @@ progress(F) -> progress(F, []). progress(F, A) -> - io:format(user, "~s " ++ F ++ "~n", [?FT()|A]). + io:format(user, "~s " ++ F ++ "~n", [?FTS()|A]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_test_lib.hrl b/lib/megaco/test/megaco_test_lib.hrl index 19103c0a79..409f8d52e5 100644 --- a/lib/megaco/test/megaco_test_lib.hrl +++ b/lib/megaco/test/megaco_test_lib.hrl @@ -85,4 +85,5 @@ -define(HOURS(T), megaco_test_lib:hours(T)). -define(MINUTES(T), megaco_test_lib:minutes(T)). -define(SECONDS(T), megaco_test_lib:seconds(T)). --define(FT(), megaco_test_lib:formated_timestamp()). +-define(FTS(), megaco:format_timestamp(erlang:timestamp())). + diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl index b60e8581cd..d3e8e27636 100644 --- a/lib/megaco/test/megaco_timer_test.erl +++ b/lib/megaco/test/megaco_timer_test.erl @@ -332,7 +332,7 @@ integer_timer_start_and_expire(Config) when is_list(Config) -> receive {timeout, Timeout} -> ok - after Timeout + 100 -> + after Timeout + 500 -> tmr_stop(Ref), error(no_timeout) end, @@ -443,13 +443,6 @@ print1(_, _, _, _) -> print(Prefix, F, A) -> io:format("*** [~s] ~s ~p ~s:~w ***" "~n " ++ F ++ "~n", - [formated_timestamp(), Prefix, self(), get(sname), get(tc) | A]). + [?FTS(), Prefix, self(), get(sname), get(tc) | A]). - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -formated_timestamp() -> - megaco:format_timestamp(os:timestamp()). -- cgit v1.2.3