Skip to content

Commit

Permalink
Merge branch 'siri/cuddle-with-tests' into maint
Browse files Browse the repository at this point in the history
* siri/cuddle-with-tests:
  [reltool] Adapt tests to better quoting of paths on windows
  [reltool] Increase timetrap timeout to handle slow test machines
  Skip test when needed applications are missing
  Don't allow slave nodes to survive their test case
  • Loading branch information
sirihansen committed Apr 22, 2014
2 parents ed1c35e + 710a1fa commit 5ce2b65
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 21 deletions.
9 changes: 2 additions & 7 deletions lib/reltool/test/reltool_server_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2009-2013. All Rights Reserved.
%% Copyright Ericsson AB 2009-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -1205,14 +1205,9 @@ create_slim(Config) ->

RootDir = code:root_dir(),
Erl = filename:join([RootDir, "bin", "erl"]),
EscapedQuote =
case os:type() of
{win32,_} -> "\\\"";
_ -> "\""
end,
Args = ["-boot_var", "RELTOOL_EXT_LIB", TargetLibDir,
"-boot", filename:join(TargetRelVsnDir,RelName),
"-sasl", "releases_dir", EscapedQuote++TargetRelDir++EscapedQuote],
"-sasl", "releases_dir", "\""++TargetRelDir++"\""],
{ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl, Args)),
?msym(RootDir, rpc:call(Node, code, root_dir, [])),
wait_for_app(Node,sasl,50),
Expand Down
7 changes: 4 additions & 3 deletions lib/reltool/test/reltool_test_lib.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2009-2013. All Rights Reserved.
%% Copyright Ericsson AB 2009-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
Expand All @@ -20,12 +20,13 @@
-compile(export_all).

-include("reltool_test_lib.hrl").
-define(timeout, 20). % minutes

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

init_per_suite(Config) when is_list(Config)->
global:register_name(reltool_global_logger, group_leader()),
incr_timetrap(Config, 10).
incr_timetrap(Config, ?timeout).

end_per_suite(Config) when is_list(Config)->
global:unregister_name(reltool_global_logger),
Expand All @@ -51,7 +52,7 @@ set_kill_timer(Config) ->
Time =
case lookup_config(tc_timeout, Config) of
[] ->
timer:minutes(10);
timer:minutes(?timeout);
ConfigTime when is_integer(ConfigTime) ->
ConfigTime
end,
Expand Down
35 changes: 29 additions & 6 deletions lib/sasl/test/release_handler_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1410,18 +1410,41 @@ upgrade_supervisor_fail(Conf) when is_list(Conf) ->

{error,{code_change_failed,_Pid,a_sup,_Vsn,
{error,{invalid_shutdown,brutal_kil}}}} =
rpc:call(Node, release_handler, install_release, [RelVsn2]),

%% Check that the upgrade is terminated - normally this would mean
%% rollback, but since this testcase is very simplified the node
%% is not started with heart supervision and will therefore not be
%% restarted. So we just check that the node goes down.
rpc:call(Node, release_handler, install_release,
[RelVsn2, [{error_action,reboot}]]),

%% Check that the upgrade is terminated - normally this would be a
%% rollback, but
%%
%% 1. Default rollback is done with init:restart(), which does not
%% reboot the emulator, it only restarts the system inside the
%% running erlang node.
%%
%% 2. This does not work well on a slave node since, if timing is
%% right (bad), the slave node will get the nodedown from its
%% master (because distribution is terminated as part of
%% init:restart()) and then it will do halt() and thus never be
%% restarted (see slave:wloop/1)
%%
%% 3. Sometimes, though, init:restart() will manage to finish its
%% job before the nodedown is received, making the node
%% actually restart - in which case it might very well confuse
%% the next test case.
%%
%% 4. So, to avoid unstability we use {error_action,reboot} above,
%% to ensure that the node is actually stopped. Of course, in a
%% real system this must be used together with heart
%% supervision, and then the node will be restarted anyway. But
%% here in this simple test case we are satisfied to see that
%% the node terminates.
receive {nodedown,Node} -> ok
after 10000 -> ct:fail(failed_upgrade_never_restarted_node)
end,

ok.

upgrade_supervisor_fail(cleanup,_Condf) ->
stop_node(node_name(upgrade_supervisor_fail)).

%% Test upgrade and downgrade of applications
eval_appup(Conf) when is_list(Conf) ->
Expand Down
24 changes: 19 additions & 5 deletions lib/sasl/test/systools_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2012-2013. All Rights Reserved.
%% Copyright Ericsson AB 2012-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -1615,9 +1615,19 @@ no_sasl_relup(Config) when is_list(Config) ->

%% make_relup: Check that application start type is used in relup
app_start_type_relup(Config) when is_list(Config) ->
%% This might fail if some applications are not available, if so
%% skip the test case.
try create_script(latest_app_start_type2,Config) of
{Dir2,Name2} ->
app_start_type_relup(Dir2,Name2,Config)
catch throw:{error,Reason} ->
{skip,Reason}
end.

app_start_type_relup(Dir2,Name2,Config) ->
PrivDir = ?config(priv_dir, Config),
{Dir1,Name1} = create_script(latest_app_start_type1,Config),
{Dir2,Name2} = create_script(latest_app_start_type2,Config),

Release1 = filename:join(Dir1,Name1),
Release2 = filename:join(Dir2,Name2),

Expand Down Expand Up @@ -2242,9 +2252,13 @@ app_vsns(AppVsns) ->
[{App,app_vsn(App,Vsn)} || {App,Vsn} <- AppVsns] ++
[{App,app_vsn(App,Vsn),Type} || {App,Vsn,Type} <- AppVsns].
app_vsn(App,current) ->
application:load(App),
{ok,Vsn} = application:get_key(App,vsn),
Vsn;
case application:load(App) of
Ok when Ok==ok; Ok=={error,{already_loaded,App}} ->
{ok,Vsn} = application:get_key(App,vsn),
Vsn;
Error ->
throw(Error)
end;
app_vsn(_App,Vsn) ->
Vsn.

Expand Down

0 comments on commit 5ce2b65

Please sign in to comment.