aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/test/cover_SUITE.erl
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-02-05 10:40:26 +0100
committerFredrik Gustafsson <[email protected]>2013-02-05 10:40:26 +0100
commit28dce0b9ea79f8635a3253da7f4d3c6e49cb48b8 (patch)
tree02222d5bbb06c9670888a8cc33dc8eb5a756151b /lib/tools/test/cover_SUITE.erl
parentdc6c6f1d556e4e51ce8d7d1f3f1b5062fdd6e144 (diff)
parent261880cfbebafddb61c728ed873f4e93107d9af9 (diff)
downloadotp-28dce0b9ea79f8635a3253da7f4d3c6e49cb48b8.tar.gz
otp-28dce0b9ea79f8635a3253da7f4d3c6e49cb48b8.tar.bz2
otp-28dce0b9ea79f8635a3253da7f4d3c6e49cb48b8.zip
Merge branch 'jv/cover-patches/OTP-10778'
* jv/cover-patches/OTP-10778: Fix a bug in cover when used with no_auto_import Ensure cover keeps the proper file source cover now relies on the compile info to find file sources
Diffstat (limited to 'lib/tools/test/cover_SUITE.erl')
-rw-r--r--lib/tools/test/cover_SUITE.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index 57260a3869..5abc5c41b1 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -149,7 +149,9 @@ compile(Config) when is_list(Config) ->
ok = beam_lib:crypto_key_fun(simple_crypto_fun(Key)),
{ok,crypt} = cover:compile_beam("crypt.beam")
end,
+ Path = filename:join([?config(data_dir, Config), "compile_beam", "v.erl"]),
?line {ok,v} = cover:compile_beam(v),
+ {source,Path} = lists:keyfind(source, 1, v:module_info(compile)),
?line {ok,w} = cover:compile_beam("w.beam"),
?line {error,{no_abstract_code,"./x.beam"}} = cover:compile_beam(x),
?line {error,{already_cover_compiled,no_beam_found,a}}=cover:compile_beam(a),
@@ -277,12 +279,23 @@ analyse(Config) when is_list(Config) ->
?line f:f2(),
?line {ok, "f.COVER.out"} = cover:analyse_to_file(f),
- %% Source code cannot be found by analyse_to_file
+ %% Source code can be found via source
?line {ok,v} = compile:file("compile_beam/v",[debug_info]),
?line code:purge(v),
?line {module,v} = code:load_file(v),
?line {ok,v} = cover:compile_beam(v),
- ?line {error,no_source_code_found} = cover:analyse_to_file(v),
+ {ok,"v.COVER.out"} = cover:analyse_to_file(v),
+
+ %% Source code cannot be found
+ {ok,_} = file:copy("compile_beam/z.erl", "z.erl"),
+ {ok,z} = compile:file(z,[debug_info]),
+ code:purge(z),
+ {module,z} = code:load_file(z),
+ {ok,z} = cover:compile_beam(z),
+ ok = file:delete("z.erl"),
+ {error,no_source_code_found} = cover:analyse_to_file(z),
+ code:purge(z),
+ code:delete(z),
?line {error,{not_cover_compiled,b}} = cover:analyse(b),
?line {error,{not_cover_compiled,g}} = cover:analyse(g),