Commits

Fred T-H committed 5e7ae48

refined test suite to catch the exit signal from the manager

Comments (0)

Files changed (1)

src/usr_SUITE.erl

 %% timing out, and that once it stops listening, the user does time out.
 %%--------------------------------------------------------------------
 usr_subscribe(_Config) ->
-    process_flag(trap_exit, true), % only needed for the test to succeed?
     [Id, Sleep, Expected] = [id, 500, [{monitor, id}, id, {manager,id}]],
     IsProc = fun(Name) -> lists:member(Name, global:registered_names()) end,
     usr:start(Id, Sleep, 0),
     timer:sleep(Sleep*3),
     true = lists:all(IsProc, Expected),
     usr:unsubscribe(Id, Handler),
+    process_flag(trap_exit, true),
     timer:sleep(Sleep*3),
     false = lists:any(IsProc, Expected),
+    receive
+        {'EXIT',_Pid, killed} -> ok
+    after 500 ->
+        io:format("Process won't die after the event manager did!~n")
+    end,
     ok.
 
 %%--------------------------------------------------------------------
 %% notified of the user's death and exits the same way.
 %%--------------------------------------------------------------------
 client_aware_crashed_user(_Config) ->
-    process_flag(trap_exit, true), % not actually needed?
     A = make_ref(),
     {ok, H} = client:connect(A),
     usr:terminate(A,kill),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.