aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/src/reltool_server.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-01-20 17:10:31 +0100
committerSiri Hansen <[email protected]>2012-03-19 09:48:53 +0100
commit610280492bca33c851eabda0a2daf5cf141ea090 (patch)
tree957671deb8bef7fc633eea5a16aafce06f5816e2 /lib/reltool/src/reltool_server.erl
parent06ea8c9f62e265bc045eb92d522e84a5f208f8cd (diff)
downloadotp-610280492bca33c851eabda0a2daf5cf141ea090.tar.gz
otp-610280492bca33c851eabda0a2daf5cf141ea090.tar.bz2
otp-610280492bca33c851eabda0a2daf5cf141ea090.zip
[reltool] Add test case for reltool_server:get_mod
OTP-9794 This test case revealed a bug that occurs when calling reltool_server:get_mod after reltool_server:undo_config. get_mod reads from the module table (ets) and not from the reltool_server state, while undo_config only changes the state. This bug has been corrected, so undo_config now updates both state and tables (it does the same as set_sys).
Diffstat (limited to 'lib/reltool/src/reltool_server.erl')
-rw-r--r--lib/reltool/src/reltool_server.erl30
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl
index fdb9e08a90..7dc2d21158 100644
--- a/lib/reltool/src/reltool_server.erl
+++ b/lib/reltool/src/reltool_server.erl
@@ -266,12 +266,30 @@ loop(#state{common = C, sys = Sys} = S) ->
reltool_utils:reply(ReplyTo, Ref, Status3),
?MODULE:loop(S6);
{call, ReplyTo, Ref, undo_config} ->
- S2 = S#state{sys = S#state.old_sys,
- old_sys = S#state.sys,
- status = S#state.old_status,
- old_status = S#state.status},
- reltool_utils:reply(ReplyTo, Ref, ok),
- ?MODULE:loop(S2);
+ OldSys = S#state.old_sys,
+ S2 = S#state{sys = OldSys,
+ old_sys = Sys},
+ %%! Possibly skip old_status here, since we do all job again!
+ %%! If so, consider if it is correct to use Force or not -
+ %%! since warnings from refresh_app will not re-appear here
+ %%! in undo if Force==false.
+ Force =
+ (OldSys#sys.root_dir =/= Sys#sys.root_dir) orelse
+ (OldSys#sys.lib_dirs =/= Sys#sys.lib_dirs) orelse
+ (OldSys#sys.escripts =/= Sys#sys.escripts),
+
+ {S3, Status} = refresh(S2, Force, S#state.old_status),
+ {S4, Status2} = analyse(S3, Status),
+ S5 =
+ case Status2 of
+ {ok, _Warnings} -> % BUGBUG: handle warnings
+ S4#state{status = Status2, old_status = S#state.status};
+ {error, _} ->
+ %% Keep old state
+ S
+ end,
+ reltool_utils:reply(ReplyTo, Ref, Status2),
+ ?MODULE:loop(S5);
{call, ReplyTo, Ref, {get_rel, RelName}} ->
Sys = S#state.sys,
Reply =