forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request RobotLocomotion#4701 from rpoyner-tri/kcov
bazel tools: integrate kcov for test coverage measurement.
- Loading branch information
Showing
5 changed files
with
98 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.. _building-kcov: | ||
|
||
***************************** | ||
Building ``kcov`` From Source | ||
***************************** | ||
|
||
As of this writing, the recommended way to get ``kcov`` is to build from | ||
upstream sources from GitHub. Ubuntu Xenial (for example) has packaged | ||
versions, but they have known problems not evident when using upstream. | ||
|
||
Ubuntu-only Preparation | ||
======================= | ||
|
||
On Ubuntu, install the build dependencies:: | ||
|
||
sudo apt install binutils-dev libdw-dev libelf-dev libiberty-dev | ||
|
||
OSX and Ubuntu Build Steps | ||
========================== | ||
|
||
To build from source, follow these steps:: | ||
|
||
git clone [email protected]:SimonKagstrom/kcov.git | ||
cd kcov | ||
mkdir build | ||
cd build | ||
cmake .. | ||
|
||
The resulting binary will be in ``kcov/build/src/kcov``. Create a symbolic link | ||
to the binary from some directory on your ``$PATH``. | ||
|
||
OSX Run-time Requirements | ||
========================= | ||
|
||
On OSX, be sure that your account has developer mode enabled, which gives you | ||
the privileges necessary to run debuggers and similar tools. If you are an | ||
administrator, use this command:: | ||
|
||
sudo /usr/sbin/DevToolsSecurity --enable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -vx | ||
|
||
|
||
me=$(python -c 'import os; print(os.path.realpath("'"$0"'"))') | ||
WORKSPACE=$(dirname $(dirname "$me")) | ||
|
||
# Just in case, don't collect data from cpplint tests. | ||
if echo "$@" | grep -q _cpplint ; then | ||
"$@" | ||
exit $? | ||
fi | ||
|
||
kcov \ | ||
--include-path=$WORKSPACE \ | ||
--exclude-pattern=thirdParty,externals \ | ||
$WORKSPACE/bazel-kcov \ | ||
"$@" |