forked from processone/ejabberd
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request processone#516 from esl/cover-on-17.5
Cover on 17.5
- Loading branch information
Showing
2 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
|
||
DisableCoverage = fun() -> | ||
Opts = [{cover_enabled, false}, | ||
{cover_print_enabled, false}, | ||
{cover_export_enabled, false}], | ||
lists:foldl(fun({Key, _}=Tuple, Acc) -> | ||
lists:keyreplace(Key, 1, Acc, Tuple) | ||
end, CONFIG, Opts) | ||
end, | ||
|
||
GetFullVer = fun() -> | ||
Path = filename:join([code:root_dir(), "releases", | ||
erlang:system_info(otp_release), | ||
"OTP_VERSION"]), | ||
{ok, BinString} = file:read_file(Path), | ||
case re:replace(BinString, <<"\\s+">>, "", [global]) of | ||
Version when is_binary(Version) -> | ||
Version; | ||
[Version | _] -> | ||
Version | ||
end | ||
end, | ||
|
||
case erlang:system_info(otp_release) of | ||
"17" -> | ||
io:format("disabling coverage for OTP 17~n"), | ||
Opts = [{cover_enabled, false}, | ||
{cover_print_enabled, false}, | ||
{cover_export_enabled, false}], | ||
lists:foldl(fun({Key, _}=Tuple, Acc) -> | ||
lists:keyreplace(Key, 1, Acc, Tuple) | ||
end, CONFIG, Opts); | ||
case catch GetFullVer() of | ||
<<"17.5">> -> % This is 17.5 where cover was fixed | ||
CONFIG; | ||
_ -> | ||
io:format("disabling coverage for OTP 17.0 to 17.4~n"), | ||
DisableCoverage() | ||
end; | ||
_ -> | ||
CONFIG | ||
end. |