diff options
author | Siri Hansen <[email protected]> | 2011-11-29 16:55:10 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2011-11-29 17:05:55 +0100 |
commit | 3781b5129a3e43c1c2e5e33d1223e1e17a617be7 (patch) | |
tree | 1b8e532ed66885e9e757bceb7ed63607fada67e3 /lib/sasl/test/release_handler_SUITE_data | |
parent | 038b9dd3a1f9bdd86cbb83bf3484ab1529d4fca2 (diff) | |
download | otp-3781b5129a3e43c1c2e5e33d1223e1e17a617be7.tar.gz otp-3781b5129a3e43c1c2e5e33d1223e1e17a617be7.tar.bz2 otp-3781b5129a3e43c1c2e5e33d1223e1e17a617be7.zip |
Add test for upgrade of supervisor
The test is added in release_handler_SUITE since this makes it
possible to test the full upgrade instead of just a simple library
test of supervisor:code_change.
Diffstat (limited to 'lib/sasl/test/release_handler_SUITE_data')
10 files changed, 231 insertions, 0 deletions
diff --git a/lib/sasl/test/release_handler_SUITE_data/Makefile.src b/lib/sasl/test/release_handler_SUITE_data/Makefile.src index 6f40088161..55d20aa8b6 100644 --- a/lib/sasl/test/release_handler_SUITE_data/Makefile.src +++ b/lib/sasl/test/release_handler_SUITE_data/Makefile.src @@ -5,6 +5,10 @@ P2B= \ P2B/a-2.0/ebin/a_sup.@EMULATOR@ LIB= \ + lib/a-9.1/ebin/a.@EMULATOR@ \ + lib/a-9.1/ebin/a_sup.@EMULATOR@ \ + lib/a-9.0/ebin/a.@EMULATOR@ \ + lib/a-9.0/ebin/a_sup.@EMULATOR@ \ lib/a-1.2/ebin/a.@EMULATOR@ \ lib/a-1.2/ebin/a_sup.@EMULATOR@ \ lib/a-1.1/ebin/a.@EMULATOR@ \ @@ -101,6 +105,17 @@ lib/a-1.2/ebin/a.@EMULATOR@: lib/a-1.2/src/a.erl lib/a-1.2/ebin/a_sup.@EMULATOR@: lib/a-1.2/src/a_sup.erl erlc $(EFLAGS) -olib/a-1.2/ebin lib/a-1.2/src/a_sup.erl +lib/a-9.0/ebin/a.@EMULATOR@: lib/a-9.0/src/a.erl + erlc $(EFLAGS) -olib/a-9.0/ebin lib/a-9.0/src/a.erl +lib/a-9.0/ebin/a_sup.@EMULATOR@: lib/a-9.0/src/a_sup.erl + erlc $(EFLAGS) -olib/a-9.0/ebin lib/a-9.0/src/a_sup.erl + +lib/a-9.1/ebin/a.@EMULATOR@: lib/a-9.1/src/a.erl + erlc $(EFLAGS) -olib/a-9.1/ebin lib/a-9.1/src/a.erl +lib/a-9.1/ebin/a_sup.@EMULATOR@: lib/a-9.1/src/a_sup.erl + erlc $(EFLAGS) -olib/a-9.1/ebin lib/a-9.1/src/a_sup.erl + + lib/b-1.0/ebin/b_server.@EMULATOR@: lib/b-1.0/src/b_server.erl erlc $(EFLAGS) -olib/b-1.0/ebin lib/b-1.0/src/b_server.erl lib/b-1.0/ebin/b_lib.@EMULATOR@: lib/b-1.0/src/b_lib.erl diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/README b/lib/sasl/test/release_handler_SUITE_data/lib/README index 639a4ca0fb..ffb8c5120b 100644 --- a/lib/sasl/test/release_handler_SUITE_data/lib/README +++ b/lib/sasl/test/release_handler_SUITE_data/lib/README @@ -8,6 +8,14 @@ a-1.2: can be upgraded to from a-1.1. No module have changed, but priv dir is added including one 'file' +a-9.0: +can be upgrade to from a-1.0 +Changes a_sup correctly - to test successful upgrade of supervisor + +a-9.1: +can be upgrade to from a-1.0 +Changes a_sup faulty - to test failing upgrade of supervisor + b-1.0: start version, includes b_lib and b_server diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app new file mode 100644 index 0000000000..aa436d3e8c --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.app @@ -0,0 +1,8 @@ +{application, a, + [{description, "A CXC 138 11"}, + {vsn, "9.0"}, + {modules, [a, a_sup]}, + {registered, [a_sup]}, + {applications, [kernel, stdlib]}, + {env, [{key1, val1}]}, + {mod, {a_sup, []}}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup new file mode 100644 index 0000000000..c4071d57a3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/ebin/a.appup @@ -0,0 +1,3 @@ +{"9.0", + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}], + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl new file mode 100644 index 0000000000..1050e53f35 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a.erl @@ -0,0 +1,56 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(a). + + +-behaviour(gen_server). + +%% External exports +-export([start_link/0, a/0, b/0]). +%% Internal exports +-export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). + +start_link() -> gen_server:start_link({local, aa}, a, [], []). + +a() -> gen_server:call(aa, a). +b() -> gen_server:call(aa, b). + +%%----------------------------------------------------------------- +%% Callback functions from gen_server +%%----------------------------------------------------------------- +init([]) -> + process_flag(trap_exit, true), + {ok, {state, bval}}. + +handle_call(a, _From, State) -> + X = application:get_all_env(a), + {reply, X, State}; + +handle_call(b, _From, State) -> + {reply, {ok, element(2, State)}, State}. + +handle_info(_, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(1, Extra, State) -> + {ok, {state, bval}}; +code_change({down,1},Extra,State) -> + {ok, state}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl new file mode 100644 index 0000000000..ae1d080f58 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.0/src/a_sup.erl @@ -0,0 +1,37 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(a_sup). + + +-behaviour(supervisor). + +%% External exports +-export([start/2]). + +%% Internal exports +-export([init/1]). + +start(_, _) -> + supervisor:start_link({local, a_sup}, a_sup, []). + +init([]) -> + SupFlags = {one_for_all, 4, 3600}, + Config = {a, + {a, start_link, []}, + permanent, brutal_kill, worker, [a]}, + {ok, {SupFlags, [Config]}}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app new file mode 100644 index 0000000000..5b467ec4e8 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.app @@ -0,0 +1,8 @@ +{application, a, + [{description, "A CXC 138 11"}, + {vsn, "9.1"}, + {modules, [a, a_sup]}, + {registered, [a_sup]}, + {applications, [kernel, stdlib]}, + {env, [{key1, val1}]}, + {mod, {a_sup, []}}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup new file mode 100644 index 0000000000..efeb7f1fe3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/ebin/a.appup @@ -0,0 +1,3 @@ +{"9.1", + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}], + [{"1.0",[{update,a_sup,{advanced,update_supervisor}}]}]}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl new file mode 100644 index 0000000000..1050e53f35 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a.erl @@ -0,0 +1,56 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(a). + + +-behaviour(gen_server). + +%% External exports +-export([start_link/0, a/0, b/0]). +%% Internal exports +-export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). + +start_link() -> gen_server:start_link({local, aa}, a, [], []). + +a() -> gen_server:call(aa, a). +b() -> gen_server:call(aa, b). + +%%----------------------------------------------------------------- +%% Callback functions from gen_server +%%----------------------------------------------------------------- +init([]) -> + process_flag(trap_exit, true), + {ok, {state, bval}}. + +handle_call(a, _From, State) -> + X = application:get_all_env(a), + {reply, X, State}; + +handle_call(b, _From, State) -> + {reply, {ok, element(2, State)}, State}. + +handle_info(_, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(1, Extra, State) -> + {ok, {state, bval}}; +code_change({down,1},Extra,State) -> + {ok, state}. diff --git a/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl new file mode 100644 index 0000000000..b0597dc5c3 --- /dev/null +++ b/lib/sasl/test/release_handler_SUITE_data/lib/a-9.1/src/a_sup.erl @@ -0,0 +1,37 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(a_sup). + + +-behaviour(supervisor). + +%% External exports +-export([start/2]). + +%% Internal exports +-export([init/1]). + +start(_, _) -> + supervisor:start_link({local, a_sup}, a_sup, []). + +init([]) -> + SupFlags = {one_for_all, 4, 3600}, + Config = {a, + {a, start_link, []}, + permanent, brutal_kil, worker, [a]}, + {ok, {SupFlags, [Config]}}. |