diff options
author | Micael Karlberg <[email protected]> | 2019-06-05 14:13:43 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-06-25 13:41:46 +0200 |
commit | 5eb36b7782c0ce6ef100be8abcc893674a468af6 (patch) | |
tree | 1700722d4df8a5eb304fe87acad58c4eb77ad0a6 /lib | |
parent | b8d261c086fca4199047a72d9c60e4acb645330b (diff) | |
download | otp-5eb36b7782c0ce6ef100be8abcc893674a468af6.tar.gz otp-5eb36b7782c0ce6ef100be8abcc893674a468af6.tar.bz2 otp-5eb36b7782c0ce6ef100be8abcc893674a468af6.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')
-rw-r--r-- | lib/megaco/test/megaco_timer_test.erl | 19 |
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()). + |