Age | Commit message (Collapse) | Author |
|
* john/tools/fix-cover-register-race/ERL-943/OTP-15813:
cover: Fix register/2 race on startup
|
|
|
|
Use `counters:add/3` instead of `ets:update_counter/3`
for counting the number of times a line is executed.
By default, the reference to the counter array for each module will be
stored in a persistent term and retrieved every time a counter is
updated. This makes the compiler test suite with coverage enabled run
*almost* twice as fast (on my computer, in about 6 minutes down from
more than 11 minutes).
To get even more speed, the new `cover:local_only/0` function can be
called to put cover into a mode where the cover-compiled code can only
be run on the local node. In this mode, the cover-compiled modules in
a more efficient way by compiling the counter reference into the
code. This shaves off about one more minute, making the compiler test
suite with coverage enabled run *more than* twice as fast (in about 5
minutes on my computer).
|
|
Prior to PR#1807, uncovered lines could be found by searching for "
0.." in the HTML page generated by cover:analyse_to_file/1,2. The pull
request removed the two dots after the number of hits, which makes it
much harder to find the uncovered lines.
This commit introduces a sad face, :-( , instead of the single 0
character, which should make the search easier.
|
|
This will make it easier to send links to other people.
|
|
|
|
* Adapt diff colors to bring more contrast
* Use monospace font for all the code in cover HTML report
* Specify background color for the body as white
* Reduce font-size for header
* Install cover stylesheet when making release (@sirihansen made this improvement)
* Additional changes based on feedback
|
|
* maint:
tools: Correct a counting bug in Cover
|
|
See also PR #1641, https://github.com/erlang/otp/pull/1641.
The bug was introduced in commit ab435488a (Erlang/OTP 18).
|
|
|
|
|
|
And use correct encoding when printing to files.
|
|
The comment in the catch-all clause in munge_expr/2 will always be
stale. There is no way it can be kept up to date.
For example, 'eof' is listed, but 'eof' is a top-level form and is
actually handled in the catch-all clause for munge/4.
|
|
|
|
|
|
The expression in a bit string comprehension is limited to a
literal bit string expression. That is, the following code
is legal:
<< <<X>> || X <- List >>
but not this code:
<< foo(X) || X <- List >>
The limitation is annoying. For one thing, tools that transform
the abstract format must be careful not to produce code such as:
<< begin
%% Some instrumentation code.
<<X>>
end || X <- List >>
One reason for the limitation could be that we'll get
reduce/reduce conflicts if we try to allow an arbitrary
expression in a bit string comprehension:
binary_comprehension -> '<<' expr '||' lc_exprs '>>' :
{bc,?anno('$1'),'$2','$4'}.
Unfortunately, there does not seem to be an easy way to work
around that problem. The best we can do is to allow 'expr_max'
expressions (as in the binary syntax):
binary_comprehension -> '<<' expr_max '||' lc_exprs '>>' :
{bc,?anno('$1'),'$2','$4'}.
That will work, but functions calls must be enclosed in
parentheses:
<< (foo(X)) || X <- List >>
|
|
* maint:
tools: Add a Cover test
tools: Fix wrong instrumentation of binary comprehensions
|
|
When cover instruments binary comprehensions it's generating a
{block, ...} abstract code term inside a {bc, ...} term that is causing
the evaluation to fail at runtime. Removing the block statement
eliminates the error.
The template of a bit string comprehension cannot have a counter since
it is not allowed to be a block.
|
|
|
|
cover:compile_beam and cover:compile_beam_directory crashed when
trying to compile a beam file without a 'file' attribute. This has
been corrected, so an error is returned instead.
|
|
|
|
This is introduced by ab435488a.
If a module includes lines which are less than 1, for example a module
which includes `eunit.hrl`, its cover output file misses the coverage lines.
|
|
|
|
* gomoripeti/tools/cover-no-beam/OTP-12806:
cover: handle undefined module when analysing to file
|
|
It is possible that not just the source but even the beam of a module
is not available when calling analyse_to_file.
For example when coverdata is imported from an old file and since then
a module was removed.
Before this fix cover:analyse_to_file/3 could possibly never return
because of a helper process crashed with error:undef and never reply
to the caller.
At the same time link the helper process to cover_server so any
further error won't let the caller waiting indefinitely.
|
|
If not unstuck: faulty error messages will appear in error_logger_warn_SUITE.
|
|
|
|
Use the 'raw', 'delayed_write', and 'read_head' options to speed up file
operations. The analysis at the end of:
ts:run(compiler, [batch,cover]).
is now roughly twice as fast.
|
|
Add functions for cover compilation and analysis on multiple
files. This allows for more parallelisation.
All functions for cover compilation can now take a list of
modules/files.
cover:analyse/analyze and cover:analyse_to_file/analyze_to_file can be
called without the Modules arguement in order to analyse all cover
compiled and imported modules, or with a list of modules.
Also, the number of lookups in ets tables is reduced, which has also
improved the performance when analysing and resetting cover data.
|
|
OTP-8188 introduced a fix for handling last expressions in
expressions like case, try and friends. However the fix did
not account that some of those expressions like receive may
have no clauses (only an after clause), leading to a function
clause error when cover compiling code with such expressions.
|
|
* nox/maps-support-cover/OTP-11764:
Support maps in cover
Conflicts:
lib/tools/src/cover.erl
|
|
|
|
The raw_abstract_v1 format that is currently used was introduced
in R9C. Beam files that old cannot be executed by the current
run-time system, so there is no need to continue the old formats.
Removing the support will increase coverage.
|
|
We want to see at least some coverage of cover itself.
|
|
* nox/tools/cover-record-update:
Properly munge record updates in cover
Don't munge record and field names in cover
|
|
|
|
Trees {record,Line,Arg,Name,Fields} were not munged.
|
|
They are bare atoms, atoms or variables in the abstract format, there is no need to
pass them through munge_expr/2.
|
|
This adds optional names to fun expressions. A named fun expression
is parsed as a tuple `{named_fun,Loc,Name,Clauses}` in erl_parse.
If a fun expression has a name, it must be present and be the same in
every of its clauses. The function name shadows the environment of the
expression shadowing the environment and it is shadowed by the
environment of the clauses' arguments. An unused function name triggers
a warning unless it is prefixed by _, just as every variable.
Variable _ is allowed as a function name.
It is not an error to put a named function in a record field default
value.
When transforming to Core Erlang, the named fun Fun is changed into
the following expression:
letrec 'Fun'/Arity =
fun (Args) ->
let <Fun> = 'Fun'/Arity
in Case
in 'Fun'/Arity
where Args is the list of arguments of 'Fun'/Arity and Case the
Core Erlang expression corresponding to the clauses of Fun.
This transformation allows us to entirely skip any k_var to k_local
transformation in the fun's clauses bodies.
|
|
Similarly to cover compiling from source
(in this case some user specified compiler options are allowed)
when cover compiling from existing beam
take a filtered list of compiler options from the beamfile.
This way e.g. export_all can be preserved. See use case in eb02beb1c3
|
|
|
|
|
|
When cover:stop(Node) was called on a non-existing node, a process
waiting for cover data from the node would hang forever. This has been
corrected.
|
|
Commit 29231033 made cover fall back to compile info if source was not
found in pwd or ../src. This isn't sufficient for source that lies in
subdirectories of ../src when beams and source have been moved since
compilation (eg. install of some OTP applications), so first try finding
source relative to the beam directory.
For example, given a beam path
/installed/path/to/app-1.0/ebin/root.beam
and a source path
/compiled/path/to/app/src/subdir/root.erl
then look for
/installed/path/to/app-1.0/ebin/../src/subdir/root.erl
before the source path.
|
|
Cover was rewriting guard clauses as non-remote calls.
That said, if a guard contains erlang:is_binary(Binary),
Cover was incorrectly removing the erlang prefix which
lead to errors if is_binary is not auto imported.
This commit keeps the abstract format as it is.
|
|
Whenever a module is compiled via compile:forms/2,
the source is set to current directory unless a source
option is passed to compile. This commit ensures that
cover passes the source information to compile:forms/2
to ensure the source won't be modified after the module
is cover compiled.
|
|
Prior to this commit, cover relied on a simple heuristic that
traverses directory from the beam file to find a source file.
The heuristic was maintained with this patch but, if it fails,
it fallbacks to the source value in the module compile info.
In order to illustrate how it works, one of the tests that
could not find its source now passes successfully (showing the
source lookup is more robust).
|
|
|
|
|
|
* siri/cover/new-bugs-r16/OTP-10638:
[cover] Cleanup by stopping cover between tests
[common_test] Stop cover on slave node after node is terminated
[test_server] Stop cover on node after node is terminated
[cover] Fix timing dependent bug in cover_SUITE:reconnect
[cover] Remove stopped node also from lost_nodes list
[cover] Don't mark stopped node as lost
|