aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/bs_construct_SUITE.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2015-11-20 15:25:30 +0100
committerMagnus Lång <[email protected]>2015-11-27 18:18:38 +0100
commitfa4cc49b0e64b655a167a5daceb2f16252102fc6 (patch)
tree67535050fcc189fe47821a1d1abcbb8358e5ed6b /erts/emulator/test/bs_construct_SUITE.erl
parentbac7c55f9a9250f6edb57170530d567df6c92f29 (diff)
downloadotp-fa4cc49b0e64b655a167a5daceb2f16252102fc6.tar.gz
otp-fa4cc49b0e64b655a167a5daceb2f16252102fc6.tar.bz2
otp-fa4cc49b0e64b655a167a5daceb2f16252102fc6.zip
Add missing corner-case to bs_construct_SUITE
huge_binary/1 did not consider that the Shift variable is not a constant, and misses the case of a literal size.
Diffstat (limited to 'erts/emulator/test/bs_construct_SUITE.erl')
-rw-r--r--erts/emulator/test/bs_construct_SUITE.erl22
1 files changed, 18 insertions, 4 deletions
diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl
index cadb30e1a4..1afd01e27b 100644
--- a/erts/emulator/test/bs_construct_SUITE.erl
+++ b/erts/emulator/test/bs_construct_SUITE.erl
@@ -551,10 +551,24 @@ huge_binary(Config) when is_list(Config) ->
?line 16777216 = size(<<0:(id(1 bsl 26)),(-1):(id(1 bsl 26))>>),
?line garbage_collect(),
{Shift,Return} = case free_mem() of
- undefined -> {32,ok};
- Mb when Mb > 600 -> {32,ok};
- Mb when Mb > 300 -> {31,"Limit huge binaries to 256 Mb"};
- _ -> {30,"Limit huge binary to 128 Mb"}
+ undefined ->
+ %% This test has to be inlined inside the case to
+ %% use a literal Shift
+ ?line garbage_collect(),
+ ?line id(<<0:((1 bsl 32)-1)>>),
+ {32,ok};
+ Mb when Mb > 600 ->
+ ?line garbage_collect(),
+ ?line id(<<0:((1 bsl 32)-1)>>),
+ {32,ok};
+ Mb when Mb > 300 ->
+ ?line garbage_collect(),
+ ?line id(<<0:((1 bsl 31)-1)>>),
+ {31,"Limit huge binaries to 256 Mb"};
+ _ ->
+ ?line garbage_collect(),
+ ?line id(<<0:((1 bsl 30)-1)>>),
+ {30,"Limit huge binary to 128 Mb"}
end,
?line garbage_collect(),
?line id(<<0:((1 bsl Shift)-1)>>),