diff options
author | Siri Hansen <[email protected]> | 2014-05-21 16:39:03 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2014-06-05 14:20:12 +0200 |
commit | 5a3c4668908254ee930c8db2e5cf9741945f9b2b (patch) | |
tree | 8a0943383986ffcd55aca542ef99e12957c14b73 /lib/common_test/src/ct_framework.erl | |
parent | 1118f1cf1baf5803c3a67939f609ee728dea85ee (diff) | |
download | otp-5a3c4668908254ee930c8db2e5cf9741945f9b2b.tar.gz otp-5a3c4668908254ee930c8db2e5cf9741945f9b2b.tar.bz2 otp-5a3c4668908254ee930c8db2e5cf9741945f9b2b.zip |
Improve cover analysis via common_test
This addresses several bugs in common_test (ct) when using the cover
analysis mechanism:
In a ct test run, one can give a cover spec file which indicates that
cover analysis shall be run, including a number of modules and a
number of nodes. During the ct test run, multiple jobs may be started
in test_server, and when the cover option is used, test_server would
cover compile and analyse all given modules for each job. This commit
instead allows the compilation and analysis to be explicitly ordered
by ct for each test run. This way each module will only be cover
compiled and analysed once. The cover log will be located in the
common_test log directory (ct_run.<timestamp>), and the "Coverage log"
link in each suite.log.html will point to this file. A new button is
also added in the top level ct index file, which points to the cover
log.
This change also reduces the need of using the 'export' and 'import'
options, since there is no longer any need to accumulate cover data
over multiple test_server jobs. However, these options may still be
used for importing and exporting cover data in order to store or
accumulate data from multiple ct test runs.
The 'nodes' option was earlier only used by ct to start cover on the
given nodes before starting the first test_server job. After this job
was completed, test_server would stop cover completely and then start
it again for the next job without any knowledge of the 'nodes'
options. For the next test_server jobs cover would therefore no longer
be running on these nodes. Explcit calls to ct_cover:add_nodes had to
be done in order to collect data through all test_server jobs. This
bug has now been solved, since cover is no longer stopped between each
test_server job.
Finally, ct no longer stores cover data using
ct_util:set_testdata. This was earlier used by ct_cover:add_nodes to
make sure no node was added twice.This did, however, cause some
problems when ct and cover were out of sync. ct could belive that a
node was running cover and thus reject adding this node, while in
reality cover had been stopped on the node (e.g. by test_server) so no
cover data was collected. ct_cover:add_nodes will now instead use
cover:which_nodes to check if a node is already running.
Diffstat (limited to 'lib/common_test/src/ct_framework.erl')
-rw-r--r-- | lib/common_test/src/ct_framework.erl | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index 20903607dc..e8ea7992b4 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -1244,38 +1244,7 @@ report(What,Data) -> ct_logs:make_all_suites_index({TestName,RunDir}), ok; tests_start -> - case ct_util:get_testdata(cover) of - undefined -> - ok; - {_CovFile,_CovNodes,CovImport,CovExport,_CovAppData} -> - %% Always import cover data from files specified by CovImport - %% if no CovExport defined. If CovExport is defined, only - %% import from CovImport files initially, then use CovExport - %% to pass coverdata between proceeding tests (in the same run). - Imps = - case CovExport of - [] -> % don't export data between tests - CovImport; - _ -> - case filelib:is_file(CovExport) of - true -> - [CovExport]; - false -> - CovImport - end - end, - lists:foreach( - fun(Imp) -> - case cover:import(Imp) of - ok -> - ok; - {error,Reason} -> - ct_logs:log("COVER INFO", - "Importing cover data from: ~ts fails! " - "Reason: ~p", [Imp,Reason]) - end - end, Imps) - end; + ok; tests_done -> ok; severe_error -> |