aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/init_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/test/init_SUITE.erl')
-rw-r--r--lib/kernel/test/init_SUITE.erl432
1 files changed, 216 insertions, 216 deletions
diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl
index e4d658efb7..0fa97b585c 100644
--- a/lib/kernel/test/init_SUITE.erl
+++ b/lib/kernel/test/init_SUITE.erl
@@ -84,18 +84,18 @@ fini(Config) when is_list(Config) ->
get_arguments(Config) when is_list(Config) ->
Args = args(),
- ?line {ok, Node} = start_node(init_test, Args),
- ?line case rpc:call(Node, init, get_arguments, []) of
- Arguments when is_list(Arguments) ->
- stop_node(Node),
- check_a(Arguments),
- check_b(Arguments),
- check_c(Arguments),
- check_d(Arguments);
- _ ->
- stop_node(Node),
- ct:fail(get_arguments)
- end,
+ {ok, Node} = start_node(init_test, Args),
+ case rpc:call(Node, init, get_arguments, []) of
+ Arguments when is_list(Arguments) ->
+ stop_node(Node),
+ check_a(Arguments),
+ check_b(Arguments),
+ check_c(Arguments),
+ check_d(Arguments);
+ _ ->
+ stop_node(Node),
+ ct:fail(get_arguments)
+ end,
ok.
check_a(Args) ->
@@ -168,42 +168,42 @@ check_d(Args) ->
get_argument(Config) when is_list(Config) ->
Args = args(),
- ?line {ok, Node} = start_node(init_test, Args),
- ?line case rpc:call(Node, init, get_argument, [b]) of
- {ok, [["hej", "hopp"],["san", "sa"]]} ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail({get_argument, b})
- end,
- ?line case rpc:call(Node, init, get_argument, [a]) of
- {ok, [["kalle"]]} ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail({get_argument, a})
- end,
- ?line case rpc:call(Node, init, get_argument, [c]) of
- {ok, [["4", "5", "6"], ["7", "8", "9"]]} ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail({get_argument, c})
- end,
- ?line case rpc:call(Node, init, get_argument, [d]) of
- {ok, [[]]} ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail({get_argument, d})
- end,
- ?line case rpc:call(Node, init, get_argument, [e]) of
- error ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail({get_argument, e})
- end,
+ {ok, Node} = start_node(init_test, Args),
+ case rpc:call(Node, init, get_argument, [b]) of
+ {ok, [["hej", "hopp"],["san", "sa"]]} ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail({get_argument, b})
+ end,
+ case rpc:call(Node, init, get_argument, [a]) of
+ {ok, [["kalle"]]} ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail({get_argument, a})
+ end,
+ case rpc:call(Node, init, get_argument, [c]) of
+ {ok, [["4", "5", "6"], ["7", "8", "9"]]} ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail({get_argument, c})
+ end,
+ case rpc:call(Node, init, get_argument, [d]) of
+ {ok, [[]]} ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail({get_argument, d})
+ end,
+ case rpc:call(Node, init, get_argument, [e]) of
+ error ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail({get_argument, e})
+ end,
stop_node(Node),
ok.
@@ -218,16 +218,16 @@ get_plain_arguments(Config) when is_list(Config) ->
"fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2"
"fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2"
"fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2fjdkfjdkfjfdaa2",
- ?line true = (length(Longstring) > 255),
+ true = (length(Longstring) > 255),
Args = long_args(Longstring),
- ?line {ok, Node} = start_node(init_test, Args),
- ?line case rpc:call(Node, init, get_plain_arguments, []) of
- ["a", "b", "c", Longstring] ->
- ok;
- As ->
- stop_node(Node),
- ct:fail({get_argument, As})
- end,
+ {ok, Node} = start_node(init_test, Args),
+ case rpc:call(Node, init, get_plain_arguments, []) of
+ ["a", "b", "c", Longstring] ->
+ ok;
+ As ->
+ stop_node(Node),
+ ct:fail({get_argument, As})
+ end,
stop_node(Node),
ok.
@@ -240,16 +240,16 @@ boot_var(Config) when is_list(Config) ->
{BootScript, TEST_VAR, KernelVsn, StdlibVsn} = create_boot(Config),
%% Should fail as we have not given -boot_var TEST_VAR
- ?line {error, timeout} =
- start_node(init_test, "-boot " ++ BootScript),
+ {error, timeout} =
+ start_node(init_test, "-boot " ++ BootScript),
case is_real_system(KernelVsn, StdlibVsn) of
true ->
%% Now it should work !!
- ?line {ok, Node} =
- start_node(init_test,
- "-boot " ++ BootScript ++
- " -boot_var TEST_VAR " ++ TEST_VAR),
+ {ok, Node} =
+ start_node(init_test,
+ "-boot " ++ BootScript ++
+ " -boot_var TEST_VAR " ++ TEST_VAR),
stop_node(Node),
Res = ok;
_ ->
@@ -257,36 +257,36 @@ boot_var(Config) when is_list(Config) ->
%% for the boot var TEST_VAR to appear in the boot script, and it doesn't
%% if we give the 'local' option to systools:make_script.
io:format(
- "Test case not complete as we are not~n"
- "running in a real system!~n"
- "Probably this test is performed in a "
- "clearcase view or source tree.~n"
- "Need version numbers on the kernel and "
- "stdlib directories!~n",
- []),
+ "Test case not complete as we are not~n"
+ "running in a real system!~n"
+ "Probably this test is performed in a "
+ "clearcase view or source tree.~n"
+ "Need version numbers on the kernel and "
+ "stdlib directories!~n",
+ []),
Res = {skip,
- "Test case only partially run since it is run "
- "in a clearcase view or in a source tree. "
- "Need an installed system to complete this test."}
+ "Test case only partially run since it is run "
+ "in a clearcase view or in a source tree. "
+ "Need an installed system to complete this test."}
end,
Res.
create_boot(Config) ->
- ?line {ok, OldDir} = file:get_cwd(),
- ?line {LatestDir, LatestName, KernelVsn, StdlibVsn} =
+ {ok, OldDir} = file:get_cwd(),
+ {LatestDir, LatestName, KernelVsn, StdlibVsn} =
create_script(Config),
LibDir = code:lib_dir(),
- ?line ok = file:set_cwd(LatestDir),
- ?line ok = systools:make_script(LatestName,
- [{variables, [{"TEST_VAR", LibDir}]}]),
- ?line ok = file:set_cwd(OldDir),
+ ok = file:set_cwd(LatestDir),
+ ok = systools:make_script(LatestName,
+ [{variables, [{"TEST_VAR", LibDir}]}]),
+ ok = file:set_cwd(OldDir),
{LatestDir ++ "/" ++ LatestName, LibDir, KernelVsn, StdlibVsn}.
is_real_system(KernelVsn, StdlibVsn) ->
LibDir = code:lib_dir(),
filelib:is_dir(filename:join(LibDir, "kernel-"++KernelVsn)) andalso
filelib:is_dir(filename:join(LibDir, "stdlib-"++StdlibVsn)).
-
+
%% ------------------------------------------------
%% Slave executes erlang:halt() on master nodedown.
%% Therefore the slave process must be killed
@@ -296,55 +296,55 @@ many_restarts() ->
[{timetrap,{minutes,8}}].
many_restarts(Config) when is_list(Config) ->
- ?line {ok, Node} = loose_node:start(init_test, "", ?DEFAULT_TIMEOUT_SEC),
- ?line loop_restart(30,Node,rpc:call(Node,erlang,whereis,[error_logger])),
- ?line loose_node:stop(Node),
+ {ok, Node} = loose_node:start(init_test, "", ?DEFAULT_TIMEOUT_SEC),
+ loop_restart(30,Node,rpc:call(Node,erlang,whereis,[error_logger])),
+ loose_node:stop(Node),
ok.
loop_restart(0,_,_) ->
ok;
loop_restart(N,Node,EHPid) ->
- ?line erlang:monitor_node(Node, true),
- ?line ok = rpc:call(Node, init, restart, []),
- ?line receive
- {nodedown, Node} ->
- ok
- after 10000 ->
- loose_node:stop(Node),
- ct:fail(not_stopping)
- end,
- ?line ok = wait_for(30, Node, EHPid),
- ?line loop_restart(N-1,Node,rpc:call(Node,erlang,whereis,[error_logger])).
+ erlang:monitor_node(Node, true),
+ ok = rpc:call(Node, init, restart, []),
+ receive
+ {nodedown, Node} ->
+ ok
+ after 10000 ->
+ loose_node:stop(Node),
+ ct:fail(not_stopping)
+ end,
+ ok = wait_for(30, Node, EHPid),
+ loop_restart(N-1,Node,rpc:call(Node,erlang,whereis,[error_logger])).
wait_for(0,Node,_) ->
loose_node:stop(Node),
error;
wait_for(N,Node,EHPid) ->
- ?line case rpc:call(Node, erlang, whereis, [error_logger]) of
+ case rpc:call(Node, erlang, whereis, [error_logger]) of
Pid when is_pid(Pid), Pid =/= EHPid ->
- %% ?line erlang:display(ok),
- ?line ok;
+ %% erlang:display(ok),
+ ok;
_X ->
- %% ?line erlang:display(_X),
- %% ?line Procs = rpc:call(Node, erlang, processes, []),
- %% ?line erlang:display(Procs),
- %% case is_list(Procs) of
- %% true ->
- %% ?line [(catch erlang:display(
- %% rpc:call(Node,
- %% erlang,
- %% process_info,
- %% [Y,registered_name])))
- %% || Y <- Procs];
- %% _ ->
- %% ok
- %% end,
- receive
- after 100 ->
- ok
- end,
- ?line wait_for(N-1,Node,EHPid)
- end.
+ %% erlang:display(_X),
+ %% Procs = rpc:call(Node, erlang, processes, []),
+ %% erlang:display(Procs),
+ %% case is_list(Procs) of
+ %% true ->
+ %% [(catch erlang:display(
+ %% rpc:call(Node,
+ %% erlang,
+ %% process_info,
+ %% [Y,registered_name])))
+ %% || Y <- Procs];
+ %% _ ->
+ %% ok
+ %% end,
+ receive
+ after 100 ->
+ ok
+ end,
+ wait_for(N-1,Node,EHPid)
+ end.
%% ------------------------------------------------
%% Slave executes erlang:halt() on master nodedown.
@@ -352,56 +352,56 @@ wait_for(N,Node,EHPid) ->
%% before restart.
%% ------------------------------------------------
restart(Config) when is_list(Config) ->
- ?line Args = args(),
+ Args = args(),
%% Currently test_server:start_node cannot be used. The restarted
%% node immediately halts due to the implementation of
%% test_server:start_node.
- ?line {ok, Node} = loose_node:start(init_test, Args, ?DEFAULT_TIMEOUT_SEC),
+ {ok, Node} = loose_node:start(init_test, Args, ?DEFAULT_TIMEOUT_SEC),
%% Ok, the node is up, now the real test test begins.
- ?line erlang:monitor_node(Node, true),
- ?line InitPid = rpc:call(Node, erlang, whereis, [init]),
- ?line PurgerPid = rpc:call(Node, erlang, whereis, [erts_code_purger]),
- ?line Procs = rpc:call(Node, erlang, processes, []),
- ?line MaxPid = lists:last(Procs),
- ?line ok = rpc:call(Node, init, restart, []),
- ?line receive
- {nodedown, Node} ->
- ok
- after 10000 ->
- loose_node:stop(Node),
- ct:fail(not_stopping)
- end,
- ?line ok = wait_restart(30, Node),
+ erlang:monitor_node(Node, true),
+ InitPid = rpc:call(Node, erlang, whereis, [init]),
+ PurgerPid = rpc:call(Node, erlang, whereis, [erts_code_purger]),
+ Procs = rpc:call(Node, erlang, processes, []),
+ MaxPid = lists:last(Procs),
+ ok = rpc:call(Node, init, restart, []),
+ receive
+ {nodedown, Node} ->
+ ok
+ after 10000 ->
+ loose_node:stop(Node),
+ ct:fail(not_stopping)
+ end,
+ ok = wait_restart(30, Node),
%% Still the same init process!
- ?line InitPid1 = rpc:call(Node, erlang, whereis, [init]),
+ InitPid1 = rpc:call(Node, erlang, whereis, [init]),
InitP = pid_to_list(InitPid),
- ?line InitP = pid_to_list(InitPid1),
+ InitP = pid_to_list(InitPid1),
%% and same purger process!
- ?line PurgerPid1 = rpc:call(Node, erlang, whereis, [erts_code_purger]),
+ PurgerPid1 = rpc:call(Node, erlang, whereis, [erts_code_purger]),
PurgerP = pid_to_list(PurgerPid),
- ?line PurgerP = pid_to_list(PurgerPid1),
+ PurgerP = pid_to_list(PurgerPid1),
- ?line NewProcs0 = rpc:call(Node, erlang, processes, []),
+ NewProcs0 = rpc:call(Node, erlang, processes, []),
NewProcs = NewProcs0 -- [InitPid1, PurgerPid1],
- ?line case check_processes(NewProcs, MaxPid) of
- true ->
- ok;
- _ ->
- loose_node:stop(Node),
- ct:fail(processes_not_greater)
- end,
+ case check_processes(NewProcs, MaxPid) of
+ true ->
+ ok;
+ _ ->
+ loose_node:stop(Node),
+ ct:fail(processes_not_greater)
+ end,
%% Test that, for instance, the same argument still exists.
- ?line case rpc:call(Node, init, get_argument, [c]) of
- {ok, [["4", "5", "6"], ["7", "8", "9"]]} ->
- ok;
- _ ->
- loose_node:stop(Node),
- ct:fail({get_argument, restart_fail})
- end,
+ case rpc:call(Node, init, get_argument, [c]) of
+ {ok, [["4", "5", "6"], ["7", "8", "9"]]} ->
+ ok;
+ _ ->
+ loose_node:stop(Node),
+ ct:fail({get_argument, restart_fail})
+ end,
loose_node:stop(Node),
ok.
@@ -441,24 +441,24 @@ apid(Pid) ->
%% ------------------------------------------------
reboot(Config) when is_list(Config) ->
Args = args(),
- ?line {ok, Node} = start_node(init_test, Args),
+ {ok, Node} = start_node(init_test, Args),
erlang:monitor_node(Node, true),
- ?line ok = rpc:call(Node, init, reboot, []),
- ?line receive
- {nodedown, Node} ->
- ok
- after 10000 ->
- stop_node(Node),
- ct:fail(not_stopping)
- end,
+ ok = rpc:call(Node, init, reboot, []),
+ receive
+ {nodedown, Node} ->
+ ok
+ after 10000 ->
+ stop_node(Node),
+ ct:fail(not_stopping)
+ end,
ct:sleep(5000),
- ?line case net_adm:ping(Node) of
- pang ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail(system_rebooted)
- end,
+ case net_adm:ping(Node) of
+ pang ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail(system_rebooted)
+ end,
ok.
%% ------------------------------------------------
@@ -466,53 +466,53 @@ reboot(Config) when is_list(Config) ->
%% ------------------------------------------------
stop(Config) when is_list(Config) ->
Args = args(),
- ?line {ok, Node} = start_node(init_test, Args),
+ {ok, Node} = start_node(init_test, Args),
erlang:monitor_node(Node, true),
- ?line ok = rpc:call(Node, init, reboot, []),
- ?line receive
- {nodedown, Node} ->
- ok
- after 10000 ->
- stop_node(Node),
- ct:fail(not_stopping)
- end,
+ ok = rpc:call(Node, init, reboot, []),
+ receive
+ {nodedown, Node} ->
+ ok
+ after 10000 ->
+ stop_node(Node),
+ ct:fail(not_stopping)
+ end,
ct:sleep(5000),
- ?line case net_adm:ping(Node) of
- pang ->
- ok;
- _ ->
- stop_node(Node),
- ct:fail(system_rebooted)
- end,
+ case net_adm:ping(Node) of
+ pang ->
+ ok;
+ _ ->
+ stop_node(Node),
+ ct:fail(system_rebooted)
+ end,
ok.
%% ------------------------------------------------
%%
%% ------------------------------------------------
get_status(Config) when is_list(Config) ->
- ?line {Start, _} = init:get_status(),
+ {Start, _} = init:get_status(),
%% Depending on how the test_server is started Start has
%% different values. staring if test_server started with
%% -s flag.
- ?line case lists:member(Start, [started, starting]) of
- true ->
- ok;
- _ ->
- ct:fail(get_status)
- end.
+ case lists:member(Start, [started, starting]) of
+ true ->
+ ok;
+ _ ->
+ ct:fail(get_status)
+ end.
%% ------------------------------------------------
%%
%% ------------------------------------------------
script_id(Config) when is_list(Config) ->
- ?line {Name, Vsn} = init:script_id(),
- ?line if
- is_list(Name), is_list(Vsn) ->
- ok;
- true ->
- ct:fail(not_standard_script)
- end,
+ {Name, Vsn} = init:script_id(),
+ if
+ is_list(Name), is_list(Vsn) ->
+ ok;
+ true ->
+ ct:fail(not_standard_script)
+ end,
ok.
%% ------------------------------------------------
@@ -521,12 +521,12 @@ script_id(Config) when is_list(Config) ->
boot1(Config) when is_list(Config) ->
Args = args() ++ " -boot start_sasl",
- ?line {ok, Node} = start_node(init_test, Args),
- ?line stop_node(Node),
+ {ok, Node} = start_node(init_test, Args),
+ stop_node(Node),
%% Try to start with non existing boot file.
Args1 = args() ++ " -boot dummy_script",
- ?line {error, timeout} = start_node(init_test, Args1),
+ {error, timeout} = start_node(init_test, Args1),
ok.
@@ -543,9 +543,9 @@ boot2(Config) when is_list(Config) ->
%% Absolute boot file name for Windows -- all slashes are
%% converted to backslashes.
Win_boot = lists:map(fun
- ($/) -> $\\;
- (C) -> C
- end, Boot),
+ ($/) -> $\\;
+ (C) -> C
+ end, Boot),
Args2 = args() ++ " -boot \"" ++ Win_boot ++ "\"",
{ok, Node2} = start_node(init_test, Args2),
stop_node(Node2);
@@ -578,17 +578,17 @@ long_args(A) ->
create_script(Config) ->
PrivDir = proplists:get_value(priv_dir,Config),
- ?line Name = PrivDir ++ "boot_var_test",
- ?line Apps = application_controller:which_applications(),
- ?line {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps),
- ?line {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps),
- ?line {ok,Fd} = file:open(Name ++ ".rel", [write]),
- ?line io:format(Fd,
- "{release, {\"Test release 3\", \"P2A\"}, \n"
- " {erts, \"4.4\"}, \n"
- " [{kernel, \"~s\"}, {stdlib, \"~s\"}]}.\n",
- [KernelVer,StdlibVer]),
- ?line file:close(Fd),
+ Name = PrivDir ++ "boot_var_test",
+ Apps = application_controller:which_applications(),
+ {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps),
+ {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps),
+ {ok,Fd} = file:open(Name ++ ".rel", [write]),
+ io:format(Fd,
+ "{release, {\"Test release 3\", \"P2A\"}, \n"
+ " {erts, \"4.4\"}, \n"
+ " [{kernel, \"~s\"}, {stdlib, \"~s\"}]}.\n",
+ [KernelVer,StdlibVer]),
+ file:close(Fd),
{filename:dirname(Name), filename:basename(Name),
- KernelVer, StdlibVer}.
+ KernelVer, StdlibVer}.