0

I am working with an Android application (APK) that uses JNI and depends on a shared library. I modified the build parameters to include code coverage instrumentation. After running the APK on an Android device and pulling the .profraw files from the device, I merged them into a .profdata file using llvm-profdata merge.

However, I am unable to generate code coverage reports in HTML format because the llvm-cov tool requires an executable file as input, but my target is a shared library (.so file). Since .llvm-cov cannot take a shared library as input directly, I am looking for a way to use the .so file or some workaround to analyze coverage data.

I tried using llvm-cov with the .so file, but I encountered the error that llvm-cov expects an executable file. I also tried to link the shared library with a small executable program and run it locally, but my goal is to avoid creating an additional executable for the sole purpose of generating coverage reports.

➜  test llvm-cov show --instr-profile default.profdata libmap-render.so                                                                          
warning: libmap-render.so: profile data may be out of date - object is newer
error: libmap-render.so: Failed to load coverage: No coverage data found

I was expecting a way to either:

  1. Use the .so file directly with llvm-cov.

  2. Find a method to link the shared library into a reportable format without the need for an additional executable file.

The solution I'm looking for should allow me to generate an HTML coverage report without needing to create a new executable from the .so file, as I already have the .profraw files from running the APK on the device.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.