aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/test
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-02-15 16:36:27 +0100
committerSiri Hansen <[email protected]>2012-03-19 09:48:54 +0100
commit6f5e3e16019a3a4f9e9033d185b9c487967ad5fa (patch)
tree3d81f6e42a74e45e43ad4b305659bcd3b19e1618 /lib/reltool/test
parente3bb31270b1cc43a72a2c3942f496e5c8f93155b (diff)
downloadotp-6f5e3e16019a3a4f9e9033d185b9c487967ad5fa.tar.gz
otp-6f5e3e16019a3a4f9e9033d185b9c487967ad5fa.tar.bz2
otp-6f5e3e16019a3a4f9e9033d185b9c487967ad5fa.zip
[reltool] Update state and tables consistently for all types of config changes
OTP-9794 OTP-9968 The main idea behind the data structure in reltool_server is that the state shall reflect what is explicitly configured, and the tables shall contain this configuration plus everything that is derived. In some cases, however, this was not the complete truth: * the application table was never read * the module table was never updated on undo * the state contained a lot more than what was explicitly configured This commit re-writes major parts of the reltool_server for the sake of unifying the way the state and tables are updated: * The list of applications in the state now only contains those applications and modules for which there are explicit settings in the configuration (given at startup or changed from the GUI) * When changing any bit of the configuration, the tables are always emptied and every part is derived again from the configuration found in the state * All configuration changes now cause a re-read of the file system, meaning that if something has changed in the file system it will be reflected in the result of the configuration change. This is the case even if no file system related configuration is changed (e.g. root dir or lib dirs) (*POSSIBLE INCOMPATIBILITY*) * Requests for applications and modules from the GUI now always read the tables, not the state * When loading a new configuration file via the GUI, the old configuration is completly scratched, and only the new is valid (*POSSIBLE INCOMPATIBILITY*) * The handling of escripts which include archives of applications is changed to always produce one #app record for the escript in addition to one for each inlined application. All modules are listed as parts of the inlined application where it belongs and not as part of the escript's #app record. This is a temporary solution which will be modified and improved. The following bugs are corrected by this commit: * Loading a config which contains an escript via the GUI menu did not produce the same #app record as when loading the same configuration at reltool start. Paths, version and label could differ. * Loading config with same escript (source) twice caused reltool to add same module twice in #app.mods * Loading config with same escript (inlined beam) twice caused reltool to fail saying module is included by two different applications * Loading config which in addition to an existing escript also adds another escript for which the name sorts before the existing one would cause reltool to fail saying "Application name clash"
Diffstat (limited to 'lib/reltool/test')
-rw-r--r--lib/reltool/test/reltool_server_SUITE.erl37
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl
index 56c9cb5ed1..f2b63f78f0 100644
--- a/lib/reltool/test/reltool_server_SUITE.erl
+++ b/lib/reltool/test/reltool_server_SUITE.erl
@@ -1192,8 +1192,10 @@ set_app_and_undo(Config) ->
ExclCover = Cover#mod{incl_cond=exclude},
Mods = Tools#app.mods,
Tools1 = Tools#app{mods = lists:keyreplace(cover,#mod.name,Mods,ExclCover)},
- {ok,ToolsNoCover,[]} = ?msym({ok,_,[]}, reltool_server:set_app(Pid,Tools1)),
- ?m({ok,[]}, reltool_server:get_status(Pid)),
+ {ok,ToolsNoCover,["a: Cannot parse app file"++_|_]} =
+ ?msym({ok,_,["a: Cannot parse app file"++_|_]},
+ reltool_server:set_app(Pid,Tools1)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:get_status(Pid)),
%% Check that the module is no longer included
?m({ok,ToolsNoCover}, reltool_server:get_app(Pid,tools)),
@@ -1201,17 +1203,16 @@ set_app_and_undo(Config) ->
reltool_server:get_mod(Pid,cover)),
%% Undo
- %%! warning can come twice here... :(
?msym({ok,["a: Cannot parse app file"++_|_]},reltool_server:undo_config(Pid)),
?m({ok,Tools}, reltool_server:get_app(Pid,tools)),
?m({ok,Cover}, reltool_server:get_mod(Pid,cover)),
?msym({ok,["a: Cannot parse app file"++_|_]},reltool_server:get_status(Pid)),
%% Undo again, to check that it toggles
- ?m({ok,[]}, reltool_server:undo_config(Pid)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:undo_config(Pid)),
?m({ok,ToolsNoCover}, reltool_server:get_app(Pid,tools)),
?m({ok,NoIncludeCover}, reltool_server:get_mod(Pid,cover)),
- ?m({ok,[]}, reltool_server:get_status(Pid)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:get_status(Pid)),
?m(ok, reltool:stop(Pid)),
ok.
@@ -1238,8 +1239,9 @@ set_apps_and_undo(Config) ->
%% Exclude one application with set_apps
ExclTools = Tools#app{incl_cond=exclude},
- ?m({ok,[]}, reltool_server:set_apps(Pid,[ExclTools])),
- ?m({ok,[]}, reltool_server:get_status(Pid)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]},
+ reltool_server:set_apps(Pid,[ExclTools])),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:get_status(Pid)),
%% Check that the app and its modules (one of them) are no longer included
{ok,NoTools} = ?msym({ok,_}, reltool_server:get_app(Pid,tools)),
@@ -1249,17 +1251,16 @@ set_apps_and_undo(Config) ->
reltool_server:get_mod(Pid,cover)),
%% Undo
- %%! warning can come twice here... :(
?msym({ok,["a: Cannot parse app file"++_|_]},reltool_server:undo_config(Pid)),
?m({ok,Tools}, reltool_server:get_app(Pid,tools)),
?m({ok,Cover}, reltool_server:get_mod(Pid,cover)),
?msym({ok,["a: Cannot parse app file"++_|_]},reltool_server:get_status(Pid)),
%% Undo again, to check that it toggles
- ?m({ok,[]}, reltool_server:undo_config(Pid)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:undo_config(Pid)),
?m({ok,NoTools}, reltool_server:get_app(Pid,tools)),
?m({ok,NoIncludeCover}, reltool_server:get_mod(Pid,cover)),
- ?m({ok,[]}, reltool_server:get_status(Pid)),
+ ?msym({ok,["a: Cannot parse app file"++_|_]}, reltool_server:get_status(Pid)),
?m(ok, reltool:stop(Pid)),
ok.
@@ -1327,7 +1328,7 @@ load_config_and_undo(Config) ->
{app,sasl,[{incl_cond,include}]},
{app,stdlib,[{incl_cond,include}]},
{app,tools,[{incl_cond,derived}]}]},
- ?msym({ok,["a: Cannot parse app file"++_]},
+ ?msym({ok,["a: Cannot parse app file"++_|_]},
reltool_server:load_config(Pid,Sys2)),
%%% OTP-0702, 15) ?m({ok, Sys2}, reltool:get_config(Pid)),
%%% Note that {incl_cond,exclude} is removed compared to Sys1 -
@@ -1363,7 +1364,6 @@ load_config_and_undo(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load config with escript
-load_config_escript_path(_Config) -> {skip,"Known bug: loading config with escript at reltool start creates different #app record than loading same config with load_config"};
load_config_escript_path(Config) ->
%% Create escript
DataDir = ?config(data_dir,Config),
@@ -1411,7 +1411,6 @@ load_config_escript_path(Config) ->
%% Load config with same (source) escript twice and check that the
%% application information is not changed.
-load_config_same_escript_source(_Config) -> {skip,"Known bug: loading config with same escript (source) twice causes reltool to add same module twice in #app.mods"};
load_config_same_escript_source(_Config) ->
%% Create escript
ExDir = code:lib_dir(reltool, examples),
@@ -1428,12 +1427,14 @@ load_config_same_escript_source(_Config) ->
]},
{ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Sys}])),
- {ok,[#app{name='*escript* display_args'}=A]} =
- ?msym({ok,[_]}, reltool_server:get_apps(Pid,whitelist)),
+% {ok,[#app{name='*escript* display_args'}]} =
+ ?msym({ok,[#app{name='*escript* display_args',mods=[_]}]},
+ reltool_server:get_apps(Pid,whitelist)),
%% Load the same config again, then check that app is not changed
?m({ok,[]}, reltool_server:load_config(Pid,Sys)),
- ?m({ok,[A]}, reltool_server:get_apps(Pid,whitelist)),
+ ?msym({ok,[#app{name='*escript* display_args',mods=[_]}]},
+ reltool_server:get_apps(Pid,whitelist)),
?m(ok, reltool:stop(Pid)),
@@ -1443,7 +1444,6 @@ load_config_same_escript_source(_Config) ->
%% Load config with same (beam) escript twice and check that the
%% application information is not changed.
-load_config_same_escript_beam(_Config) -> {skip,"Known bug: loading config with same escript (with inlined beam) twice causes reltool to fail and say module is included by two different applications"};
load_config_same_escript_beam(Config) ->
%% Create escript
DataDir = ?config(data_dir,Config),
@@ -1478,8 +1478,6 @@ load_config_same_escript_beam(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load config with escript
-%% BUG: see OTP-9792, 25)
-load_config_add_escript(_Config) -> {skip,"Known bug: Can not load_config which in addition to an existing escript also adds another escript for which the name sorts before the existing one"};
load_config_add_escript(Config) ->
%% First escript
ExDir = code:lib_dir(reltool, examples),
@@ -1566,7 +1564,6 @@ reset_config_and_undo(Config) ->
reltool_server:get_mod(Pid,cover)),
%% Reset
- %%! warning can come twice here... :(
?msym({ok,["a: Cannot parse app file"++_|_]},
reltool_server:reset_config(Pid)),
?m({ok,Tools1}, reltool_server:get_app(Pid,tools)),