aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/test/reltool_wx_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-03-21 19:19:43 +0100
committerSiri Hansen <[email protected]>2012-03-21 19:19:43 +0100
commit2497698a1715462d8785179eacb9975adb35a767 (patch)
treee63a1a1b3d16a18c421768f26b2eedfdd855dc1d /lib/reltool/test/reltool_wx_SUITE.erl
parent8c5a3a78d3ae0bd1261226d97e0b2197bbbb0d07 (diff)
parent33e42a694e0ddd8a6c02bfe6c04298ca95aa938a (diff)
downloadotp-2497698a1715462d8785179eacb9975adb35a767.tar.gz
otp-2497698a1715462d8785179eacb9975adb35a767.tar.bz2
otp-2497698a1715462d8785179eacb9975adb35a767.zip
Merge branch 'maint'
Diffstat (limited to 'lib/reltool/test/reltool_wx_SUITE.erl')
-rw-r--r--lib/reltool/test/reltool_wx_SUITE.erl43
1 files changed, 40 insertions, 3 deletions
diff --git a/lib/reltool/test/reltool_wx_SUITE.erl b/lib/reltool/test/reltool_wx_SUITE.erl
index 424bc7d189..13d71f4fd6 100644
--- a/lib/reltool/test/reltool_wx_SUITE.erl
+++ b/lib/reltool/test/reltool_wx_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2012. All Rights Reserved.
%%
%% 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
@@ -61,9 +61,46 @@ start_all_windows(TestInfo) when is_atom(TestInfo) ->
reltool_test_lib:tc_info(TestInfo);
start_all_windows(_Config) ->
{ok, SysPid} = ?msym({ok, _}, reltool:start([{trap_exit, false}])),
+ erlang:monitor(process,SysPid),
{ok, AppPid} = ?msym({ok, _}, reltool_sys_win:open_app(SysPid, stdlib)),
- ?msym({ok, _}, reltool_app_win:open_mod(AppPid, escript)),
+ erlang:monitor(process,AppPid),
+ {ok, ModPid} = ?msym({ok, _}, reltool_app_win:open_mod(AppPid, escript)),
+ erlang:monitor(process,ModPid),
+
+ %% Let all windows get started
timer:sleep(timer:seconds(10)),
+
+ %% Test that server pid can be fetched, and that server is alive
+ {ok, Server} = ?msym({ok,_}, reltool:get_server(SysPid)),
+ ?m(true, erlang:is_process_alive(Server)),
+ ?m({ok,{sys,[]}}, reltool:get_config(Server)),
+
+ %% Terminate
+ check_no_win_crash(),
?m(ok, reltool:stop(SysPid)),
-
+ wait_terminate([{sys,SysPid},{app,AppPid},{mod,ModPid}]),
+
ok.
+
+
+%%%-----------------------------------------------------------------
+%%% Internal functions
+check_no_win_crash() ->
+ receive {'DOWN',_,_,_,_} = Down ->
+ ct:log("Unexpected termination of window:~n~p",[Down]),
+ ct:fail("window crashed")
+ after 0 ->
+ ok
+ end.
+
+wait_terminate([]) ->
+ ok;
+wait_terminate([{Win,P}|Rest]) ->
+ receive
+ {'DOWN',_,process,P,shutdown} ->
+ wait_terminate(Rest);
+ {'DOWN',_,process,P,Reason} ->
+ ct:log("~p window terminated with unexpected reason:~n~p",
+ [Win,Reason]),
+ ct:fail("unexpected exit reason from window")
+ end.