aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/test/code_SUITE.erl44
-rw-r--r--lib/kernel/test/code_SUITE_data/other.erl38
-rw-r--r--lib/kernel/test/code_SUITE_data/upgrade_client.erl259
-rw-r--r--lib/kernel/test/code_SUITE_data/upgradee.erl123
4 files changed, 464 insertions, 0 deletions
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 3e8bdaf1ff..f6d38e6d1f 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -25,6 +25,7 @@
replace_path/1, load_file/1, load_abs/1, ensure_loaded/1,
delete/1, purge/1, soft_purge/1, is_loaded/1, all_loaded/1,
load_binary/1, dir_req/1, object_code/1, set_path_file/1,
+ upgrade/1,
sticky_dir/1, pa_pz_option/1, add_del_path/1,
dir_disappeared/1, ext_mod_dep/1, clash/1,
load_cached/1, start_node_with_cache/1, add_and_rehash/1,
@@ -43,6 +44,8 @@
handle_event/2, handle_call/2, handle_info/2,
terminate/2]).
+-export([compile_load/4]).
+
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
@@ -50,6 +53,7 @@ all() ->
replace_path, load_file, load_abs, ensure_loaded,
delete, purge, soft_purge, is_loaded, all_loaded,
load_binary, dir_req, object_code, set_path_file,
+ upgrade,
pa_pz_option, add_del_path, dir_disappeared,
ext_mod_dep, clash, load_cached, start_node_with_cache,
add_and_rehash, where_is_file_no_cache,
@@ -450,6 +454,46 @@ load_binary(Config) when is_list(Config) ->
code:delete(code_b_test),
ok.
+upgrade(Config) ->
+ DataDir = ?config(data_dir, Config),
+
+ %%T = [beam, hipe],
+ T = [beam],
+
+ [upgrade_do(DataDir, Client, U1, U2, O1, O2)
+ || Client<-T, U1<-T, U2<-T, O1<-T, O2<-T],
+
+ ok.
+
+upgrade_do(DataDir, Client, U1, U2, O1, O2) ->
+ compile_load(upgrade_client, DataDir, undefined, Client),
+ upgrade_client:run(DataDir, U1, U2, O1, O2),
+ ok.
+
+compile_load(Mod, Dir, Ver, CodeType) ->
+ Version = case Ver of
+ undefined ->
+ io:format("Compiling '~p' as ~p\n", [Mod, CodeType]),
+ [];
+ _ ->
+ io:format("Compiling version ~p of '~p' as ~p\n",
+ [Ver, Mod, CodeType]),
+ [{d,list_to_atom("VERSION_" ++ integer_to_list(Ver))}]
+ end,
+ Target = case CodeType of
+ beam -> [];
+ hipe -> [native]
+ end,
+ CompOpts = [binary, report] ++ Target ++ Version,
+
+ Src = filename:join(Dir, atom_to_list(Mod) ++ ".erl"),
+ %io:format("compile:file(~p,~p)\n", [Src, CompOpts]),
+ {ok,Mod,Code} = compile:file(Src, CompOpts),
+ ObjFile = filename:basename(Src,".erl") ++ ".beam",
+ {module,Mod} = code:load_binary(Mod, ObjFile, Code),
+ %IsNative = code:is_module_native(Mod),
+ ok.
+
dir_req(suite) -> [];
dir_req(doc) -> [];
dir_req(Config) when is_list(Config) ->
diff --git a/lib/kernel/test/code_SUITE_data/other.erl b/lib/kernel/test/code_SUITE_data/other.erl
new file mode 100644
index 0000000000..58ce87f222
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/other.erl
@@ -0,0 +1,38 @@
+-module(other).
+
+-ifdef(VERSION_1).
+-define(VERSION,1).
+-export([exp1/0]).
+-export([exp1loc2/0]).
+-export([exp1exp2/0]).
+exp1() -> check([loc1(),exp1loc2(),exp1exp2(),loc1exp2(),loc1loc2()]).
+loc1() -> check([exp1loc2(),exp1exp2(),loc1exp2(),loc1loc2()]).
+exp1loc2() -> check([exp1exp2(),loc1exp2(),loc1loc2()]).
+exp1exp2() -> check([loc1exp2(),loc1loc2()]).
+loc1exp2() -> check([loc1loc2()]).
+-endif. % VERSION_1
+
+-ifdef(VERSION_2).
+-define(VERSION,2).
+-export([exp2/0]).
+-export([loc1exp2/0]).
+-export([exp1exp2/0]).
+loc1exp2() -> check([exp1exp2(),exp1loc2(),loc2(),exp2(),loc1loc2()]).
+exp1exp2() -> check([exp1loc2(),loc2(),exp2(),loc1loc2()]).
+exp1loc2() -> check([loc2(),exp2(),loc1loc2()]).
+loc2() -> check([exp2(),loc1loc2()]).
+exp2() -> check([loc1loc2()]).
+
+-endif. % VERSION_2
+
+loc1loc2() -> ?VERSION.
+
+
+check(VerList) ->
+ case lists:all(fun(?VERSION) -> true; (_) -> false end,
+ VerList) of
+ true ->
+ ?VERSION;
+ false ->
+ VerList
+ end.
diff --git a/lib/kernel/test/code_SUITE_data/upgrade_client.erl b/lib/kernel/test/code_SUITE_data/upgrade_client.erl
new file mode 100644
index 0000000000..bb655e01d3
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/upgrade_client.erl
@@ -0,0 +1,259 @@
+-module(upgrade_client).
+
+-export([run/5]).
+
+%%-define(line, io:format("~s:~p\n", [?MODULE,?LINE]),).
+-define(line,).
+
+run(Dir, Upgradee1, Upgradee2, Other1, Other2) ->
+ %% Load version 1 of upgradee
+ code_SUITE:compile_load(upgradee, Dir, 1, Upgradee1),
+
+ ?line 1 = upgradee:exp1(),
+ ?line 1 = upgradee:exp1exp2(),
+ ?line 1 = upgradee:exp1loc2(),
+
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1loc2()),
+
+ P = spawn_link(upgradee,dispatch_loop,[]),
+
+ ?line 1 = proxy_call(P, local, exp1),
+ ?line 1 = proxy_call(P, local, loc1),
+ ?line 1 = proxy_call(P, local, exp1exp2),
+ ?line 1 = proxy_call(P, local, exp1loc2),
+ ?line 1 = proxy_call(P, local, loc1exp2),
+ ?line 1 = proxy_call(P, local, loc1loc2),
+ ?line 1 = proxy_call(P, external, exp1),
+ ?line 1 = proxy_call(P, external, exp1exp2),
+ ?line 1 = proxy_call(P, external, exp1loc2),
+
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc2),
+ ?line {cannot_compile,1} = proxy_call(P, local, exp2),
+ ?line {cannot_compile,1} = proxy_call(P, local, loc2),
+
+ ?line {'EXIT',{undef,_}} = (catch other:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc11exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc2()),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc2),
+
+ %%
+ %% Load version 1 of other
+ %%
+ code_SUITE:compile_load(other, Dir, 1, Other1),
+ ?line 1 = other:exp1(),
+ ?line 1 = other:exp1loc2(),
+ ?line 1 = other:exp1exp2(),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc2()),
+
+ ?line 1 = proxy_call(P, other, exp1),
+ ?line 1 = proxy_call(P, other, exp1loc2),
+ ?line 1 = proxy_call(P, other, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc2),
+
+ %%
+ %% Load version 2 of upgradee
+ %%
+ code_SUITE:compile_load(upgradee, Dir, 2, Upgradee2),
+
+ ?line 2 = upgradee:exp2(),
+ ?line 2 = upgradee:exp1exp2(),
+ ?line 2 = upgradee:loc1exp2(),
+
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc2()),
+
+ ?line 1 = proxy_call(P, local, exp1),
+ ?line 1 = proxy_call(P, local, loc1),
+ ?line 1 = proxy_call(P, local, exp1exp2),
+ ?line 1 = proxy_call(P, local, exp1loc2),
+ ?line 1 = proxy_call(P, local, loc1exp2),
+ ?line 1 = proxy_call(P, local, loc1loc2),
+ ?line {cannot_compile,1} = proxy_call(P, local, exp2),
+ ?line {cannot_compile,1} = proxy_call(P, local, loc2),
+
+ ?line 2 = proxy_call(P, external, exp1exp2),
+ ?line 2 = proxy_call(P, external, loc1exp2),
+ ?line 2 = proxy_call(P, external, exp2),
+
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc2),
+
+ ?line 1 = other:exp1(),
+ ?line 1 = other:exp1loc2(),
+ ?line 1 = other:exp1exp2(),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc2()),
+
+ ?line 1 = proxy_call(P, other, exp1),
+ ?line 1 = proxy_call(P, other, exp1loc2),
+ ?line 1 = proxy_call(P, other, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc2),
+
+ %%
+ %% Load version 2 of other
+ %%
+ code_SUITE:compile_load(other, Dir, 2, Other2),
+
+ ?line 2 = upgradee:exp2(),
+ ?line 2 = upgradee:exp1exp2(),
+ ?line 2 = upgradee:loc1exp2(),
+
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc2()),
+
+ ?line 1 = proxy_call(P, local, exp1),
+ ?line 1 = proxy_call(P, local, loc1),
+ ?line 1 = proxy_call(P, local, exp1exp2),
+ ?line 1 = proxy_call(P, local, exp1loc2),
+ ?line 1 = proxy_call(P, local, loc1exp2),
+ ?line 1 = proxy_call(P, local, loc1loc2),
+ ?line {cannot_compile,1} = proxy_call(P, local, exp2),
+ ?line {cannot_compile,1} = proxy_call(P, local, loc2),
+
+ ?line 2 = proxy_call(P, external, exp1exp2),
+ ?line 2 = proxy_call(P, external, loc1exp2),
+ ?line 2 = proxy_call(P, external, exp2),
+
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc2),
+
+ ?line 2 = other:exp2(),
+ ?line 2 = other:loc1exp2(),
+ ?line 2 = other:exp1exp2(),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc2()),
+
+ ?line 2 = proxy_call(P, other, exp2),
+ ?line 2 = proxy_call(P, other, loc1exp2),
+ ?line 2 = proxy_call(P, other, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc2),
+
+
+ %%
+ %% Upgrade proxy to version 2
+ %%
+ P ! upgrade_order,
+
+
+ %%
+ io:format("Delete version 2 of 'upgradee'\n",[]),
+ %%
+ code:purge(upgradee),
+ code:delete(upgradee),
+
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1exp2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch upgradee:loc2()),
+
+ ?line 2 = proxy_call(P, local, exp2),
+ ?line 2 = proxy_call(P, local, loc2),
+ ?line 2 = proxy_call(P, local, exp1exp2),
+ ?line 2 = proxy_call(P, local, exp1loc2),
+ ?line 2 = proxy_call(P, local, loc1exp2),
+ ?line 2 = proxy_call(P, local, loc1loc2),
+ ?line {cannot_compile,2} = proxy_call(P, local, exp1),
+ ?line {cannot_compile,2} = proxy_call(P, local, loc1),
+
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, external, loc2),
+
+ ?line 2 = other:exp2(),
+ ?line 2 = other:loc1exp2(),
+ ?line 2 = other:exp1exp2(),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1()),
+ ?line {'EXIT',{undef,_}} = (catch other:exp1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc1loc2()),
+ ?line {'EXIT',{undef,_}} = (catch other:loc2()),
+
+ ?line 2 = proxy_call(P, other, exp2),
+ ?line 2 = proxy_call(P, other, loc1exp2),
+ ?line 2 = proxy_call(P, other, exp1exp2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, exp1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc1loc2),
+ ?line {'EXIT',{undef,_}} = proxy_call(P, other, loc2),
+
+ unlink(P),
+ exit(P, die_please),
+
+ io:format("Purge 'upgradee'\n",[]),
+ code:purge(upgradee),
+
+ io:format("Delete and purge 'other'\n",[]),
+ code:purge(other),
+ code:delete(other),
+ code:purge(other),
+ ok.
+
+proxy_call(Pid, CallType, Func) ->
+ Pid ! {self(), CallType, Func},
+ receive
+ {Pid, call_result, Func, Ret} -> Ret
+ end.
diff --git a/lib/kernel/test/code_SUITE_data/upgradee.erl b/lib/kernel/test/code_SUITE_data/upgradee.erl
new file mode 100644
index 0000000000..62b1d95e30
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/upgradee.erl
@@ -0,0 +1,123 @@
+-module(upgradee).
+
+-export([dispatch_loop/0]).
+
+-ifdef(VERSION_1).
+-define(VERSION,1).
+
+-export([exp1/0]). % only exported in v1
+-export([exp1loc2/0]). % exported in v1, local in v2
+-export([exp1exp2/0]). % exported in v1 and v2
+
+exp1() -> ?VERSION.
+loc1() -> ?VERSION.
+
+-endif. % VERSION_1
+
+-ifdef(VERSION_2).
+-define(VERSION,2).
+
+-export([exp2/0]).
+-export([loc1exp2/0]).
+-export([exp1exp2/0]).
+
+exp2() -> ?VERSION.
+loc2() -> ?VERSION.
+
+-endif. % VERSION_2
+
+exp1exp2() -> ?VERSION.
+exp1loc2() -> ?VERSION.
+loc1exp2() -> ?VERSION.
+loc1loc2() -> ?VERSION.
+
+dispatch_loop() ->
+ receive
+ upgrade_order ->
+ %%erlang:display({"upgradee version", ?VERSION, "got upgrade_order"}),
+ ?MODULE:dispatch_loop();
+
+ Msg ->
+ %%erlang:display({"upgradee version", ?VERSION, "got msg", Msg}),
+ {Func,Ret} = case Msg of
+ %% Local calls
+ {Pid, local, F=exp1} ->
+ {F, local_exp1()};
+ {Pid, local, F=loc1} ->
+ {F, local_loc1()};
+ {Pid, local, F=exp1exp2} ->
+ {F, catch exp1exp2()};
+ {Pid, local, F=exp1loc2} ->
+ {F, catch exp1loc2()};
+ {Pid, local, F=loc1exp2} ->
+ {F, catch loc1exp2()};
+ {Pid, local, F=loc1loc2} ->
+ {F, catch loc1loc2()};
+ {Pid, local, F=exp2} ->
+ {F, local_exp2()};
+ {Pid, local, F=loc2} ->
+ {F, local_loc2()};
+
+ %% Extern calls to own module
+ {Pid, external, F=exp1} ->
+ {F, catch ?MODULE:exp1()};
+ {Pid, external, F=loc1} ->
+ {F, catch ?MODULE:loc1()};
+ {Pid, external, F=exp1exp2} ->
+ {F, catch ?MODULE:exp1exp2()};
+ {Pid, external, F=exp1loc2} ->
+ {F, catch ?MODULE:exp1loc2()};
+ {Pid, external, F=loc1exp2} ->
+ {F, catch ?MODULE:loc1exp2()};
+ {Pid, external, F=loc1loc2} ->
+ {F, catch ?MODULE:loc1loc2()};
+ {Pid, external, F=exp2} ->
+ {F, catch ?MODULE:exp2()};
+ {Pid, external, F=loc2} ->
+ {F, catch ?MODULE:loc2()};
+
+ %% External calls to other module
+ {Pid, other, F=exp1} ->
+ {F, catch other:exp1()};
+ {Pid, other, F=loc1} ->
+ {F, catch other:loc1()};
+ {Pid, other, F=exp1exp2} ->
+ {F, catch other:exp1exp2()};
+ {Pid, other, F=exp1loc2} ->
+ {F, catch other:exp1loc2()};
+ {Pid, other, F=loc1exp2} ->
+ {F, catch other:loc1exp2()};
+ {Pid, other, F=loc1loc2} ->
+ {F, catch other:loc1loc2()};
+ {Pid, other, F=exp2} ->
+ {F, catch other:exp2()};
+ {Pid, other, F=loc2} ->
+ {F, catch other:loc2()}
+ end,
+ Pid ! {self(), call_result, Func, Ret},
+
+ dispatch_loop() % A local call, we don't want to upgrade the dispatcher
+ end.
+
+
+
+-ifdef(VERSION_1).
+local_exp1() -> catch exp1().
+local_loc1() -> catch loc1().
+-else.
+local_exp1() ->
+ %%erlang:display({"upgradee:local_exp1 in version", ?VERSION}),
+ {cannot_compile,?VERSION}.
+local_loc1() -> {cannot_compile,?VERSION}.
+-endif.
+
+-ifdef(VERSION_2).
+local_exp2() -> catch exp2().
+local_loc2() -> catch loc2().
+-else.
+local_exp2() ->
+ %%erlang:display({"upgradee:local_exp2 in version", ?VERSION}),
+ {cannot_compile,?VERSION}.
+local_loc2() ->
+ {cannot_compile,?VERSION}.
+-endif.