aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/ets_SUITE.erl
diff options
context:
space:
mode:
authorKjell Winblad <[email protected]>2019-04-18 11:33:56 +0200
committerKjell Winblad <[email protected]>2019-04-18 13:27:20 +0200
commit57905f018f7710ce8951bda2dc24cd4f87c8e488 (patch)
tree1b636412f9583fe48519783e724c746133c7227f /lib/stdlib/test/ets_SUITE.erl
parentc4484ca7754a98c0f7d31ab945f1d18881b0d5be (diff)
downloadotp-57905f018f7710ce8951bda2dc24cd4f87c8e488.tar.gz
otp-57905f018f7710ce8951bda2dc24cd4f87c8e488.tar.bz2
otp-57905f018f7710ce8951bda2dc24cd4f87c8e488.zip
Fix broken ETS test case
This commit fixes an ETS test case that tests the decentralized memory counter in tables of type ordered_set with the write_concurrency option turned on. The test case assumed that the memory consumption of the table would only grow monotonically when terms are inserted. However, this was not the case when the emulator was compiled in debug mode as random splits and joins of CA tree nodes could happen. This commit fixes the test case by disabling random splits and joins in the tested table.
Diffstat (limited to 'lib/stdlib/test/ets_SUITE.erl')
-rw-r--r--lib/stdlib/test/ets_SUITE.erl20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index 4640b2b228..dd49288417 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -4461,21 +4461,24 @@ add_loop(T, I) ->
test_table_counter_concurrency(WhatToTest) ->
+ IntStatePrevOn =
+ erts_debug:set_internal_state(available_internal_state, true),
ItemsToAdd = 1000000,
SizeLoopSize = 1000,
T = ets:new(k, [public, ordered_set, {write_concurrency, true}]),
+ erts_debug:set_internal_state(ets_debug_random_split_join, {T, false}),
0 = ets:info(T, size),
P = self(),
SpawnedSizeProcs =
- [spawn(fun() ->
- size_loop(T, SizeLoopSize, 0, WhatToTest),
- P ! done
- end)
+ [spawn_link(fun() ->
+ size_loop(T, SizeLoopSize, 0, WhatToTest),
+ P ! done
+ end)
|| _ <- lists:seq(1, 6)],
- spawn(fun() ->
- add_loop(T, ItemsToAdd),
- P ! done_add
- end),
+ spawn_link(fun() ->
+ add_loop(T, ItemsToAdd),
+ P ! done_add
+ end),
[receive
done -> ok;
done_add -> ok
@@ -4487,6 +4490,7 @@ test_table_counter_concurrency(WhatToTest) ->
_ ->
ok
end,
+ erts_debug:set_internal_state(available_internal_state, IntStatePrevOn),
ok.
test_table_size_concurrency(Config) when is_list(Config) ->