common_test: Enable running cover on common_test
[cover] Add support for test_server

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).
[test_server] Don't stop cover after test is finished

This commit removes all calls to cover:stop from test_server. This is
to avoid crash in some processes due to old code.

The correction shall be further refined for general use. There will,
for instance, be an option to turn off cover:stop/0 after completed
test run, so the default behaviour is backwards compatible.
[common_test] Don't stop cover before stopping slave node

In order to avoid crash of processes that hold old code, cover is no
longer stopped before slave nodes are stopped. Instead cover:flush is
used which only fetches cover data from the slave.

This, along with similar changes in test_server allows all common_test
modules to be included in cover analysis.
[common_test] Start cover on slave nodes if running cover tests

Nodes started with ct_slave should automatically run cover when tests
are executed with cover analysis. Nodes must also be flushed for cover
data before stopped.
Skip epp_SUITE:otp_8911 if cover is running

This is because this test case itself starts and stops cover.
[test_server] Include all test_server modules in code coverage analysis
Include all stdlib modules in code coverage analysis
[test_server] Multiply timers with timetrap_scale_factor when starting nodes

In test_server_ctrl:start_node and wait_for_node, the timer in
controller_call was not multiplied by the timetrap_scale_factor. This
caused unexpected behaviour since the scale factor was used furhter
down the the code, and timeout would happen in unexpected order when
cover was running.
[test_server] Start cover in test_server:wait_for_node

Without this change, there is no support in test_server for starting
cover on a node started with option {wait,false}.
[test_server] Allow cross cover analysis when testing through common_test

The cross cover analysis functionality in test_server was broken since
OTP converted to running daily tests through common_test. This has
been corrected.
[common_test] Add option cover_stop

By default, test_server will always stop cover (and thus load back the
non cover compiled original beam files) after a test with code
coverage analysis is completed. The new option allows the common_test
user to specify that cover shall not be stopped. This can be useful if
there are processes still running old code, i.e. processes that have
not done any fully qualified function call after the cover
compilation, since loading the original code then will kill those
processes. This is only recommended if the erlang node is to be
stopped after the test run, or if cover can be manually stopped.
[common_test, test_server] Don't flush cover if cover is not running

ct_slave, ct_test_support and test_server_test_lib always called
cover:flush/1 when stopping slave nodes. If cover was not running,
this would cause cover_server to be started and thus
test_server:is_cover/0 to return true afterwards. This has been
corrected.
[common_test] Add test suite for code coverage support
Include all kernel modules in code coverage analysis
[common_test] Add test for OTP-9956

OTP-9956

Test that the test suite itself can be cover compiled, and that
data_dir is still set correctly.
Use code:lib_dir instead of code:which to get application directory

code_SUITE:ext_mod_dep used code:which(kernel) to get the path to the
kernel ebin directory. This failed when kernel was cover compiled,
since code:which then returns 'cover_compiled'. Using code:lib_dir
instead solved the problem.
[test_server] Add option {start_cover,false} to test_server:start_node

By default the test server will start cover on all nodes when the test
is run with code coverage analysis. To make sure cover is not started
on a new node, this option can be set.

This can be useful if the test itself starts cover or if the new node
for some reason can not run cover compiled code.
[cover] Don't kill remote nodes when connection to main node is lost

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.
[cover] Allow reconnection if node has been disconnected or down

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).