aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco/test
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-06-05 14:13:43 +0200
committerMicael Karlberg <[email protected]>2019-07-01 18:01:56 +0200
commitd96df449f8232c33dff837b13a5f706390301b71 (patch)
treee22f5de05ced7fc50239abb2d09fccfdb10789d5 /lib/megaco/test
parent0bedccba51a2e19f3c7eadb7a8712c2758daa0a2 (diff)
downloadotp-d96df449f8232c33dff837b13a5f706390301b71.tar.gz
otp-d96df449f8232c33dff837b13a5f706390301b71.tar.bz2
otp-d96df449f8232c33dff837b13a5f706390301b71.zip
[megaco|test] Timer test suite improvements
We did not check the actual result of the timer cancel operation before continuing, which seems to cause problems on some platforms (where the timer may actually expire even though we have 100 ms to cancel). So now we check the cancel result, and if we did not succeed, we instead skip the test case.
Diffstat (limited to 'lib/megaco/test')
-rw-r--r--lib/megaco/test/megaco_timer_test.erl19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl
index 34479f7838..b60e8581cd 100644
--- a/lib/megaco/test/megaco_timer_test.erl
+++ b/lib/megaco/test/megaco_timer_test.erl
@@ -359,7 +359,12 @@ integer_timer_start_and_stop(Config) when is_list(Config) ->
{timeout, Timeout} ->
error(bad_timeout)
after Timeout - 100 ->
- tmr_stop(Ref)
+ case tmr_stop(Ref) of
+ ok ->
+ ok;
+ CancelRes ->
+ ?SKIP({cancel_failed, CancelRes})
+ end
end,
%% Make sure it does not reach us after we attempted to stop it.
@@ -446,13 +451,5 @@ print(Prefix, F, A) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
formated_timestamp() ->
- format_timestamp(now()).
-
-format_timestamp({_N1, _N2, N3} = Now) ->
- {Date, Time} = calendar:now_to_datetime(Now),
- {YYYY,MM,DD} = Date,
- {Hour,Min,Sec} = Time,
- FormatDate =
- io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w",
- [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]),
- lists:flatten(FormatDate).
+ megaco:format_timestamp(os:timestamp()).
+