diff options
author | Lukas Larsson <lukas@erix.ericsson.se> | 2011-01-21 19:10:42 +0100 |
---|---|---|
committer | Lukas Larsson <lukas@erix.ericsson.se> | 2011-02-17 17:39:00 +0100 |
commit | ede974119a7642cf3b85dc370090e80862191dd7 (patch) | |
tree | 4bcc45690fcaef78f3ad4f71b4f6620d50060ecb /lib/stdlib/test/supervisor_SUITE.erl | |
parent | fe7ebc1e78bb0c91c74403047802c5061e918b0d (diff) | |
download | otp-ede974119a7642cf3b85dc370090e80862191dd7.tar.gz otp-ede974119a7642cf3b85dc370090e80862191dd7.tar.bz2 otp-ede974119a7642cf3b85dc370090e80862191dd7.zip |
Update so that count_children_memory is skipped on +Meamin emulators
Diffstat (limited to 'lib/stdlib/test/supervisor_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/supervisor_SUITE.erl | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl index f751b06189..714db26fa3 100644 --- a/lib/stdlib/test/supervisor_SUITE.erl +++ b/lib/stdlib/test/supervisor_SUITE.erl @@ -24,7 +24,8 @@ %% Testserver specific export -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). + init_per_group/2,end_per_group/2, init_per_testcase/2, + end_per_testcase/2]). %% Indirect spawn export -export([init/1]). @@ -103,6 +104,18 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +init_per_testcase(count_children_memory, Config) -> + MemoryState = erlang:system_info(allocator), + case count_children_allocator_test(MemoryState) of + true -> Config; + false -> + {skip, "+Meamin used during test; erlang:memory/1 not available"} + end; +init_per_testcase(_Case, Config) -> + Config. + +end_per_testcase(_Case, _Config) -> + ok. start(InitResult) -> @@ -1273,26 +1286,8 @@ tree(Config) when is_list(Config) -> ok. %------------------------------------------------------------------------- -count_children_allocator_test(MemoryState) -> - Allocators = [temp_alloc, eheap_alloc, binary_alloc, ets_alloc, - driver_alloc, sl_alloc, ll_alloc, fix_alloc, std_alloc, - sys_alloc], - MemoryStateList = element(4, MemoryState), - AllocTypes = [lists:keyfind(Alloc, 1, MemoryStateList) - || Alloc <- Allocators], - AllocStates = [lists:keyfind(e, 1, AllocValue) - || {_Type, AllocValue} <- AllocTypes], - lists:all(fun(State) -> State == {e, true} end, AllocStates). - count_children_memory(doc) -> ["Test that which_children eats memory, but count_children does not."]; -count_children_memory(suite) -> - MemoryState = erlang:system_info(allocator), - case count_children_allocator_test(MemoryState) of - true -> []; - false -> - {skip, "+Meamin used during test; erlang:memory/1 not available"} - end; count_children_memory(Config) when is_list(Config) -> process_flag(trap_exit, true), Child = {child, {supervisor_1, start_child, []}, temporary, 1000, @@ -1358,3 +1353,14 @@ count_children_memory(Config) when is_list(Config) -> ?line [1,0,0,0] = get_child_counts(sup_test), ok. + +count_children_allocator_test(MemoryState) -> + Allocators = [temp_alloc, eheap_alloc, binary_alloc, ets_alloc, + driver_alloc, sl_alloc, ll_alloc, fix_alloc, std_alloc, + sys_alloc], + MemoryStateList = element(4, MemoryState), + AllocTypes = [lists:keyfind(Alloc, 1, MemoryStateList) + || Alloc <- Allocators], + AllocStates = [lists:keyfind(e, 1, AllocValue) + || {_Type, AllocValue} <- AllocTypes], + lists:all(fun(State) -> State == {e, true} end, AllocStates). |