gcov: Solve the problem of incorrect report generation caused by different compilation and test environments #15308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Due to the makefile, the relative paths of the files are different, and it is impossible to use existing tools such as gcov and lcov to specify a base compilation path for them.
The solution for Linux is to copy a copy of the source code from the compilation environment to the test environment, and there is a place that is consistent with the absolute path of the compilation environment.
This solution is to pass in the "-b" parameter to directly modify the info file generated by lcov. The search path will be executed in the next step of genhtml
Impact
Update this section, where applicable, on how change affects users,
build process, hardware, documentation, security, compatibility, etc.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.