Re: [erlang-patches] cover & export_all

Peti Gömöri <[email protected]>
Newsgroups gmane.comp.lang.erlang.general,gmane.comp.lang.erlang.patches
Message-ID <CAEhaAyEomSK4BkLaFHwCbiuq8HbUkOuFXtB_Ea-Bn+9ZH-2o+g@mail.gmail.com>
Hi Fredrik,

sorry, what about this one (maybe it was a wrong ö)

git fetch git://github.com/gomoripeti/otp.git pgö-cover-export-all

On Wed, Jul 10, 2013 at 9:11 AM, Fredrik <[email protected]> wrote:

>  On 07/10/2013 03:19 AM, Peti Gömöri wrote:
>
> Hi OTP team,
>
>  here is a patch that addresses the problem Yuri described.
> (I haven't added any tests or docs though)
>
>  is it true that now you also accept pull requests?
>
>
>
>  git fetch git://github.com/gomoripeti/otp.git pgö-cover-export-all
>
>
> https://github.com/gomoripeti/otp/compare/erlang:maint...pgö-cover-export-all<https://github.com/gomoripeti/otp/compare/erlang:maint...pg%F6-cover-export-all>
>
> https://github.com/gomoripeti/otp/compare/erlang:maint...pgö-cover-export-all.patch<https://github.com/gomoripeti/otp/compare/erlang:maint...pg%F6-cover-export-all.patch>
>
>
>  br
> Peter
>
>  On Wed, Jul 10, 2013 at 12:34 AM, Peti Gömöri <[email protected]>wrote:
>
>> Hi Yuri,
>>
>>  You are right, while cover compiling from source works (you can use
>> this as a workaround):
>>  > cover:compile(cover_test, UserOptions = [export_all, debug_info]).
>> {ok,cover_test}
>> > cover_test:test().
>> ok
>>
>>  (because UserOptions from the arguments is taken when cover recompiles
>> the instrumented forms)
>> when cover compiling from beam UserOptions = [] is taken.
>> This could be fixed in cover by taking the compile options from the beam
>> file as you assumed how it works.
>>
>>  Actually the documentation still says that "Only options defining
>> include file directories and macros are passed to compile:file/2,
>> everything else is ignored." apparently a patch from Tobias Schlager added
>> export_all to the allowed options of cover:compile for the exact same use
>> case as you had. But this is missing from cover:compile_beam.
>>
>>  May be I try to come up with a patch
>>
>>  br
>> Peter
>>
>>
>>
>> On Tue, Jul 9, 2013 at 11:56 AM, Yuri Lukyanov <[email protected]> wrote:
>>
>>> It seems that there is no way to cover-compile modules with export_all.
>>> Here is a simple example:
>>>
>>> cover_test.erl:
>>>
>>> -module(cover_test).
>>> test() -> ok.
>>>
>>>
>>> $ erl
>>> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4]
>>> [async-threads:0] [hipe] [kernel-poll:false]
>>>
>>> Eshell V5.9.1  (abort with ^G)
>>> 1> c(cover_test, [debug_info,export_all]).
>>> {ok,cover_test}
>>> 2> cover_test:test().
>>> ok
>>> 3> cover:compile_beam(cover_test).
>>> {ok,cover_test}
>>> 4> cover_test:test().
>>> ** exception error: undefined function cover_test:test/0
>>> 5>
>>>
>>>
>>> Could someone explain why it is like this? Is it done on purpose?
>>> Maybe it's a bug?
>>> The reason I want modules to be cover-compiled with +export_all is
>>> that it is sometimes convinient to have unit tests outside of a
>>> module. Before unit tests are run the modules get compiled with
>>> +export_all for tests to be able to access private functions. But the
>>> situation is that it is not possibe in this case to enable coverage
>>> analysys.
>>> _______________________________________________
>>> erlang-questions mailing list
>>> [email protected]
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>>
>
>
> _______________________________________________
> erlang-patches mailing [email protected]://erlang.org/mailman/listinfo/erlang-patches
>
>  Hello Peti,
> I am getting,
> <https://github.com/gomoripeti/otp/compare/erlang:maint...pg%C3%B6-cover-export-all.patch>fatal:
> Couldn't find remote ref pgö-cover-export-all when I am trying to fetch.
> Yes pull requests are accepted.
>
> --
>
> BR Fredrik Gustafsson
> Erlang OTP Team
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.