diff options
author | Björn Gustavsson <[email protected]> | 2017-10-16 12:31:09 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-10-18 14:05:01 +0200 |
commit | e6bc3f31f8d3e67be67c2c6b53eb868dbc53d7ec (patch) | |
tree | c721a04316fba7eabb2ab2ff4219b8903babcfdb | |
parent | 31ad587b6d75e8697964e2b80709fb3b3d2901d5 (diff) | |
download | otp-e6bc3f31f8d3e67be67c2c6b53eb868dbc53d7ec.tar.gz otp-e6bc3f31f8d3e67be67c2c6b53eb868dbc53d7ec.tar.bz2 otp-e6bc3f31f8d3e67be67c2c6b53eb868dbc53d7ec.zip |
Verify that binaries of different sizes are dumped correctly
-rw-r--r-- | lib/observer/test/crashdump_helper.erl | 11 | ||||
-rw-r--r-- | lib/observer/test/crashdump_viewer_SUITE.erl | 13 |
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/observer/test/crashdump_helper.erl b/lib/observer/test/crashdump_helper.erl index 04c8773498..41041682c2 100644 --- a/lib/observer/test/crashdump_helper.erl +++ b/lib/observer/test/crashdump_helper.erl @@ -20,7 +20,8 @@ -module(crashdump_helper). -export([n1_proc/2,remote_proc/2, - dump_maps/0,create_maps/0]). + dump_maps/0,create_maps/0, + create_binaries/0]). -compile(r18). -include_lib("common_test/include/ct.hrl"). @@ -61,6 +62,7 @@ n1_proc(Creator,_N2,Pid2,Port2,_L) -> put(ref,Ref), put(pid,Pid), put(bin,Bin), + put(bins,create_binaries()), put(sub_bin,SubBin), put(bignum,83974938738373873), put(neg_bignum,-38748762783736367), @@ -94,6 +96,13 @@ remote_proc(P1,Creator) -> receive after infinity -> ok end end). +create_binaries() -> + Sizes = lists:seq(60, 70) ++ lists:seq(120, 140), + [begin + <<H:16/unit:8>> = erlang:md5(<<Size:32>>), + Data = ((H bsl (8*150)) div (H+7919)), + <<Data:Size/unit:8>> + end || Size <- Sizes]. %%% %%% Test dumping of maps. Dumping of maps only from OTP 20.2. diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index 6ac9d7d3fb..86a60e15f4 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -364,6 +364,10 @@ special(File,Procs) -> crashdump_viewer:expand_binary({SOffset,SSize,SPos}), io:format(" expand binary ok",[]), + Binaries = crashdump_helper:create_binaries(), + verify_binaries(Binaries, proplists:get_value(bins,Dict)), + io:format(" binaries ok",[]), + #proc{last_calls=LastCalls} = ProcDetails, true = length(LastCalls) =< 4, @@ -534,6 +538,15 @@ special(File,Procs) -> end, ok. +verify_binaries([H|T1], [H|T2]) -> + %% Heap binary. + verify_binaries(T1, T2); +verify_binaries([Bin|T1], [['#CDVBin',Offset,Size,Pos]|T2]) -> + %% Refc binary. + {ok,<<Bin:Size/binary>>} = crashdump_viewer:expand_binary({Offset,Size,Pos}), + verify_binaries(T1, T2); +verify_binaries([], []) -> + ok. lookat_all_pids([]) -> ok; |