diff options
author | Lukas Larsson <[email protected]> | 2016-06-03 16:46:52 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-06-14 10:09:38 +0200 |
commit | d837c512bff62d5ad932cda615a340ad088a8999 (patch) | |
tree | 9c721f789624e5cc42d12cf7bf089dcebcec0212 /erts/emulator/test/bs_construct_SUITE.erl | |
parent | 7c300789fffeacb24f1d00aa6e0797e06166c3c6 (diff) | |
download | otp-d837c512bff62d5ad932cda615a340ad088a8999.tar.gz otp-d837c512bff62d5ad932cda615a340ad088a8999.tar.bz2 otp-d837c512bff62d5ad932cda615a340ad088a8999.zip |
erts: Ensure bs_add_overflow test has enough memory
Diffstat (limited to 'erts/emulator/test/bs_construct_SUITE.erl')
-rw-r--r-- | erts/emulator/test/bs_construct_SUITE.erl | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl index 941cb435f7..4a2bbf69fd 100644 --- a/erts/emulator/test/bs_construct_SUITE.erl +++ b/erts/emulator/test/bs_construct_SUITE.erl @@ -23,6 +23,7 @@ -module(bs_construct_SUITE). -export([all/0, suite/0, + init_per_suite/1, end_per_suite/1, test1/1, test2/1, test3/1, test4/1, test5/1, testf/1, not_used/1, in_guard/1, mem_leak/1, coerce_to_float/1, bjorn/1, @@ -43,6 +44,12 @@ all() -> copy_writable_binary, kostis, dynamic, bs_add, otp_7422, zero_width, bad_append, bs_add_overflow]. +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + application:stop(os_mon). + big(1) -> 57285702734876389752897683. @@ -906,10 +913,14 @@ append_unit_16(Bin) -> %% Produce a large result of bs_add that, if cast to signed int, would overflow %% into a negative number that fits a smallnum. -bs_add_overflow(Config) -> +bs_add_overflow(_Config) -> + Memsize = memsize(), + io:format("Memsize = ~w Bytes~n", [Memsize]), case erlang:system_info(wordsize) of 8 -> {skip, "64-bit architecture"}; + _ when Memsize < (2 bsl 30) -> + {skip, "Less then 2 GB of memory"}; 4 -> Large = <<0:((1 bsl 30)-1)>>, {'EXIT',{system_limit,_}} = @@ -918,5 +929,10 @@ bs_add_overflow(Config) -> Large/bits>>), ok end. - + id(I) -> I. + +memsize() -> + application:ensure_all_started(os_mon), + {Tot,_Used,_} = memsup:get_memory_data(), + Tot. |