Skip to content

Instantly share code, notes, and snippets.

@xseignard
Last active June 22, 2022 12:47
Show Gist options
  • Save xseignard/5420661 to your computer and use it in GitHub Desktop.
Save xseignard/5420661 to your computer and use it in GitHub Desktop.
Merge lcov files
#!/bin/bash
while read FILENAME; do
LCOV_INPUT_FILES="$LCOV_INPUT_FILES -a \"$FILENAME\""
done < <( find $1 -name lcov.info )
eval lcov "${LCOV_INPUT_FILES}" -o $1/$2
@xseignard
Copy link
Author

Install lcov before!

Use it like this: merge_lcov path/to/coverage/reports outputfile.lcov

It will generate a merged lcov report from all discovered lcov.info files in the path/to/coverage/reports folder

@jrierapeiro
Copy link

I cp one of the files to other folder and then start doing cat filexx.lcov >> copiedfile.lcov and it worked fine. the copiedfile.lcov contains all the data, is there any reason you do it in that way? Thanks

@soyuka
Copy link

soyuka commented Aug 20, 2019

Even easier: find project -name lcov.info -exec echo -a {} \; | xargs lcov -o coverage/lcov.info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment