diff options
author | Hans Bolinder <[email protected]> | 2017-12-08 15:50:41 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-12-21 14:55:31 +0100 |
commit | f74a8e01a0ce954f4566007d521088a7ea1f146b (patch) | |
tree | 9a39dcbab4de2819d4f5a0f6fd623808319a4e26 /lib/tools/test/cover_SUITE.erl | |
parent | fb60cf1408edc6ee03c7e391419367d047721809 (diff) | |
download | otp-f74a8e01a0ce954f4566007d521088a7ea1f146b.tar.gz otp-f74a8e01a0ce954f4566007d521088a7ea1f146b.tar.bz2 otp-f74a8e01a0ce954f4566007d521088a7ea1f146b.zip |
tools: Correct a counting bug in Cover
See also PR #1641, https://github.com/erlang/otp/pull/1641.
The bug was introduced in commit ab435488a (Erlang/OTP 18).
Diffstat (limited to 'lib/tools/test/cover_SUITE.erl')
-rw-r--r-- | lib/tools/test/cover_SUITE.erl | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl index 90e113c178..161b0105b9 100644 --- a/lib/tools/test/cover_SUITE.erl +++ b/lib/tools/test/cover_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ all() -> distribution, reconnect, die_and_reconnect, dont_reconnect_after_stop, stop_node_after_disconnect, export_import, otp_5031, otp_6115, - otp_8270, otp_10979_hanging_node], + otp_8270, otp_10979_hanging_node, otp_14817], case whereis(cover_server) of undefined -> [coverage,StartStop ++ NoStartStop]; @@ -1574,6 +1574,30 @@ otp_10979_hanging_node(_Config) -> ok. +otp_14817(Config) when is_list(Config) -> + Test = <<"-module(otp_14817). + -export([a/0, b/0, c/0, d/0]). + a() -> ok. b() -> ok. c() -> ok. + d() -> ok. + ">>, + File = cc_mod(otp_14817, Test, Config), + ok = otp_14817:a(), + ok = otp_14817:b(), + ok = otp_14817:c(), + ok = otp_14817:d(), + {ok,[{{otp_14817,3},1}, + {{otp_14817,3},1}, + {{otp_14817,3},1}, + {{otp_14817,4},1}]} = + cover:analyse(otp_14817, calls, line), + {ok, CovOut} = cover:analyse_to_file(otp_14817), + {ok, Bin} = file:read_file(CovOut), + <<"3..|",_/binary>> = string:find(Bin, "3..|"), + <<"1..|",_/binary>> = string:find(Bin, "1..|"), + ok = file:delete(File), + ok = file:delete(CovOut), + ok. + %% Take compiler options from beam in cover:compile_beam compile_beam_opts(Config) when is_list(Config) -> {ok, Cwd} = file:get_cwd(), |