aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/kernel_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2014-02-12 15:04:02 +0100
committerSiri Hansen <[email protected]>2014-02-12 15:04:02 +0100
commit3374b8e20dfafe357dfc6c82adb7357c39b18d86 (patch)
treec435d3b1ffe99f103a0e99b48c3fa2c290c3cccb /lib/kernel/test/kernel_SUITE.erl
parentd7d240bc3d03cf708f6feaf20efac1addcd76242 (diff)
downloadotp-3374b8e20dfafe357dfc6c82adb7357c39b18d86.tar.gz
otp-3374b8e20dfafe357dfc6c82adb7357c39b18d86.tar.bz2
otp-3374b8e20dfafe357dfc6c82adb7357c39b18d86.zip
Update appups and appup tests for kernel, stdlib and sasl
Appups now only support one major release back, and the tests are updated accordingly. Support is also added in tests for giving previous releases in a ct config file, e.g. {otp_releases,[{r15,"/path/to/r15/bin/erl"}, {r16,"/path/to/r16/bin/erl"}, {'17',"/path/to/17/bin/erl"}]}.
Diffstat (limited to 'lib/kernel/test/kernel_SUITE.erl')
-rw-r--r--lib/kernel/test/kernel_SUITE.erl62
1 files changed, 40 insertions, 22 deletions
diff --git a/lib/kernel/test/kernel_SUITE.erl b/lib/kernel/test/kernel_SUITE.erl
index 75f51eb076..2d8123c9c4 100644
--- a/lib/kernel/test/kernel_SUITE.erl
+++ b/lib/kernel/test/kernel_SUITE.erl
@@ -78,17 +78,18 @@ app_test(Config) when is_list(Config) ->
ok.
-%% Test that appup allows upgrade from/downgrade to a maximum of two
-%% major releases back.
+%% Test that appup allows upgrade from/downgrade to a maximum of one
+%% major release back.
appup_test(_Config) ->
- do_appup_tests(create_test_vsns()).
+ appup_tests(kernel,create_test_vsns(kernel)).
-do_appup_tests({[],[]}) ->
+appup_tests(_App,{[],[]}) ->
{skip,"no previous releases available"};
-do_appup_tests({OkVsns,NokVsns}) ->
- application:load(kernel),
- {_,_,Vsn} = lists:keyfind(kernel,1,application:loaded_applications()),
- AppupFile = filename:join([code:lib_dir(kernel),ebin,"kernel.appup"]),
+appup_tests(App,{OkVsns,NokVsns}) ->
+ application:load(App),
+ {_,_,Vsn} = lists:keyfind(App,1,application:loaded_applications()),
+ AppupFileName = atom_to_list(App) ++ ".appup",
+ AppupFile = filename:join([code:lib_dir(App),ebin,AppupFileName]),
{ok,[{Vsn,UpFrom,DownTo}=AppupScript]} = file:consult(AppupFile),
ct:log("~p~n",[AppupScript]),
ct:log("Testing ok versions: ~p~n",[OkVsns]),
@@ -99,13 +100,12 @@ do_appup_tests({OkVsns,NokVsns}) ->
check_appup(NokVsns,DownTo,error),
ok.
-create_test_vsns() ->
+create_test_vsns(App) ->
This = erlang:system_info(otp_release),
FirstMajor = previous_major(This),
SecondMajor = previous_major(FirstMajor),
- ThirdMajor = previous_major(SecondMajor),
- Ok = kernel_vsn([FirstMajor,SecondMajor]),
- Nok0 = kernel_vsn([ThirdMajor]),
+ Ok = app_vsn(App,[FirstMajor]),
+ Nok0 = app_vsn(App,[SecondMajor]),
Nok = case Ok of
[Ok1|_] ->
[Ok1 ++ ",1" | Nok0]; % illegal
@@ -121,18 +121,36 @@ previous_major("r"++Rel) ->
previous_major(Rel) ->
integer_to_list(list_to_integer(Rel)-1).
-kernel_vsn([R|Rs]) ->
- case test_server:is_release_available(R) of
- true ->
- {ok,N} = test_server:start_node(prevrel,peer,[{erl,[{release,R}]}]),
- As = rpc:call(N,application,which_applications,[]),
- {_,_,KV} = lists:keyfind(kernel,1,As),
- test_server:stop_node(N),
- [KV|kernel_vsn(Rs)];
+app_vsn(App,[R|Rs]) ->
+ OldRel =
+ case test_server:is_release_available(R) of
+ true ->
+ {release,R};
+ false ->
+ case ct:get_config({otp_releases,list_to_atom(R)}) of
+ undefined ->
+ false;
+ Prog0 ->
+ case os:find_executable(Prog0) of
+ false ->
+ false;
+ Prog ->
+ {prog,Prog}
+ end
+ end
+ end,
+ case OldRel of
false ->
- kernel_vsn(Rs)
+ app_vsn(App,Rs);
+ _ ->
+ {ok,N} = test_server:start_node(prevrel,peer,[{erl,[OldRel]}]),
+ _ = rpc:call(N,application,load,[App]),
+ As = rpc:call(N,application,loaded_applications,[]),
+ {_,_,V} = lists:keyfind(App,1,As),
+ test_server:stop_node(N),
+ [V|app_vsn(App,Rs)]
end;
-kernel_vsn([]) ->
+app_vsn(_App,[]) ->
[].
check_appup([Vsn|Vsns],Instrs,Expected) ->