Skip to content

Commit

Permalink
fix coverage error: can't find .gcno files
Browse files Browse the repository at this point in the history
  • Loading branch information
JackFu123 authored and xiaoxq committed Mar 9, 2019
1 parent 6b8e320 commit 3cedc77
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions apollo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,21 +417,18 @@ function gen_coverage() {

COV_DIR=data/cov
rm -rf $COV_DIR
files=$(find bazel-out/local-dbg/bin/modules/ -iname "*.gcda" -o -iname "*.gcno" | grep -v external)
files=$(find bazel-out/local-dbg/bin/ -iname "*.gcda" -o -iname "*.gcno" | grep -v external | grep -v third_party)
for f in $files; do
target="$COV_DIR/objs/modules/${f##*modules}"
mkdir -p "$(dirname "$target")"
cp "$f" "$target"
done

files=$(find bazel-out/local-opt/bin/modules/ -iname "*.gcda" -o -iname "*.gcno" | grep -v external)
for f in $files; do
target="$COV_DIR/objs/modules/${f##*modules}"
if [ "$f" != "${f##*cyber}" ]; then
target="$COV_DIR/objs/cyber${f##*cyber}"
else
target="$COV_DIR/objs/modules${f##*modules}"
fi
mkdir -p "$(dirname "$target")"
cp "$f" "$target"
done

lcov --rc lcov_branch_coverage=1 --capture --directory "$COV_DIR/objs" --output-file "$COV_DIR/conv.info"
lcov --rc lcov_branch_coverage=1 --base-directory "/apollo/bazel-apollo" --capture --directory "$COV_DIR/objs" --output-file "$COV_DIR/conv.info"
if [ $? -ne 0 ]; then
fail 'lcov failed!'
fi
Expand Down

0 comments on commit 3cedc77

Please sign in to comment.