aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/src/kernel.appup.src12
-rw-r--r--lib/kernel/test/kernel_SUITE.erl62
-rw-r--r--lib/sasl/src/sasl.appup.src12
-rw-r--r--lib/sasl/src/systools_rc.erl14
-rw-r--r--lib/sasl/test/sasl_SUITE.erl62
-rw-r--r--lib/sasl/test/systools_rc_SUITE.erl168
-rw-r--r--lib/sasl/test/test_lib.hrl4
-rw-r--r--lib/stdlib/src/epp.erl4
-rw-r--r--lib/stdlib/src/stdlib.appup.src12
-rw-r--r--lib/stdlib/test/epp_SUITE.erl32
-rw-r--r--lib/stdlib/test/stdlib_SUITE.erl63
11 files changed, 332 insertions, 113 deletions
diff --git a/lib/kernel/src/kernel.appup.src b/lib/kernel/src/kernel.appup.src
index b946c2d1af..f8f4cc1ec2 100644
--- a/lib/kernel/src/kernel.appup.src
+++ b/lib/kernel/src/kernel.appup.src
@@ -1,7 +1,7 @@
%% -*- erlang -*-
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-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
@@ -16,12 +16,10 @@
%%
%% %CopyrightEnd%
{"%VSN%",
- %% Up from - max two major revisions back
+ %% Up from - max one major revision back
[{<<"3\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R15
- %% Down to - max two major revisions back
+ {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R16
+ %% Down to - max one major revision back
[{<<"3\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R15
+ {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16
}.
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) ->
diff --git a/lib/sasl/src/sasl.appup.src b/lib/sasl/src/sasl.appup.src
index 0c4d80a74f..e789853eea 100644
--- a/lib/sasl/src/sasl.appup.src
+++ b/lib/sasl/src/sasl.appup.src
@@ -1,7 +1,7 @@
%% -*- erlang -*-
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-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
@@ -16,12 +16,10 @@
%%
%% %CopyrightEnd%
{"%VSN%",
- %% Up from - max two major revisions back
+ %% Up from - max one major revision back
[{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"2\\.2(\\.[0-9]+)*">>,[restart_new_emulator]}], %% R15
- %% Down to - max two major revisions back
+ {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}], %% R16
+ %% Down to - max one major revision back
[{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"2\\.2(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R15
+ {<<"2\\.3(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16
}.
diff --git a/lib/sasl/src/systools_rc.erl b/lib/sasl/src/systools_rc.erl
index 54c327410d..76f753c3d0 100644
--- a/lib/sasl/src/systools_rc.erl
+++ b/lib/sasl/src/systools_rc.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -365,14 +365,22 @@ translate_application_instrs(Script, Appls, PreAppls) ->
case lists:keysearch(Appl, #application.name, Appls) of
{value, PostApplication} ->
PostMods = PostApplication#application.modules,
+ Type = PostApplication#application.type,
+ Apply =
+ case Type of
+ none -> [];
+ load -> [{apply, {application, load,
+ [Appl]}}];
+ _ -> [{apply, {application, start,
+ [Appl, Type]}}]
+ end,
[{apply, {application, stop, [Appl]}}] ++
[{remove, {M, brutal_purge, brutal_purge}}
|| M <- PreMods] ++
[{purge, PreMods}] ++
[{add_module, M, []} || M <- PostMods] ++
- [{apply, {application, start,
- [Appl, permanent]}}];
+ Apply;
false ->
throw({error, {no_such_application, Appl}})
end;
diff --git a/lib/sasl/test/sasl_SUITE.erl b/lib/sasl/test/sasl_SUITE.erl
index e799230338..ad63a31cbd 100644
--- a/lib/sasl/test/sasl_SUITE.erl
+++ b/lib/sasl/test/sasl_SUITE.erl
@@ -22,7 +22,6 @@
%% Default timetrap timeout (set in init_per_testcase).
-define(default_timeout, ?t:minutes(1)).
--define(application, sasl).
%% Test server specific exports
-export([all/0,groups/0,init_per_group/2,end_per_group/2]).
@@ -58,17 +57,18 @@ app_test(Config) when is_list(Config) ->
?t:app_test(sasl, allow),
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(sasl,create_test_vsns(sasl)).
-do_appup_tests({[],[]}) ->
+appup_tests(_App,{[],[]}) ->
{skip,"no previous releases available"};
-do_appup_tests({OkVsns,NokVsns}) ->
- application:load(sasl),
- {_,_,Vsn} = lists:keyfind(sasl,1,application:loaded_applications()),
- AppupFile = filename:join([code:lib_dir(sasl),ebin,"sasl.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]),
@@ -79,13 +79,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 = sasl_vsn([FirstMajor,SecondMajor]),
- Nok0 = sasl_vsn([ThirdMajor]),
+ Ok = app_vsn(App,[FirstMajor]),
+ Nok0 = app_vsn(App,[SecondMajor]),
Nok = case Ok of
[Ok1|_] ->
[Ok1 ++ ",1" | Nok0]; % illegal
@@ -101,19 +100,36 @@ previous_major("r"++Rel) ->
previous_major(Rel) ->
integer_to_list(list_to_integer(Rel)-1).
-sasl_vsn([R|Rs]) ->
- case test_server:is_release_available(R) of
- true ->
- {ok,N} = test_server:start_node(prevrel,peer,[{erl,[{release,R}]}]),
- _ = rpc:call(N,application,load,[sasl]),
+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 ->
+ 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(sasl,1,As),
+ {_,_,V} = lists:keyfind(App,1,As),
test_server:stop_node(N),
- [V|sasl_vsn(Rs)];
- false ->
- sasl_vsn(Rs)
+ [V|app_vsn(App,Rs)]
end;
-sasl_vsn([]) ->
+app_vsn(_App,[]) ->
[].
check_appup([Vsn|Vsns],Instrs,Expected) ->
diff --git a/lib/sasl/test/systools_rc_SUITE.erl b/lib/sasl/test/systools_rc_SUITE.erl
index 0cb6e63cf3..5efab7c028 100644
--- a/lib/sasl/test/systools_rc_SUITE.erl
+++ b/lib/sasl/test/systools_rc_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2010-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
@@ -436,25 +436,19 @@ translate(Config) when is_list(Config) ->
translate_app(Config) when is_list(Config) ->
PreApps =
- [#application{name = test,
- description = "TEST",
- vsn = "1.0",
- modules = [foo,bar,baz],
- regs = [],
- mod = {sasl, []}},
+ [Test = #application{name = test,
+ description = "TEST",
+ vsn = "1.0",
+ modules = [foo,bar,baz],
+ regs = [],
+ mod = {sasl, []}},
#application{name = pelle,
description = "PELLE",
vsn = "1.0",
modules = [pelle, kalle],
regs = [],
mod = {pelle, []}}],
- Apps =
- [#application{name = test,
- description = "TEST",
- vsn = "1.0",
- modules = [foo,bar,baz],
- regs = [],
- mod = {sasl, []}}],
+ Apps = [Test],
%% Simple translation (1)
Up1 = [{add_module, foo},
{add_module, bar}],
@@ -475,6 +469,56 @@ translate_app(Config) when is_list(Config) ->
{load,{baz,brutal_purge,brutal_purge}},
{apply,{application,start,[test,permanent]}}] = X2,
+ %% Translate add_application with different restart types
+ %% permanent
+ Up2_1 = [{add_application, test, permanent}],
+ {ok, X2_1} = systools_rc:translate_scripts([Up2_1], Apps, []),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,permanent]}}] = X2_1,
+
+ %% transient
+ Up2_2 = [{add_application, test, transient}],
+ {ok, X2_2} = systools_rc:translate_scripts([Up2_2], Apps, []),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,transient]}}] = X2_2,
+
+ %% temporary
+ Up2_3 = [{add_application, test, temporary}],
+ {ok, X2_3} = systools_rc:translate_scripts([Up2_3], Apps, []),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,temporary]}}] = X2_3,
+
+ %% load
+ Up2_4 = [{add_application, test, load}],
+ {ok, X2_4} = systools_rc:translate_scripts([Up2_4], Apps, []),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,load,[test]}}] = X2_4,
+
+ %% none
+ Up2_5 = [{add_application, test, none}],
+ {ok, X2_5} = systools_rc:translate_scripts([Up2_5], Apps, []),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}}] = X2_5,
+
%% Simple translation (3)
Up3 = [{remove_application, pelle}],
{ok, X3} = systools_rc:translate_scripts([Up3], Apps, PreApps),
@@ -484,6 +528,102 @@ translate_app(Config) when is_list(Config) ->
{remove,{kalle,brutal_purge,brutal_purge}},
{purge,[pelle,kalle]},
{apply,{application,unload,[pelle]}}] = X3,
+
+ %% Simple translation (4)
+ Up4 = [{restart_application, test}],
+ {ok, X4} = systools_rc:translate_scripts([Up4], Apps, PreApps),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,permanent]}}] = X4,
+
+ %% Translate restart_application with different restart types
+ %% permanent
+ {ok, X4_1} = systools_rc:translate_scripts([Up4],
+ [Test#application{type=permanent}],
+ [Test]),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,permanent]}}] = X4_1,
+
+ %% transient
+ {ok, X4_2} = systools_rc:translate_scripts([Up4],
+ [Test#application{type=transient}],
+ [Test]),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,transient]}}] = X4_2,
+
+ %% temporary
+ {ok, X4_3} = systools_rc:translate_scripts([Up4],
+ [Test#application{type=temporary}],
+ [Test]),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,start,[test,temporary]}}] = X4_3,
+
+ %% load
+ {ok, X4_4} = systools_rc:translate_scripts([Up4],
+ [Test#application{type=load}],
+ [Test]),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}},
+ {apply,{application,load,[test]}}] = X4_4,
+
+ %% none
+ {ok, X4_5} = systools_rc:translate_scripts([Up4],
+ [Test#application{type=none}],
+ [Test]),
+ [{load_object_code,{test,"1.0",[foo,bar,baz]}},
+ point_of_no_return,
+ {apply,{application,stop,[test]}},
+ {remove,{foo,brutal_purge,brutal_purge}},
+ {remove,{bar,brutal_purge,brutal_purge}},
+ {remove,{baz,brutal_purge,brutal_purge}},
+ {purge,[foo,bar,baz]},
+ {load,{foo,brutal_purge,brutal_purge}},
+ {load,{bar,brutal_purge,brutal_purge}},
+ {load,{baz,brutal_purge,brutal_purge}}] = X4_5,
+
ok.
diff --git a/lib/sasl/test/test_lib.hrl b/lib/sasl/test/test_lib.hrl
index 37aa44c198..c8a4e92f24 100644
--- a/lib/sasl/test/test_lib.hrl
+++ b/lib/sasl/test/test_lib.hrl
@@ -1,3 +1,3 @@
-define(ertsvsn,"4.4").
--define(kernelvsn,"2.15.3").
--define(stdlibvsn,"1.18.3").
+-define(kernelvsn,"2.16.4").
+-define(stdlibvsn,"1.19.4").
diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl
index 4fd302e612..dc25b6b9f4 100644
--- a/lib/stdlib/src/epp.erl
+++ b/lib/stdlib/src/epp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -640,7 +640,7 @@ leave_file(From, St) ->
Ms = dict:store({atom,'FILE'},
{none,[{string,CurrLoc,OldName2}]},
St#epp.macs),
- NextSt = OldSt#epp{sstk=Sts,macs=Ms},
+ NextSt = OldSt#epp{sstk=Sts,macs=Ms,uses=St#epp.uses},
enter_file_reply(From, OldName, CurrLoc, CurrLoc),
case OldName2 =:= OldName of
true ->
diff --git a/lib/stdlib/src/stdlib.appup.src b/lib/stdlib/src/stdlib.appup.src
index 749a9a4201..22eefb2514 100644
--- a/lib/stdlib/src/stdlib.appup.src
+++ b/lib/stdlib/src/stdlib.appup.src
@@ -1,7 +1,7 @@
%% -*- erlang -*-
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-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
@@ -16,12 +16,10 @@
%%
%% %CopyrightEnd%
{"%VSN%",
- %% Up from - max two major revisions back
+ %% Up from - max one major revision back
[{<<"2\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"1\\.18(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R15
- %% Down to - max two major revisions back
+ {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R16
+ %% Down to - max one major revision back
[{<<"2\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17
- {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16
- {<<"1\\.18(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R15
+ {<<"1\\.19(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R16
}.
diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl
index 0cbdf76270..0b4726c07a 100644
--- a/lib/stdlib/test/epp_SUITE.erl
+++ b/lib/stdlib/test/epp_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -25,7 +25,8 @@
variable_1/1, otp_4870/1, otp_4871/1, otp_5362/1,
pmod/1, not_circular/1, skip_header/1, otp_6277/1, otp_7702/1,
otp_8130/1, overload_mac/1, otp_8388/1, otp_8470/1, otp_8503/1,
- otp_8562/1, otp_8665/1, otp_8911/1, otp_10302/1, otp_10820/1]).
+ otp_8562/1, otp_8665/1, otp_8911/1, otp_10302/1, otp_10820/1,
+ otp_11728/1]).
-export([epp_parse_erl_form/2]).
@@ -67,7 +68,7 @@ all() ->
{group, variable}, otp_4870, otp_4871, otp_5362, pmod,
not_circular, skip_header, otp_6277, otp_7702, otp_8130,
overload_mac, otp_8388, otp_8470, otp_8503, otp_8562,
- otp_8665, otp_8911, otp_10302, otp_10820].
+ otp_8665, otp_8911, otp_10302, otp_10820, otp_11728].
groups() ->
[{upcase_mac, [], [upcase_mac_1, upcase_mac_2]},
@@ -1387,6 +1388,31 @@ do_otp_10820(File, C, PC) ->
true = test_server:stop_node(Node),
ok.
+otp_11728(doc) ->
+ ["OTP-11728. Bugfix circular macro."];
+otp_11728(suite) ->
+ [];
+otp_11728(Config) when is_list(Config) ->
+ Dir = ?config(priv_dir, Config),
+ H = <<"-define(MACRO,[[]++?MACRO]).">>,
+ HrlFile = filename:join(Dir, "otp_11728.hrl"),
+ ok = file:write_file(HrlFile, H),
+ C = <<"-module(otp_11728).
+ -compile(export_all).
+
+ -include(\"otp_11728.hrl\").
+
+ function_name()->
+ A=?MACRO, % line 7
+ ok">>,
+ ErlFile = filename:join(Dir, "otp_11728.erl"),
+ ok = file:write_file(ErlFile, C),
+ {ok, L} = epp:parse_file(ErlFile, [Dir], []),
+ true = lists:member({error,{7,epp,{circular,'MACRO',none}}}, L),
+ _ = file:delete(HrlFile),
+ _ = file:delete(ErlFile),
+ ok.
+
check(Config, Tests) ->
eval_tests(Config, fun check_test/2, Tests).
diff --git a/lib/stdlib/test/stdlib_SUITE.erl b/lib/stdlib/test/stdlib_SUITE.erl
index 8fff5e2e05..b0d6913636 100644
--- a/lib/stdlib/test/stdlib_SUITE.erl
+++ b/lib/stdlib/test/stdlib_SUITE.erl
@@ -25,7 +25,6 @@
% Default timetrap timeout (set in init_per_testcase).
-define(default_timeout, ?t:minutes(1)).
--define(application, stdlib).
% Test server specific exports
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
@@ -78,17 +77,18 @@ app_test(Config) when is_list(Config) ->
?t:app_test(stdlib),
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(stdlib,create_test_vsns(stdlib)).
-do_appup_tests({[],[]}) ->
+appup_tests(_App,{[],[]}) ->
{skip,"no previous releases available"};
-do_appup_tests({OkVsns,NokVsns}) ->
- application:load(stdlib),
- {_,_,Vsn} = lists:keyfind(stdlib,1,application:loaded_applications()),
- AppupFile = filename:join([code:lib_dir(stdlib),ebin,"stdlib.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 +99,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 = stdlib_vsn([FirstMajor,SecondMajor]),
- Nok0 = stdlib_vsn([ThirdMajor]),
+ Ok = app_vsn(App,[FirstMajor]),
+ Nok0 = app_vsn(App,[SecondMajor]),
Nok = case Ok of
[Ok1|_] ->
[Ok1 ++ ",1" | Nok0]; % illegal
@@ -121,18 +120,36 @@ previous_major("r"++Rel) ->
previous_major(Rel) ->
integer_to_list(list_to_integer(Rel)-1).
-stdlib_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(stdlib,1,As),
- test_server:stop_node(N),
- [KV|stdlib_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 ->
- stdlib_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;
-stdlib_vsn([]) ->
+app_vsn(_App,[]) ->
[].
check_appup([Vsn|Vsns],Instrs,Expected) ->