aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/src/cover.erl
AgeCommit message (Collapse)Author
2016-05-10cover: Fix unmatched return warningsBjörn-Egil Dahlberg
2016-03-15update copyright-yearHenrik Nord
2016-03-01Generalize bit string comprehensionsBjörn Gustavsson
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 >>
2016-02-03Merge branch 'maint'Hans Bolinder
* maint: tools: Add a Cover test tools: Fix wrong instrumentation of binary comprehensions
2016-02-03tools: Fix wrong instrumentation of binary comprehensionsLuis Rascao
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.
2016-01-22Merge branch 'maint'Siri Hansen
2015-12-17[cover] Don't crash when compiling beam without 'file' attributeSiri Hansen
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.
2015-10-14Remove the deprecated webtool applicationBjörn Gustavsson
2015-09-09Fix cover output fileYuki Ito
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.
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-15Merge branch 'gomoripeti/tools/cover-no-beam/OTP-12806'Björn Gustavsson
* gomoripeti/tools/cover-no-beam/OTP-12806: cover: handle undefined module when analysing to file
2015-06-10cover: handle undefined module when analysing to filePéter Gömöri
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.
2015-06-09cover: Unstick modules before loading remoteBjörn-Egil Dahlberg
If not unstuck: faulty error messages will appear in error_logger_warn_SUITE.
2015-04-30tools: Use module erl_annoHans Bolinder
2015-02-25cover: Optimize file operationsBjörn Gustavsson
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.
2015-02-20[cover] Improve performanceSiri Hansen
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.
2014-11-08Fix cover bug on last expressions with empty clausesJosé Valim
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.
2014-03-04Merge branch 'nox/maps-support-cover/OTP-11764'Björn-Egil Dahlberg
* nox/maps-support-cover/OTP-11764: Support maps in cover Conflicts: lib/tools/src/cover.erl
2014-02-13cover: Use lists:reverse/1 instead of the home-brewn reverse functionBjörn Gustavsson
2014-02-13cover: Remove support for ancient formats of abstract codeBjörn Gustavsson
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.
2014-02-11cover: Support running cover on itselfBjörn Gustavsson
We want to see at least some coverage of cover itself.
2014-02-07Merge branch 'nox/tools/cover-record-update'Björn Gustavsson
* nox/tools/cover-record-update: Properly munge record updates in cover Don't munge record and field names in cover
2014-02-01Support maps in coverAnthony Ramine
2014-02-01Properly munge record updates in coverAnthony Ramine
Trees {record,Line,Arg,Name,Fields} were not munged.
2014-02-01Don't munge record and field names in coverAnthony Ramine
They are bare atoms, atoms or variables in the abstract format, there is no need to pass them through munge_expr/2.
2013-12-12EEP 37: Funs with namesAnthony Ramine
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.
2013-10-30Take compiler options from beam in cover:compile_beamPéter Gömöri
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
2013-04-09Delete ets tables when stoppedFredrik Gustafsson
2013-04-04fix a race condition when there're several applications in apps directoryManuel Rubio
2013-03-26[cover] Ensure no process leak when stopping cover on dead nodeSiri Hansen
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.
2013-03-06Extend cover.erl source searchAnders Svensson
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.
2013-01-25Fix a bug in cover when used with no_auto_importJosé Valim
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.
2013-01-25Ensure cover keeps the proper file sourceJosé Valim
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.
2013-01-25cover now relies on the compile info to find file sourcesJosé Valim
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).
2013-01-25Make adjustments for UnicodeHans Bolinder
2013-01-16Remove what remains of the Mnemosyne codeLoïc Hoguin
2013-01-09Merge branch 'siri/cover/new-bugs-r16/OTP-10638'Siri Hansen
* 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
2013-01-02[tools] Add Unicode support for CoverHans Bolinder
Code written by Siri Hansen.
2012-12-19[cover] Remove stopped node also from lost_nodes listSiri Hansen
A nodes that was stopped with cover:stop/1 while marked as lost would not be removed from the list of lost nodes. Therefore, if a nodeup was later received for a node with the same name, it would be reconnected. This has been corrected.
2012-12-19[cover] Don't mark stopped node as lostSiri Hansen
Nodes that were stopped with cover:stop/1 were marked as lost and would be reconnected if a nodeup was later received for a node with the same name. This has been corrected.
2012-10-30[cover] Allow reconnection if node has been disconnected or downSiri Hansen
OTP-10523 Earlier, if the connection to a remote cover node was lost, all cover data was lost and the cover_server on the remote node would die. This would cause problems if there were cover compiled modules that would still be executed since they would attempt to write to the no longer existing ets tables belonging to the cover_server. This commit changes this behavior so that the cover_server on the remote node will survive connection loss and continue collecting cover data. If the connection is re-established then the main node will sync with the remote node again and cover data will not be lost (unless the node was down).
2012-10-30[cover] Don't kill remote nodes when connection to main node is lostSiri Hansen
OTP-10523 Since the will probably be cover compiled modules left in the remote node, we want to keep the cover_server and it's ets tables even if connection to remote node is lost. This way it will not crash (due to ets:insert in non existing table) if functions in cover compiled modules are executed.
2012-10-30[cover] Add support for test_serverSiri Hansen
OTP-10523 * Added cover:flush(Nodes), which will fetch data from remote nodes without stopping cover on those nodes. * Added cover:get_main_node(), which returns the node name of the main node. This is used by test_server to avoid {error,not_main_node} when a slave starts another slave (e.g. in test_server's own tests).
2011-09-21[cover]fix leftover {'DOWN', ..} msg in callers queueHenrik Nord
After stopping cover with cover:stop() there could still be a {'DOWN',...} leftover message in the calling process's message queue. This unexpected leftover could be eliminated if erlang:demonitor/2 with option flush would be used in certain points
2011-09-15Fix typos in cover.erlTuncer Ayaz
2011-04-29Fix file descriptor leakShunichi Shinohara
File descriptors to import cover data are left opened. When we export and import cover data many times, leaked descriptors cause an error.
2011-04-07Merge branch 'ts/cover-with-export_all' into devHenrik Nord
* ts/cover-with-export_all: add user specified compiler options on form reloading OTP-9204
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2011-02-10Update internal pmap to have a process limitLukas Larsson
Add write concurrancy to cover masters ?COVER_TABLE
2011-02-02Update documentation to reflect performance enhancement changes of coverLukas Larsson