Skip to content

Commit

Permalink
use -add-tracefile to sanitize coverage.info
Browse files Browse the repository at this point in the history
  • Loading branch information
a114j0y committed Jan 21, 2025
1 parent 95cf55a commit 1d4bdb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ override_dh_auto_install:
ifeq ($(ENABLE_GCOV), y)
mkdir -p debian/swss/tmp/gcov
lcov -c --directory . --no-external --exclude "$(shell pwd)/tests/*" --exclude "$(shell pwd)/**/tests/*" --ignore-errors gcov --output-file coverage.info
lcov -a coverage.info -o coverage.info
lcov_cobertura coverage.info -o coverage.xml
find ./ -type f -regex '.*\.\(h\|cpp\|gcno\|info\)' | tar -cf debian/swss/tmp/gcov/gcov-source.tar -T -
endif
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def collect_coverage(self):
self.runcmd('supervisorctl stop all')

# Generate the converage info by lcov and copy to the host
cmd = f"docker exec {self.ctn.short_id} sh -c 'cd $BUILD_DIR; rm -rf **/.libs ./lib/libSaiRedis*; lcov -c --directory . --no-external --exclude tests --ignore-errors gcov,unused --output-file /tmp/coverage.info; sed -i \"s#SF:$BUILD_DIR/#SF:#\" /tmp/coverage.info; lcov_cobertura /tmp/coverage.info -o /tmp/coverage.xml'"
cmd = f"docker exec {self.ctn.short_id} sh -c 'cd $BUILD_DIR; rm -rf **/.libs ./lib/libSaiRedis*; lcov -c --directory . --no-external --exclude tests --ignore-errors gcov,unused --output-file /tmp/coverage.info && lcov --add-tracefile /tmp/coverage.info -o /tmp/coverage.info; sed -i \"s#SF:$BUILD_DIR/#SF:#\" /tmp/coverage.info; lcov_cobertura /tmp/coverage.info -o /tmp/coverage.xml'"
subprocess.getstatusoutput(cmd)
cmd = f"docker exec {self.ctn.short_id} sh -c 'cd $BUILD_DIR; find . -name *.gcda -type f -exec tar -rf /tmp/gcda.tar {{}} \\;'"
subprocess.getstatusoutput(cmd)
Expand Down

0 comments on commit 1d4bdb5

Please sign in to comment.