aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/reltool/test')
-rw-r--r--lib/reltool/test/reltool_server_SUITE.erl182
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/Makefile.src13
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app6
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore0
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl4
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app6
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl4
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app6
-rw-r--r--lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl4
9 files changed, 209 insertions, 16 deletions
diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl
index 4e24a2fb55..8a98dc36cf 100644
--- a/lib/reltool/test/reltool_server_SUITE.erl
+++ b/lib/reltool/test/reltool_server_SUITE.erl
@@ -88,7 +88,9 @@ all() ->
reset_config_and_undo,
gen_rel_files,
save_config,
- dependencies].
+ dependencies,
+ use_selected_vsn,
+ use_selected_vsn_relative_path].
groups() ->
[].
@@ -150,10 +152,15 @@ get_config(_Config) ->
StdVsn = latest(stdlib),
SaslVsn = latest(sasl),
+ LibDir = code:lib_dir(),
+ KLibDir = filename:join(LibDir,"kernel-"++KVsn),
+ StdLibDir = filename:join(LibDir,"stdlib-"++StdVsn),
+ SaslLibDir = filename:join(LibDir,"sasl-"++SaslVsn),
+
Sys = {sys,[{incl_cond, exclude},
{app,kernel,[{incl_cond,include}]},
{app,sasl,[{incl_cond,include},{vsn,SaslVsn}]},
- {app,stdlib,[{incl_cond,include}]}]},
+ {app,stdlib,[{incl_cond,include},{lib_dir,StdLibDir}]}]},
{ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Sys}])),
?m({ok, Sys}, reltool:get_config(Pid)),
?m({ok, Sys}, reltool:get_config(Pid,false,false)),
@@ -163,7 +170,8 @@ get_config(_Config) ->
{erts,[]},
{app,kernel,[{incl_cond,include},{mod,_,[]}|_]},
{app,sasl,[{incl_cond,include},{vsn,SaslVsn},{mod,_,[]}|_]},
- {app,stdlib,[{incl_cond,include},{mod,_,[]}|_]}]}},
+ {app,stdlib,[{incl_cond,include},{lib_dir,StdLibDir},
+ {mod,_,[]}|_]}]}},
reltool:get_config(Pid,false,true)),
%% Include defaults
@@ -171,9 +179,12 @@ get_config(_Config) ->
{lib_dirs,_},
{mod_cond,all},
{incl_cond,exclude},
- {app,kernel,[{incl_cond,include},{vsn,undefined}]},
- {app,sasl,[{incl_cond,include},{vsn,SaslVsn}]},
- {app,stdlib,[{incl_cond,include},{vsn,undefined}]},
+ {app,kernel,[{incl_cond,include},{vsn,undefined},
+ {lib_dir,undefined}]},
+ {app,sasl,[{incl_cond,include},{vsn,SaslVsn},
+ {lib_dir,undefined}]},
+ {app,stdlib,[{incl_cond,include},{vsn,undefined},
+ {lib_dir,StdLibDir}]},
{boot_rel,"start_clean"},
{rel,"start_clean","1.0",[]},
{rel,"start_sasl","1.0",[sasl]},
@@ -198,9 +209,12 @@ get_config(_Config) ->
{mod_cond,all},
{incl_cond,exclude},
{erts,[]},
- {app,kernel,[{incl_cond,include},{vsn,KVsn},{mod,_,[]}|_]},
- {app,sasl,[{incl_cond,include},{vsn,SaslVsn},{mod,_,[]}|_]},
- {app,stdlib,[{incl_cond,include},{vsn,StdVsn},{mod,_,[]}|_]},
+ {app,kernel,[{incl_cond,include},{vsn,KVsn},
+ {lib_dir,KLibDir},{mod,_,[]}|_]},
+ {app,sasl,[{incl_cond,include},{vsn,SaslVsn},
+ {lib_dir,SaslLibDir},{mod,_,[]}|_]},
+ {app,stdlib,[{incl_cond,include},{vsn,StdVsn},
+ {lib_dir,StdLibDir},{mod,_,[]}|_]},
{boot_rel,"start_clean"},
{rel,"start_clean","1.0",[]},
{rel,"start_sasl","1.0",[sasl]},
@@ -1804,9 +1818,12 @@ save_config(Config) ->
{lib_dirs,_},
{mod_cond,all},
{incl_cond,exclude},
- {app,kernel,[{incl_cond,include},{vsn,undefined}]},
- {app,sasl,[{incl_cond,include},{vsn,undefined}]},
- {app,stdlib,[{incl_cond,include},{vsn,undefined}]},
+ {app,kernel,[{incl_cond,include},{vsn,undefined},
+ {lib_dir,undefined}]},
+ {app,sasl,[{incl_cond,include},{vsn,undefined},
+ {lib_dir,undefined}]},
+ {app,stdlib,[{incl_cond,include},{vsn,undefined},
+ {lib_dir,undefined}]},
{boot_rel,"start_clean"},
{rel,"start_clean","1.0",[]},
{rel,"start_sasl","1.0",[sasl]},
@@ -1827,6 +1844,12 @@ save_config(Config) ->
KVsn = latest(kernel),
StdVsn = latest(stdlib),
+ SaslVsn = latest(sasl),
+
+ LibDir = code:lib_dir(),
+ KLibDir = filename:join(LibDir,"kernel-"++KVsn),
+ StdLibDir = filename:join(LibDir,"stdlib-"++StdVsn),
+ SaslLibDir = filename:join(LibDir,"sasl-"++SaslVsn),
All = filename:join(PrivDir,"save_all.reltool"),
?m(ok, reltool_server:save_config(Pid,All,true,true)),
@@ -1835,9 +1858,12 @@ save_config(Config) ->
{mod_cond,all},
{incl_cond,exclude},
{erts,[]},
- {app,kernel,[{incl_cond,include},{vsn,KVsn},{mod,_,[]}|_]},
- {app,sasl,[{incl_cond,include},{vsn,_},{mod,_,[]}|_]},
- {app,stdlib,[{incl_cond,include},{vsn,StdVsn},{mod,_,[]}|_]},
+ {app,kernel,[{incl_cond,include},{vsn,KVsn},
+ {lib_dir,KLibDir},{mod,_,[]}|_]},
+ {app,sasl,[{incl_cond,include},{vsn,SaslVsn},
+ {lib_dir,SaslLibDir},{mod,_,[]}|_]},
+ {app,stdlib,[{incl_cond,include},{vsn,StdVsn},
+ {lib_dir,StdLibDir},{mod,_,[]}|_]},
{boot_rel,"start_clean"},
{rel,"start_clean","1.0",[]},
{rel,"start_sasl","1.0",[sasl]},
@@ -1996,6 +2022,132 @@ dependencies(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+use_selected_vsn(Config) ->
+ LibDir1 = filename:join(datadir(Config),"use_selected_vsn"),
+ B1Dir = filename:join(LibDir1,"b-1.0"),
+ B3Dir = filename:join(LibDir1,"b-3.0"),
+
+ LibDir2 = filename:join(LibDir1,"lib2"),
+ B2Dir = filename:join(LibDir2,"b-2.0"),
+
+ %%-----------------------------------------------------------------
+ %% Pre-selected vsn of app b
+ Sys1 = {sys,[{lib_dirs,[LibDir1]},
+ {incl_cond, exclude},
+ {app,kernel,[{incl_cond,include}]},
+ {app,sasl,[{incl_cond,include}]},
+ {app,stdlib,[{incl_cond,include}]},
+ {app,b,[{incl_cond,include},{vsn,"1.0"}]}]},
+ {ok, Pid1} = ?msym({ok, _}, reltool:start_server([{config, Sys1}])),
+ {ok,B11} = ?msym({ok,#app{vsn="1.0",active_dir=B1Dir}},
+ reltool_server:get_app(Pid1,b)),
+
+ %% Change from a pre-selected vsn to use a specific dir
+ ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []},
+ reltool_server:set_app(Pid1,
+ B11#app{active_dir = B3Dir,
+ use_selected_vsn = dir,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ ?m(ok, reltool:stop(Pid1)),
+
+
+ %%-----------------------------------------------------------------
+ %% Pre-selected vsn of app b
+ Sys2 = {sys,[{lib_dirs,[LibDir1]},
+ {incl_cond, exclude},
+ {app,kernel,[{incl_cond,include}]},
+ {app,sasl,[{incl_cond,include}]},
+ {app,stdlib,[{incl_cond,include}]},
+ {app,b,[{incl_cond,include},{vsn,"1.0"}]}]},
+ {ok, Pid2} = ?msym({ok, _}, reltool:start_server([{config, Sys2}])),
+ {ok,B21} = ?msym({ok,#app{vsn="1.0",active_dir=B1Dir}},
+ reltool_server:get_app(Pid2,b)),
+
+ %% Change from a pre-selected vsn to use latest
+ ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []},
+ reltool_server:set_app(Pid2,
+ B21#app{use_selected_vsn=undefined,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ ?m(ok, reltool:stop(Pid2)),
+
+
+ %%-----------------------------------------------------------------
+ %% Pre-selected directory for app b
+ Sys3 = {sys,[{lib_dirs,[LibDir1]},
+ {incl_cond, exclude},
+ {app,kernel,[{incl_cond,include}]},
+ {app,sasl,[{incl_cond,include}]},
+ {app,stdlib,[{incl_cond,include}]},
+ {app,b,[{incl_cond,include},{lib_dir,B2Dir}]}]},
+ {ok, Pid3} = ?msym({ok, _}, reltool:start_server([{config, Sys3}])),
+% test_server:break("Pid3 = list_to_pid(\""++pid_to_list(Pid3)++"\")."),
+ {ok,B31} = ?msym({ok,#app{vsn="2.0",active_dir=B2Dir}},
+ reltool_server:get_app(Pid3,b)),
+ %% Change from a pre-selected dir to use latest
+ {ok,B32,_} = ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []},
+ reltool_server:set_app(Pid3,
+ B31#app{use_selected_vsn=undefined,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ %% Change back to use selected dir
+ {ok,B33,_} = ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []},
+ reltool_server:set_app(Pid3,
+ B32#app{use_selected_vsn = dir})),
+ %% use dir 1
+ {ok,B34,_} = ?msym({ok, #app{vsn ="1.0", active_dir = B1Dir}, []},
+ reltool_server:set_app(Pid3,
+ B33#app{active_dir = B1Dir,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ %% use dir 2
+ {ok,B35,_} = ?msym({ok, #app{vsn ="2.0", active_dir = B2Dir}, []},
+ reltool_server:set_app(Pid3,
+ B34#app{active_dir = B2Dir,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ %% use dir 3
+ ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []},
+ reltool_server:set_app(Pid3,
+ B35#app{active_dir = B3Dir,
+ label = undefined,
+ vsn = undefined,
+ info = undefined})),
+ ?m(ok, reltool:stop(Pid3)),
+ ok.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+use_selected_vsn_relative_path(Config) ->
+ LibDir = filename:join([datadir(Config),"use_selected_vsn","b-1.0"]),
+ RelDir = filename:join(LibDir,"rel"),
+
+ {ok,Cwd} = file:get_cwd(),
+ ok = file:set_cwd(RelDir),
+
+ Sys = {sys,[{incl_cond, exclude},
+ {app,kernel,[{incl_cond,include}]},
+ {app,sasl,[{incl_cond,include}]},
+ {app,stdlib,[{incl_cond,include}]},
+ {app,b,[{incl_cond,include},{lib_dir,".."}]}]},
+ {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Sys}])),
+
+ ?msym({ok,#app{vsn="1.0",active_dir=LibDir}},reltool_server:get_app(Pid,b)),
+
+ ?m(ok, reltool:stop(Pid)),
+
+ ok = file:set_cwd(Cwd),
+ ok.
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Library functions
erl_libs() ->
diff --git a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
index 8ab077d64b..21410ceaa9 100644
--- a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
+++ b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src
@@ -17,8 +17,12 @@ DEPENDENCIES= \
ESCRIPT= \
escript/someapp-1.0/ebin/mymod.@EMULATOR@
+SEL_VSN= \
+ use_selected_vsn/b-1.0/ebin/b.@EMULATOR@ \
+ use_selected_vsn/b-3.0/ebin/b.@EMULATOR@ \
+ use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@
-all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT)
+all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT) $(SEL_VSN)
otp_9229/x-1.0/ebin/x.@EMULATOR@: otp_9229/x-1.0/src/x.erl
erlc $(EFLAGS) -ootp_9229/x-1.0/ebin otp_9229/x-1.0/src/x.erl
@@ -44,3 +48,10 @@ dependencies/z-1.0/ebin/z1.@EMULATOR@: dependencies/z-1.0/src/z1.erl
escript/someapp-1.0/ebin/mymod.@EMULATOR@: escript/someapp-1.0/src/mymod.erl
erlc $(EFLAGS) -oescript/someapp-1.0/ebin escript/someapp-1.0/src/mymod.erl
+
+use_selected_vsn/b-1.0/ebin/b.@EMULATOR@: use_selected_vsn/b-1.0/src/b.erl
+ erlc $(EFLAGS) -ouse_selected_vsn/b-1.0/ebin use_selected_vsn/b-1.0/src/b.erl
+use_selected_vsn/b-3.0/ebin/b.@EMULATOR@: use_selected_vsn/b-3.0/src/b.erl
+ erlc $(EFLAGS) -ouse_selected_vsn/b-3.0/ebin use_selected_vsn/b-3.0/src/b.erl
+use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@: use_selected_vsn/lib2/b-2.0/src/b.erl
+ erlc $(EFLAGS) -ouse_selected_vsn/lib2/b-2.0/ebin use_selected_vsn/lib2/b-2.0/src/b.erl
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app
new file mode 100644
index 0000000000..c511dcc8f1
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app
@@ -0,0 +1,6 @@
+%% -*- erlang -*-
+{application, b,
+ [{description, "Reltool test app for using selected version of app"},
+ {vsn, "1.0"},
+ {modules, [b]},
+ {applications, [kernel, stdlib]}]}.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl
new file mode 100644
index 0000000000..a6b4ff1c05
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl
@@ -0,0 +1,4 @@
+-module(b).
+-compile(export_all).
+
+foo() -> ok.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app
new file mode 100644
index 0000000000..9ed7695a40
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app
@@ -0,0 +1,6 @@
+%% -*- erlang -*-
+{application, b,
+ [{description, "Reltool test app for using selected version of app"},
+ {vsn, "3.0"},
+ {modules, [b]},
+ {applications, [kernel, stdlib]}]}.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl
new file mode 100644
index 0000000000..a6b4ff1c05
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl
@@ -0,0 +1,4 @@
+-module(b).
+-compile(export_all).
+
+foo() -> ok.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app
new file mode 100644
index 0000000000..33c633d635
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app
@@ -0,0 +1,6 @@
+%% -*- erlang -*-
+{application, b,
+ [{description, "Reltool test app for using selected version of app"},
+ {vsn, "2.0"},
+ {modules, [b]},
+ {applications, [kernel, stdlib]}]}.
diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl
new file mode 100644
index 0000000000..a6b4ff1c05
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl
@@ -0,0 +1,4 @@
+-module(b).
+-compile(export_all).
+
+foo() -> ok.