Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0513-cover-filter_options-1-preserve-tuple_call...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0513-cover-filter_options-1-preserve-tuple_calls.patch of Package erlang
From e28e11b5af0fa552ea46adf1210adf7933834077 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson <mikpelinux@gmail.com> Date: Tue, 4 May 2021 20:02:06 +0200 Subject: [PATCH] cover:filter_options/1: preserve tuple_calls --- lib/tools/src/cover.erl | 1 + lib/tools/test/cover_SUITE.erl | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl index 9964d8ce19..f9de2077e3 100644 --- a/lib/tools/src/cover.erl +++ b/lib/tools/src/cover.erl @@ -335,6 +335,7 @@ filter_options(Options) -> {d, _Macro} -> true; {d, _Macro, _Value} -> true; export_all -> true; + tuple_calls -> true; _ -> false end end, diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl index b9cd028546..2bf86f733b 100644 --- a/lib/tools/test/cover_SUITE.erl +++ b/lib/tools/test/cover_SUITE.erl @@ -32,7 +32,7 @@ all() -> otp_8340,otp_8188,compile_beam_opts,eep37, analyse_no_beam, line_0, compile_beam_no_file, compile_beam_missing_backend, - otp_13277, otp_13289], + otp_13277, otp_13289, gh_4796], StartStop = [start, compile, analyse, misc, stop, distribution, reconnect, die_and_reconnect, dont_reconnect_after_stop, stop_node_after_disconnect, @@ -1854,6 +1854,24 @@ otp_16476(Config) when is_list(Config) -> ok = cover:stop(), ok. +%% GH-4796: failure to preserve tuple_calls compiler option +gh_4796(Config) -> + Test = <<"-module(gh_4796). + -export([test/0, foo/1]). + + test() -> + PMod = new(42), + PMod:foo(). + + new(X) -> {?MODULE, X}. + + foo({?MODULE, 42}) -> ok. + ">>, + File = c_mod(gh_4796, Test, Config, [tuple_calls]), + {ok, gh_4796} = cover:compile_beam(gh_4796), + ok = file:delete(File), + ok = gh_4796:test(). + %%--Auxiliary------------------------------------------------------------ analyse_expr(Expr, Config) -> @@ -1879,13 +1897,16 @@ cc_mod(M, Binary, Config) -> end. c_mod(M, Binary, Config) -> + c_mod(M, Binary, Config, _CompileOpts = []). + +c_mod(M, Binary, Config, CompileOpts) -> {ok, Dir} = file:get_cwd(), PrivDir = proplists:get_value(priv_dir, Config), ok = file:set_cwd(PrivDir), File = atom_to_list(M) ++ ".erl", try ok = file:write_file(File, Binary), - {ok, M} = compile:file(File, [debug_info]), + {ok, M} = compile:file(File, CompileOpts ++ [debug_info]), code:purge(M), AbsFile = filename:rootname(File, ".erl"), code:load_abs(AbsFile, M), -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor