diff options
author | Björn Gustavsson <[email protected]> | 2017-06-01 10:32:13 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-06-03 08:45:46 +0200 |
commit | ff1234e3eba1889a9b8cd81cc03f38cac78a67fe (patch) | |
tree | 3858bae2e73b2f5a50ca6e7025d8dcd3ec821311 /erts/emulator | |
parent | 1bb171a7c27fcb79435a915bac834a4013b5f0dc (diff) | |
download | otp-ff1234e3eba1889a9b8cd81cc03f38cac78a67fe.tar.gz otp-ff1234e3eba1889a9b8cd81cc03f38cac78a67fe.tar.bz2 otp-ff1234e3eba1889a9b8cd81cc03f38cac78a67fe.zip |
Robustify process_SUITE:spawn_opt_max_heap_size/1
process_SUITE starts os_mon in init_per_suite/1. Therefore,
there may be occasional alarm info messages received. Make
sure that they are ignored and don't cause the test fail to
fail.
Also, get rid of the flush/0 function that discards all
messages in the message queue. Instead, be more selective
and only discard {error, ...} messages.
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/test/process_SUITE.erl | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl index 180311202f..4204d12eb3 100644 --- a/erts/emulator/test/process_SUITE.erl +++ b/erts/emulator/test/process_SUITE.erl @@ -2074,6 +2074,7 @@ max_heap_size_test(Option, Size, Kill, ErrorLogger) -> end, if ErrorLogger -> receive + %% There must be at least one error message. {error, _, {emulator, _, [Pid|_]}} -> ok end; @@ -2086,22 +2087,33 @@ max_heap_size_test(Option, Size, Kill, ErrorLogger) -> {'DOWN', Ref, process, Pid, die} -> ok end, - flush(); + %% If the process was not killed, the limit may have + %% been reached more than once and there may be + %% more {error, ...} messages left. + receive_error_messages(Pid); true -> ok end, + + %% Make sure that there are no unexpected messages. + receive_unexpected(). + +receive_error_messages(Pid) -> receive - M -> - ct:fail({unexpected_message, M}) - after 10 -> + {error, _, {emulator, _, [Pid|_]}} -> + receive_error_messages(Pid) + after 1000 -> ok end. -flush() -> +receive_unexpected() -> receive - _M -> - flush() - after 1000 -> + {info_report, _, _} -> + %% May be an alarm message from os_mon. Ignore. + receive_unexpected(); + M -> + ct:fail({unexpected_message, M}) + after 10 -> ok end. |