diff options
Diffstat (limited to 'lib/kernel/test/kernel_config_SUITE.erl')
-rw-r--r-- | lib/kernel/test/kernel_config_SUITE.erl | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/lib/kernel/test/kernel_config_SUITE.erl b/lib/kernel/test/kernel_config_SUITE.erl index 4be44015c9..9207025a2c 100644 --- a/lib/kernel/test/kernel_config_SUITE.erl +++ b/lib/kernel/test/kernel_config_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2018. 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. @@ -19,13 +19,15 @@ %% -module(kernel_config_SUITE). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, sync/1]). -export([init_per_suite/1, end_per_suite/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [sync]. @@ -40,13 +42,9 @@ end_per_group(_GroupName, Config) -> Config. -init_per_suite(doc) -> []; -init_per_suite(suite) -> []; init_per_suite(Config) when is_list(Config) -> Config. -end_per_suite(doc) -> []; -end_per_suite(suite) -> []; end_per_suite(Config) when is_list(Config) -> stop_node(init_test), Config. @@ -54,7 +52,7 @@ end_per_suite(Config) when is_list(Config) -> config(Fd) -> M = from($@, atom_to_list(node())), io:format(Fd, "[{kernel, [{sync_nodes_optional, ['cp1@~s','cp2@~s']}," - "{sync_nodes_timeout, 15000}]}].~n", + "{sync_nodes_timeout, 15000}]}].~n", [M, M]). from(H, [H | T]) -> T; @@ -67,12 +65,9 @@ from(_, []) -> []. %% Should be started in a CC view with: %% erl -sname XXX where XX not in [cp1, cp2] %%----------------------------------------------------------------- -sync(doc) -> []; -sync(suite) -> []; sync(Conf) when is_list(Conf) -> - ?line Dog = ?t:timetrap(?t:seconds(120)), - % Write a config file - Dir = ?config(priv_dir,Conf), + %% Write a config file + Dir = proplists:get_value(priv_dir,Conf), {ok, Fd} = file:open(Dir ++ "sys.config", [write]), config(Fd), file:close(Fd), @@ -81,34 +76,33 @@ sync(Conf) when is_list(Conf) -> %% Reset wall_clock {T1,_} = erlang:statistics(wall_clock), io:format("~p~n", [{t1, T1}]), - ?line Command = lists:concat([lib:progname(), - " -detached -sname cp1 ", - "-config ", Config, - " -env ERL_CRASH_DUMP erl_crash_dump.cp1"]), + Command = lists:append([ct:get_progname(), + " -detached -sname cp1 ", + "-config ", Config, + " -env ERL_CRASH_DUMP erl_crash_dump.cp1"]), io:format("Command: ~s", [Command]), - ?line open_port({spawn, Command}, [stream]), + open_port({spawn, Command}, [stream]), io:format("started~n"), - ?line ?t:sleep(12000), + ct:sleep(12000), io:format("waited12~n"), - ?line Host = from($@, atom_to_list(node())), - ?line Cp1 = list_to_atom("cp1@"++Host), - ?line wait_for_node(Cp1), + Host = from($@, atom_to_list(node())), + Cp1 = list_to_atom("cp1@"++Host), + wait_for_node(Cp1), io:format("waitednode~n"), %% Check time since last call - ?line {TT, T} = erlang:statistics(wall_clock), + {TT, T} = erlang:statistics(wall_clock), io:format("~p~n", [{t2, {TT, T}}]), - ?line stop_node(cp1), + stop_node(cp1), if - TT-T1 < 15000 -> ?line ?t:fail({too_short_time, TT-T1}); + TT-T1 < 15000 -> ct:fail({too_short_time, TT-T1}); true -> ok end, - ?line ?t:timetrap_cancel(Dog), ok. wait_for_node(Node) -> case rpc:call(Node, init, get_status, []) of {started,_} -> ok; - {badrpc, R} -> ?line ?t:fail({rpc_failed, R}); + {badrpc, R} -> ct:fail({rpc_failed, R}); _Other -> wait_for_node(Node) end. |