-
Notifications
You must be signed in to change notification settings - Fork 314
How to add coverage for a subproject
It takes some tweaking, but XcodeCoverage can report code coverage for subprojects.
Enable coverage each subproject.
Important: You must use the same configuration across subprojects and the main target.
Edit envcov.sh and define the path to the object folder of your subproject. If you're measuring the Debug configuration, make something like this:
MYLIB_OBJ=${OBJROOT}/MyLib.build/Debug-iphonesimulator/MyLib.build/Objects-normal/${CURRENT_ARCH}
Confirm that the path is correct. The name of the folder under Debug-iphonesimulator may need to be adjusted.
Edit cleancov to add the path to be zeroed.
LCOV --zerocounters -d "${MYLIB_OBJ}"
Edit the gather_coverage()
function in getcov. At the bottom, add something like
LCOV --capture -b "${MYLIB_OBJ}" -d "${MYLIB_OBJ}" -o MyLib.info
This directs lcov to capture coverage data for a specific library, writing it to the .info file.
Then we need to collect the data from all libraries and add it to the main file:
LCOV -o ${LCOV_INFO} -a ${LCOV_INFO} -a MyLib.info -a YetAnotherLib.info