sonos / dinghy

Easier cross-compilation for phones and single boards computers
Other
367 stars 44 forks source link

Provide an example how to measure (code coverage) profiling data and save it on the host #211

Open briansmith opened 9 months ago

briansmith commented 9 months ago

I would like to use cargo-dinghy in GitHub actions to measure code coverage for iOS/TVOS/WatchOS builds. I use Rust's source-based code coverage measurement currently. This mechanism requires rebuilding the project with specific RUSTFLAGS, which cause the compiler to add instrumentation to the executable to measure how many times each branch is taken. When the executable terminates, it writes a file containing these counts. Then we take that file, post-process it, and send it to codecov.io or some other service. That service then aggregates the code coverage measurements with all the other ones gathered for that CI run. This way, we get a complete summary of all the code coverage across all targets.

If somebody has already hacked together an unofficial solution for this, I would appreciate a link.

Some challenges I see:

Previously, for Android, and not using dinghy, I have done similar, with test input files, using adb to copy files to/from the device. In the long term, it would be nice if dinghy could abstract away the file I/O so that we wouldn't have to write target-OS-specific scripts. However, in the short term, demonstrating how to do it with an example that uses each individual tool (adb for Android, iOS's equivalent) would be a very useful starting point.