[erlang-questions] cover.erl issues

Manuel A. Rubio "Bombadil" bombadil@REDACTED
Tue Mar 26 17:42:01 CET 2013


Hi Sri,

El 2013-03-26 16:53, Siri Hansen escribió:
> This is a bug in cover. To confirm it you could call 
> ets:delete(Table)
> for each ets table just before
>
> unregister(?SERVER) 
>
> in cover:main_process_loop/1.

I use covertool[1] for export tests to jenkins and did a fork and add 
it cover.erl[2] modified to overload the original code with the 
workaround:

line 561:
----------------------------------------------------------------------------
init_main(Starter) ->
     %% Having write concurrancy here gives a 40% performance boost
     %% when collect/1 is called.
     case ets:info(?COVER_TABLE) of
         undefined ->
             register(?SERVER,self()),
             ets:new(?COVER_TABLE, [set, public, named_table
			   ,{write_concurrency, true}
			  ]),
             ets:new(?COVER_CLAUSE_TABLE, [set, public, named_table]),
             ets:new(?BINARY_TABLE, [set, named_table]),
             ets:new(?COLLECTION_TABLE, [set, public, named_table]),
             ets:new(?COLLECTION_CLAUSE_TABLE, [set, public, 
named_table]),
             process_flag(trap_exit,true),
             Starter ! {?SERVER,started},
             main_process_loop(#main_state{});
         _ ->
             catch ets:delete(?COVER_TABLE),
             catch ets:delete(?COVER_CLAUSE_TABLE),
             catch ets:delete(?BINARY_TABLE),
             catch ets:delete(?COLLECTION_TABLE),
             catch ets:delete(?COLLECTION_CLAUSE_TABLE),
             init_main(Starter)
     end.
----------------------------------------------------------------------------

It works well, but I supose I can move the ets:delete block to 
main_loop, when call to stop.

[1] https://github.com/bosqueviejo/covertool/
[2] https://github.com/bosqueviejo/covertool/blob/master/src/cover.erl

Regards.
Manuel Rubio.



More information about the erlang-questions mailing list