aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/test/release_handler_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sasl/test/release_handler_SUITE.erl')
-rw-r--r--lib/sasl/test/release_handler_SUITE.erl118
1 files changed, 90 insertions, 28 deletions
diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl
index a8e3cc3d88..a56924d5ca 100644
--- a/lib/sasl/test/release_handler_SUITE.erl
+++ b/lib/sasl/test/release_handler_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2011-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2011-2013. 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
@@ -63,7 +63,8 @@ cases() ->
instructions, eval_appup, eval_appup_with_restart,
supervisor_which_children_timeout,
release_handler_which_releases, install_release_syntax_check,
- upgrade_supervisor, upgrade_supervisor_fail, otp_9864].
+ upgrade_supervisor, upgrade_supervisor_fail, otp_9864,
+ otp_10463_upgrade_script_regexp].
groups() ->
[{release,[],
@@ -937,7 +938,7 @@ otp_9417(cleanup,_Conf) ->
%% OTP-9395 - performance problems when there are MANY processes
%% Test that the procedure of checking for old code before an upgrade
-%% can be started is "very much faster" when there is no old code in
+%% can be started is faster when there is no old code in
%% the system.
otp_9395_check_old_code(Conf) when is_list(Conf) ->
@@ -977,8 +978,8 @@ otp_9395_check_old_code(Conf) when is_list(Conf) ->
"\tAfter purge: ~.2f sec~n"
"\tT1/T2: ~.2f",
[NProcs,length(Modules),T1/1000000,T2/1000000,X]),
- if X < 1000 ->
- ct:fail({not_enough_improvement_after_purge,round(X)});
+ if X < 1 ->
+ ct:fail({no_improvement_after_purge,X});
true ->
ok
end;
@@ -1093,9 +1094,11 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) ->
[RelVsn2, filename:join(Rel2Dir, "sys.config")]),
%% First, install release directly and check how much time it takes
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]),
{TInst0,{ok, _, []}} =
timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]),
- ct:log("install_release: ~.2f",[TInst0/1000000]),
+ SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]),
+% ct:log("install_release: ~.2f",[TInst0/1000000]),
%% Restore to old release, spawn processes again and load to get old code
{_,RelVsn1} = init:script_id(),
@@ -1109,18 +1112,35 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) ->
true = rpc:call(Node,erlang,check_old_code,[m10]),
%% Run check_install_release with purge before install this time
- {TCheck,{ok, _RelVsn1, []}} =
+ {_TCheck,{ok, _RelVsn1, []}} =
timer:tc(rpc,call,[Node, release_handler, check_install_release,
[RelVsn2,[purge]]]),
- ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]),
+% ct:log("check_install_release with purge: ~.2f",[_TCheck/1000000]),
%% Finally install release after check and purge, and check that
%% this install was faster than the first.
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]),
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]),
{TInst2,{ok, _RelVsn1, []}} =
timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]),
- ct:log("install_release: ~.2f",[TInst2/1000000]),
-
- true = (TInst2 < TInst0),
+ SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]),
+% ct:log("install_release: ~.2f",[TInst2/1000000]),
+
+ %% Calculate and print real time and CPU utilization
+ SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end,
+ {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0),
+ {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2),
+ TI0=TInst0/1000000,
+ TI2=TInst2/1000000,
+ CPU0=SumA0/SumT0,
+ CPU2=SumA2/SumT2,
+ X0 = TI0*CPU0,
+ X2 = TI2*CPU2,
+ ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n"
+ "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n",
+ [TI0, CPU0, X0, TI2, CPU2, X2]),
+
+ true = (X2 =< X0), % disregarding wait time for file access etc.
ok.
@@ -1171,9 +1191,11 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) ->
[RelVsn2, filename:join(Rel2Dir, "sys.config")]),
%% First, install release directly and check how much time it takes
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]),
{TInst0,{ok, _, []}} =
timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]),
- ct:log("install_release: ~.2f",[TInst0/1000000]),
+ SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]),
+% ct:log("install_release: ~.2f",[TInst0/1000000]),
%% Restore to old release, spawn processes again and load to get old code
{_,RelVsn1} = init:script_id(),
@@ -1187,18 +1209,35 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) ->
true = rpc:call(Node,erlang,check_old_code,[m10]),
%% Run check_install_release with purge before install this time
- {TCheck,{ok, _RelVsn1, []}} =
+ {_TCheck,{ok, _RelVsn1, []}} =
timer:tc(rpc,call,[Node, release_handler, check_install_release,
[RelVsn2,[purge]]]),
- ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]),
+% ct:log("check_install_release with purge: ~.2f",[_TCheck/1000000]),
%% Finally install release after check and purge, and check that
%% this install was faster than the first.
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]),
+ rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]),
{TInst2,{ok, _RelVsn1, []}} =
timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]),
- ct:log("install_release: ~.2f",[TInst2/1000000]),
-
- true = (TInst2 =< TInst0),
+ SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]),
+% ct:log("install_release: ~.2f",[TInst2/1000000]),
+
+ %% Calculate and print real time and CPU utilization
+ SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end,
+ {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0),
+ {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2),
+ TI0=TInst0/1000000,
+ TI2=TInst2/1000000,
+ CPU0=SumA0/SumT0,
+ CPU2=SumA2/SumT2,
+ X0 = TI0*CPU0,
+ X2 = TI2*CPU2,
+ ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n"
+ "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n",
+ [TI0, CPU0, X0, TI2, CPU2, X2]),
+
+ true = (X2 =< X0), % disregarding wait time for file access etc.
ok.
@@ -1206,12 +1245,25 @@ otp_9395_rm_many_mods(cleanup,_Conf) ->
stop_node(node_name(otp_9395_rm_many_mods)).
otp_9864(Conf) ->
+ case os:type() of
+ {win32,_} ->
+ {skip,"Testing handling of symlinks - skipped on windows"};
+ _ ->
+ do_otp_9864(Conf)
+ end.
+do_otp_9864(Conf) ->
%% Set some paths
PrivDir = priv_dir(Conf),
Dir = filename:join(PrivDir,"otp_9864"),
RelDir = filename:join(?config(data_dir, Conf), "app1_app2"),
- LibDir1 = filename:join(RelDir, "lib1"),
- LibDir2 = filename:join(RelDir, "lib2"),
+
+ %% Copy libs to priv_dir because remove_release will remove some
+ %% of these again, and we don't want to remove anything from
+ %% data_dir
+ copy_tree(Conf,filename:join(RelDir, "lib1"),Dir),
+ copy_tree(Conf,filename:join(RelDir, "lib2"),Dir),
+ LibDir1 = filename:join(Dir, "lib1"),
+ LibDir2 = filename:join(Dir, "lib2"),
%% Create the releases
Rel1 = create_and_install_fake_first_release(Dir,
@@ -1229,10 +1281,6 @@ otp_9864(Conf) ->
{ok, Node} = t_start_node(otp_9864, Rel1, filename:join(Rel1Dir,"sys.config")),
%% Unpack rel2 (make sure it does not work if an AppDir is bad)
- LibDir3 = filename:join(RelDir, "lib3"),
- {error, {no_such_directory, _}} =
- rpc:call(Node, release_handler, set_unpacked,
- [Rel2++".rel", [{app1,"2.0",LibDir2}, {app2,"1.0",LibDir3}]]),
{ok, RelVsn2} =
rpc:call(Node, release_handler, set_unpacked,
[Rel2++".rel", [{app1,"2.0",LibDir2}, {app2,"1.0",LibDir2}]]),
@@ -1243,22 +1291,27 @@ otp_9864(Conf) ->
ok = rpc:call(Node, release_handler, install_file,
[RelVsn2, filename:join(Rel2Dir, "sys.config")]),
- %% Install RelVsn2 without {update_paths, true} option
+ %% Install RelVsn2
{ok, RelVsn1, []} =
rpc:call(Node, release_handler, install_release, [RelVsn2]),
- %% Install RelVsn1 again
+ %% Create a symlink inside release 2
+ Releases2Dir = filename:join([Dir,"releases","2"]),
+ Link = filename:join(Releases2Dir,"foo_symlink_dir"),
+ file:make_symlink(Releases2Dir,Link),
+
+ %% Back down to RelVsn1
{ok, RelVsn1, []} =
rpc:call(Node, release_handler, install_release, [RelVsn1]),
- TempRel2Dir = filename:join(Dir,"releases/2"),
- file:make_symlink(TempRel2Dir, filename:join(TempRel2Dir, "foo_symlink_dir")),
-
%% This will fail if symlinks are not handled
ok = rpc:call(Node, release_handler, remove_release, [RelVsn2]),
ok.
+otp_9864(cleanup,_Conf) ->
+ stop_node(node_name(otp_9864)).
+
upgrade_supervisor(Conf) when is_list(Conf) ->
%% Set some paths
@@ -1646,6 +1699,15 @@ upgrade_gg(cleanup,Config) ->
ok = stop_nodes(NodeNames).
+%%%-----------------------------------------------------------------
+%%% OTP-10463, Bug - release_handler could not handle regexp in appup
+%%% files.
+otp_10463_upgrade_script_regexp(_Config) ->
+ %% Assuming that kernel always has a regexp in it's appup
+ KernelVsn = vsn(kernel,current),
+ {ok,KernelVsn,_} =
+ release_handler:upgrade_script(kernel,code:lib_dir(kernel)),
+ ok.
%%%=================================================================