diff options
author | Micael Karlberg <[email protected]> | 2019-06-05 12:43:23 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-06-25 13:41:46 +0200 |
commit | 658c3ca4cf9db59fdb25e80b756509727ebf554a (patch) | |
tree | 02e651bc601ab003885fcb94ec3613d4f2419fdc /lib/megaco/test/megaco_test_lib.erl | |
parent | 09abac433a59f0644316a54f61ade7132db673d1 (diff) | |
download | otp-658c3ca4cf9db59fdb25e80b756509727ebf554a.tar.gz otp-658c3ca4cf9db59fdb25e80b756509727ebf554a.tar.bz2 otp-658c3ca4cf9db59fdb25e80b756509727ebf554a.zip |
[megaco|test] Improving the example and mib test suites
The examples test suite was hard to debug just based
on its output (both plain debug printouts and printouts
generated via dbg). Some timeouts has been added between
the various actions so that it will be easier to understand
the output.
Diffstat (limited to 'lib/megaco/test/megaco_test_lib.erl')
-rw-r--r-- | lib/megaco/test/megaco_test_lib.erl | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 3934a3a957..5fe03b28e3 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. +%% Copyright Ericsson AB 1999-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -26,7 +26,46 @@ -module(megaco_test_lib). --compile(export_all). +%% -compile(export_all). + +-export([ + log/4, + error/3, + + sleep/1, + hours/1, minutes/1, seconds/1, + formated_timestamp/0, format_timestamp/1, + + skip/3, + non_pc_tc_maybe_skip/4, + os_based_skip/1, + + flush/0, + still_alive/1, + watchdog/2, + + display_alloc_info/0, + display_system_info/1, display_system_info/2, display_system_info/3, + + tickets/1, + prepare_test_case/5, + + t/1, + groups/1, + init_suite/2, + end_suite/2, + init_group/3, + end_group/3, + t/2, + init_per_testcase/2, + end_per_testcase/2, + + proxy_start/1, proxy_start/2, + + start_nodes/3 + ]). + +-export([do_eval/4, proxy_init/2]). -include("megaco_test_lib.hrl"). @@ -53,6 +92,13 @@ minutes(N) -> trunc(N * 1000 * 60). seconds(N) -> trunc(N * 1000). +formated_timestamp() -> + format_timestamp(os:timestamp()). + +format_timestamp(TS) -> + megaco:format_timestamp(TS). + + %% ---------------------------------------------------------------- %% Conditional skip of testcases %% @@ -367,7 +413,7 @@ eval(Mod, Fun, Config) -> Flag = process_flag(trap_exit, true), put(megaco_test_server, true), Config2 = Mod:init_per_testcase(Fun, Config), - Pid = spawn_link(?MODULE, do_eval, [self(), Mod, Fun, Config2]), + Pid = spawn_link(fun() -> do_eval(self(), Mod, Fun, Config2) end), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), Mod:end_per_testcase(Fun, Config2), erase(megaco_test_server), @@ -837,7 +883,7 @@ reset_kill_timer(Config) -> end. watchdog(Pid, Time) -> - erlang:now(), + _ = os:timestamp(), receive stop -> ok |