summaryrefslogtreecommitdiffstats
path: root/src/cmake/gcov-helper.sh.in
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-09-18 15:51:14 -0400
committerScott Murray <scott.murray@konsulko.com>2020-09-18 16:20:35 -0400
commit7c03348d9c2de43684fa69c3c9e227b25daceaaa (patch)
treedcffc1fd8ceba61a21a14ee6ac8696e7b7ae2c30 /src/cmake/gcov-helper.sh.in
parenta357a6af0cf515883dfa26fd2cb80ac055a491de (diff)
Add source and coverage information installation to debug and coverage widgets. The source tree will be installed to "src" in debug and coverage widgets, with some non-source directories like doc/docs excluded. The gcc produced "gcno" files for generating coverage reports will be installed to "coverage" in coverage widgets. A different directory than that for source is used, as the gcno files are in the build output hierarchy, which is not the same as the source tree hierarchy when using CMake. This hierarchy needs to be preserved to be able to use gcc's coverage support. As part of this scheme, an environment file containing values for the GCOV_PREFIX and GCOV_PREFIX_STRIP variables is generated and added to "coverage". The latter variable can only be calculated during widget build, and is essential for abstracting the build directory location and enabling gcov usage on target. Bug-AGL: SPEC-3589 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I258fff0295444bb257d24d442798347728ee7875
Diffstat (limited to 'src/cmake/gcov-helper.sh.in')
-rw-r--r--src/cmake/gcov-helper.sh.in17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmake/gcov-helper.sh.in b/src/cmake/gcov-helper.sh.in
new file mode 100644
index 0000000..4278148
--- /dev/null
+++ b/src/cmake/gcov-helper.sh.in
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Copy gcno files
+for f in `find @CMAKE_BINARY_DIR@ -name '*\.gcno'`; do
+ d="${f%/*}"
+ mkdir -p "@PROJECT_PKG_BUILD_DIR@/coverage/${d#@CMAKE_BINARY_DIR@}"
+ cp "$f" "@PROJECT_PKG_BUILD_DIR@/coverage/${d#@CMAKE_BINARY_DIR@}"
+done
+
+# Make gcov environment file
+mkdir -p "@PROJECT_PKG_BUILD_DIR@/coverage"
+dirs=`echo "@CMAKE_BINARY_DIR@" | tr -cd '/' | wc -c`
+cat > "@PROJECT_PKG_BUILD_DIR@/coverage/gcov.env" <<EOF
+GCOV_PREFIX=/tmp/gcov/@PROJECT_NAME@
+GCOV_PREFIX_STRIP=${dirs}
+EOF
+