aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-09-28 11:30:49 +0200
committerBjörn Gustavsson <[email protected]>2011-09-28 11:30:49 +0200
commitdf20d15f2229fa5da1c9b7ab8b41b2d706d586f8 (patch)
tree93b826563b40e9740603c6d6b6cada302cd63603 /lib/stdlib
parentad6a940cea43cb816a7bbcacd00a91a300097b31 (diff)
parentc5eb04243f480d860626e955c1d6b82b938cdf02 (diff)
downloadotp-df20d15f2229fa5da1c9b7ab8b41b2d706d586f8.tar.gz
otp-df20d15f2229fa5da1c9b7ab8b41b2d706d586f8.tar.bz2
otp-df20d15f2229fa5da1c9b7ab8b41b2d706d586f8.zip
Merge branch 'bjorn/line-numbers/OTP-9468' into major
* bjorn/line-numbers/OTP-9468: beam_lib_SUITE: Don't assume that "Abst" is the last chunk test_server: Show line number for caller of test_server:fail()
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/test/beam_lib_SUITE.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl
index 3f67db09c2..5df19ca7f1 100644
--- a/lib/stdlib/test/beam_lib_SUITE.erl
+++ b/lib/stdlib/test/beam_lib_SUITE.erl
@@ -181,7 +181,8 @@ error(Conf) when is_list(Conf) ->
?line verify(not_a_beam_file, beam_lib:info(<<"short">>)),
?line {Binary1, _} = split_binary(Binary, byte_size(Binary)-10),
- ?line verify(chunk_too_big, beam_lib:chunks(Binary1, ["Abst"])),
+ LastChunk = last_chunk(Binary),
+ ?line verify(chunk_too_big, beam_lib:chunks(Binary1, [LastChunk])),
?line Chunks = chunk_info(Binary),
?line {value, {_, AbstractStart, _}} = lists:keysearch("Abst", 1, Chunks),
?line {Binary2, _} = split_binary(Binary, AbstractStart),
@@ -205,6 +206,12 @@ error(Conf) when is_list(Conf) ->
?line file:delete(ACopy),
ok.
+last_chunk(Bin) ->
+ L = beam_lib:info(Bin),
+ {chunks,Chunks} = lists:keyfind(chunks, 1, L),
+ {Last,_,_} = lists:last(Chunks),
+ Last.
+
do_error(BeamFile, ACopy) ->
% evil tests
?line Chunks = chunk_info(BeamFile),