diff options
author | John Högberg <[email protected]> | 2017-10-25 16:29:37 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2017-11-30 15:44:37 +0100 |
commit | 08901d99137014bd53b999a9fbb0aac893d854e4 (patch) | |
tree | b96b2709f10fb16c958cc69c3a15ecf984f0040e /erts/emulator/test | |
parent | c6f47dd9919c8b1555980a990cbc7af0fd1ca529 (diff) | |
download | otp-08901d99137014bd53b999a9fbb0aac893d854e4.tar.gz otp-08901d99137014bd53b999a9fbb0aac893d854e4.tar.bz2 otp-08901d99137014bd53b999a9fbb0aac893d854e4.zip |
Fix dirty_*if_SUITE after file rewrite
Code loading is done through dirty IO now, causing the
dirty_scheduler_exit tests to fail as they block their own progress
by invoking erts_debug:dirty_io(wait, _); the spawned processes
will exit normally before we have a chance to kill them.
To get around this, we perform a dry run to ensure that all required
code is loaded. It isn't particularly pretty (or fast) but it saves
us the hassle of maintaining a module list (cf. embedded mode).
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/dirty_bif_SUITE.erl | 20 | ||||
-rw-r--r-- | erts/emulator/test/dirty_nif_SUITE.erl | 20 |
2 files changed, 24 insertions, 16 deletions
diff --git a/erts/emulator/test/dirty_bif_SUITE.erl b/erts/emulator/test/dirty_bif_SUITE.erl index 981ec4d48d..f1279a0bd2 100644 --- a/erts/emulator/test/dirty_bif_SUITE.erl +++ b/erts/emulator/test/dirty_bif_SUITE.erl @@ -230,6 +230,11 @@ dirty_scheduler_exit(Config) when is_list(Config) -> {ok, Node} = start_node(Config, "+SDio 1"), [ok] = mcall(Node, [fun() -> + %% Perform a dry run to ensure that all required code + %% is loaded. Otherwise the test will fail since code + %% loading is done through dirty IO and it won't make + %% any progress during this test. + _DryRun = test_dirty_scheduler_exit(), Start = erlang:monotonic_time(millisecond), ok = test_dirty_scheduler_exit(), End = erlang:monotonic_time(millisecond), @@ -250,19 +255,18 @@ test_dse(N,Pids) -> test_dse(N-1,[Pid|Pids]). kill_dse([],Killed) -> - wait_dse(Killed); + wait_dse(Killed, ok); kill_dse([Pid|Pids],AlreadyKilled) -> exit(Pid,kill), kill_dse(Pids,[Pid|AlreadyKilled]). -wait_dse([]) -> - ok; -wait_dse([Pid|Pids]) -> +wait_dse([], Result) -> + Result; +wait_dse([Pid|Pids], Result) -> receive - {'EXIT',Pid,Reason} -> - killed = Reason - end, - wait_dse(Pids). + {'EXIT', Pid, killed} -> wait_dse(Pids, Result); + {'EXIT', Pid, _Other} -> wait_dse(Pids, failed) + end. dirty_call_while_terminated(Config) when is_list(Config) -> Me = self(), diff --git a/erts/emulator/test/dirty_nif_SUITE.erl b/erts/emulator/test/dirty_nif_SUITE.erl index 13806fd5c4..711ecbfe95 100644 --- a/erts/emulator/test/dirty_nif_SUITE.erl +++ b/erts/emulator/test/dirty_nif_SUITE.erl @@ -151,6 +151,11 @@ dirty_scheduler_exit(Config) when is_list(Config) -> [ok] = mcall(Node, [fun() -> ok = erlang:load_nif(NifLib, []), + %% Perform a dry run to ensure that all required code + %% is loaded. Otherwise the test will fail since code + %% loading is done through dirty IO and it won't make + %% any progress during this test. + _DryRun = test_dirty_scheduler_exit(), Start = erlang:monotonic_time(millisecond), ok = test_dirty_scheduler_exit(), End = erlang:monotonic_time(millisecond), @@ -171,19 +176,18 @@ test_dse(N,Pids) -> test_dse(N-1,[Pid|Pids]). kill_dse([],Killed) -> - wait_dse(Killed); + wait_dse(Killed, ok); kill_dse([Pid|Pids],AlreadyKilled) -> exit(Pid,kill), kill_dse(Pids,[Pid|AlreadyKilled]). -wait_dse([]) -> - ok; -wait_dse([Pid|Pids]) -> +wait_dse([], Result) -> + Result; +wait_dse([Pid|Pids], Result) -> receive - {'EXIT',Pid,Reason} -> - killed = Reason - end, - wait_dse(Pids). + {'EXIT', Pid, killed} -> wait_dse(Pids, Result); + {'EXIT', Pid, _Other} -> wait_dse(Pids, failed) + end. dirty_call_while_terminated(Config) when is_list(Config) -> Me = self(), |