diff options
author | Rafal Studnicki <[email protected]> | 2014-12-15 12:22:44 +0100 |
---|---|---|
committer | Rafal Studnicki <[email protected]> | 2014-12-22 14:17:07 +0100 |
commit | 3b9fbcfde7c345057c7d3fff50ad580e7922f1d8 (patch) | |
tree | 2d1fa3ed8adc6b147d4656c8d68184b44d733256 /lib/common_test/test | |
parent | af87b1c3d4897840d8247589a88d3611106ecedc (diff) | |
download | otp-3b9fbcfde7c345057c7d3fff50ad580e7922f1d8.tar.gz otp-3b9fbcfde7c345057c7d3fff50ad580e7922f1d8.tar.bz2 otp-3b9fbcfde7c345057c7d3fff50ad580e7922f1d8.zip |
[ct_cover] Fix paths of incl_dirs in cover spec
It seems like the commit 5a3c4668908254ee930c8db2e5cf9741945f9b2b also
broke the incl_dirs option and friends when given as relative paths.
When a cover spec contains a relative path it is looked-up in the
directory with the test results, not in the .cover file directory.
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/ct_cover_SUITE.erl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/common_test/test/ct_cover_SUITE.erl b/lib/common_test/test/ct_cover_SUITE.erl index 87ba4ae1b9..62fb51a3fc 100644 --- a/lib/common_test/test/ct_cover_SUITE.erl +++ b/lib/common_test/test/ct_cover_SUITE.erl @@ -77,7 +77,8 @@ all() -> ct_cover_add_remove_nodes, otp_9956, cross, - export_import + export_import, + relative_incl_dirs ]. %%-------------------------------------------------------------------- @@ -215,6 +216,16 @@ export_import(Config) -> check_calls(Events2,2), ok. +relative_incl_dirs(Config) -> + false = check_cover(Config), + RelDir = rel_path(?config(priv_dir, Config), ?config(data_dir, Config)), + CoverSpec = [{incl_dirs, [RelDir]}], + CoverFile = create_cover_file(rel_incl_dirs, CoverSpec, Config), + Opts = [{cover, CoverFile}], + {ok, Events} = run_test(rel_incl_dirs, default, Opts, Config), + check_calls(Events, 1), + ok. + %%%----------------------------------------------------------------- %%% HELP FUNCTIONS %%%----------------------------------------------------------------- @@ -333,3 +344,12 @@ start_slave(Name,Args) -> {boot_timeout,10}, % extending some timers for slow test hosts {init_timeout,10}, {startup_timeout,10}]). + +rel_path(From, To) -> + Segments = do_rel_path(filename:split(From), filename:split(To)), + filename:join(Segments). + +do_rel_path([Seg|RestA], [Seg|RestB]) -> + do_rel_path(RestA, RestB); +do_rel_path(PathA, PathB) -> + lists:duplicate(length(PathA), "..") ++ PathB. |