diff options
author | Lukas Larsson <[email protected]> | 2015-08-13 17:24:47 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-02-02 10:45:22 +0100 |
commit | a378360ea8d18264e11f201b6d00ed66b9fcfd32 (patch) | |
tree | 71e0a542b7203c72a4674cfa76347e01bfe77699 /erts | |
parent | 6090f9c7e9b0ddbccef357641c1455475b348e94 (diff) | |
download | otp-a378360ea8d18264e11f201b6d00ed66b9fcfd32.tar.gz otp-a378360ea8d18264e11f201b6d00ed66b9fcfd32.tar.bz2 otp-a378360ea8d18264e11f201b6d00ed66b9fcfd32.zip |
erts: Fix msacc testcase on some windowses
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/statistics_SUITE.erl | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl index a1b63716a9..821cb5d897 100644 --- a/erts/emulator/test/statistics_SUITE.erl +++ b/erts/emulator/test/statistics_SUITE.erl @@ -482,30 +482,51 @@ msacc(Config) -> true = erlang:system_flag(microstate_accounting, false), - %% Make sure that all states were triggered at least once - maps:map(fun(nif, 0) -> - case Niff of - ok -> - ct:fail({zero_state,nif}); - nok -> - ok - end; - (aux, 0) -> - %% aux will be zero if we do not have smp support - %% or no async threads - case erlang:system_info(smp_support) orelse - erlang:system_info(thread_pool_size) > 0 of - false -> - ok; - true -> - ct:log("msacc: ~p",[erlang:statistics(microstate_accounting)]), - ct:fail({zero_state,aux}) - end; - (Key, 0) -> - ct:log("msacc: ~p",[erlang:statistics(microstate_accounting)]), - ct:fail({zero_state,Key}); - (_,_) -> ok - end,msacc_sum_states()), + MsaccStats = erlang:statistics(microstate_accounting), + + case os:type() of + {win32, _} -> + %% Some windows have a very poor accuracy on their + %% timing primitives, so we just make sure that + %% some state besides sleep has been triggered. + Sum = lists:sum( + lists:map(fun({sleep, _V}) -> 0; + ({_, V}) -> V + end, maps:to_list(msacc_sum_states())) + ), + if Sum > 0 -> + ok; + true -> + ct:fail({no_states_triggered, MsaccStats}) + end; + _ -> + + %% Make sure that all states were triggered at least once + maps:map(fun(nif, 0) -> + case Niff of + ok -> + ct:fail({zero_state,nif}); + nok -> + ok + end; + (aux, 0) -> + %% aux will be zero if we do not have smp support + %% or no async threads + case erlang:system_info(smp_support) orelse + erlang:system_info(thread_pool_size) > 0 + of + false -> + ok; + true -> + ct:log("msacc: ~p",[MsaccStats]), + ct:fail({zero_state,aux}) + end; + (Key, 0) -> + ct:log("msacc: ~p",[MsaccStats]), + ct:fail({zero_state,Key}); + (_,_) -> ok + end, msacc_sum_states()) + end, erlang:system_flag(microstate_accounting, reset), |