Skip to content

Commit

Permalink
Merge branch 'bjorn/stdlib/cuddle-with-tests'
Browse files Browse the repository at this point in the history
* bjorn/stdlib/cuddle-with-tests:
  Teach filelib_SUITE to work when STDLIB is cover-compiled
  • Loading branch information
bjorng committed Apr 10, 2017
2 parents 47911ac + eaaeb3d commit e837d55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/stdlib/test/filelib_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,12 @@ file_props_symlink(Config) ->
end.

find_source(Config) when is_list(Config) ->
BeamFile = code:which(lists),
%% filename:find_{file,source}() does not work if the files are
%% cover-compiled. To make sure that the test does not fail
%% when the STDLIB is cover-compiled, search for modules in
%% the compiler application.

BeamFile = code:which(compile),
BeamName = filename:basename(BeamFile),
BeamDir = filename:dirname(BeamFile),
SrcName = filename:basename(BeamFile, ".beam") ++ ".erl",
Expand All @@ -530,7 +535,7 @@ find_source(Config) when is_list(Config) ->
{error, not_found} = filelib:find_source(BeamName, BeamDir,
[{".erl",".yrl",[{"",""}]}]),

{ok, ParserErl} = filelib:find_source(code:which(erl_parse)),
{ok, ParserErl} = filelib:find_source(code:which(core_parse)),
{ok, ParserYrl} = filelib:find_source(ParserErl),
"lry." ++ _ = lists:reverse(ParserYrl),
{ok, ParserYrl} = filelib:find_source(ParserErl,
Expand Down

0 comments on commit e837d55

Please sign in to comment.