From d221b34133a8da8d62bdc57ebb724f86d7cd2fc0 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 14 Oct 2011 12:34:08 +0200 Subject: Add restart_new_emulator instruction to kernel, stdlib and sasl appups The appup files for kernel, stdlib and sasl did not contain any UpFromVsn and DownToVsn. This means that it was not possible to create a relup file with systool:make_relup if any of these applications had changed. This commit adds entries in the appup files for a maximum of two major releases back - all with only one upgrade instruction: restart_new_emulator. The point is to allow relups to be generated, but ensure that no soft upgrade is done for these three applications - i.e. they will always cause a restart of the emulator prior to all other upgrade instructions from other applications. Test cases (appup_test) are added to kernel_SUITE, stdlib_SUITE and sasl_SUITE. These all check that expected versions are matched in the appups, and illegal versions (older than two major releases, or in any other way illegal) do not match. The test is written in a general way where it is assumed that the version of these applications are stepped according the the rule that major releases step the second number, maintenance releases step the third number and patches step the fourth number. --- lib/sasl/src/systools_relup.erl | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/sasl/src/systools_relup.erl') diff --git a/lib/sasl/src/systools_relup.erl b/lib/sasl/src/systools_relup.erl index b750e86e29..27960e9938 100644 --- a/lib/sasl/src/systools_relup.erl +++ b/lib/sasl/src/systools_relup.erl @@ -112,6 +112,10 @@ -export([mk_relup/3, mk_relup/4, format_error/1, format_warning/1]). -include("systools.hrl"). + +%% For test purposes only - used by kernel, stdlib and sasl tests +-export([appup_search_for_version/2]). + %%----------------------------------------------------------------- %% mk_relup(TopRelFile, BaseUpRelDcs, BaseDnRelDcs) %% mk_relup(TopRelFile, BaseUpRelDcs, BaseDnRelDcs, Opts) -> Ret @@ -452,25 +456,28 @@ get_script_from_appup(Mode, TopApp, BaseVsn, Ws, RUs) -> %% XXX Why is this a warning only? [{bad_vsn, {TopVsn, TopApp#application.vsn}}| Ws] end, - case search_for_version(BaseVsn, length(BaseVsn), VsnRUs) of + case appup_search_for_version(BaseVsn, VsnRUs) of {ok, RU} -> {RUs ++ [RU], Ws1}; error -> throw({error, ?MODULE, {no_relup, FName, TopApp, BaseVsn}}) end. -search_for_version(BaseVsn,_,[{BaseVsn,RU}|_]) -> +appup_search_for_version(BaseVsn, VsnRUs) -> + appup_search_for_version(BaseVsn, length(BaseVsn), VsnRUs). + +appup_search_for_version(BaseVsn,_,[{BaseVsn,RU}|_]) -> {ok,RU}; -search_for_version(BaseVsn,Size,[{Vsn,RU}|VsnRUs]) when is_binary(Vsn) -> +appup_search_for_version(BaseVsn,Size,[{Vsn,RU}|VsnRUs]) when is_binary(Vsn) -> case re:run(BaseVsn,Vsn,[unicode,{capture,first,index}]) of {match,[{0,Size}]} -> {ok, RU}; _ -> - search_for_version(BaseVsn,Size,VsnRUs) + appup_search_for_version(BaseVsn,Size,VsnRUs) end; -search_for_version(BaseVsn,Size,[_|VsnRUs]) -> - search_for_version(BaseVsn,Size,VsnRUs); -search_for_version(_,_,[]) -> +appup_search_for_version(BaseVsn,Size,[_|VsnRUs]) -> + appup_search_for_version(BaseVsn,Size,VsnRUs); +appup_search_for_version(_,_,[]) -> error. -- cgit v1.2.3