-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libs: add gcov framework support #14838
Conversation
profile-generate is used to generate compilation feedback optimization data, not just code coverage data It will rely on the toolchain library: nuttx/libs/libc/misc/lib_utsname.c:94:(.text.uname+0x2c): undefined reference to `__gcov_indirect_call_profiler_v4' arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x178): undefined reference to `__gcov_indirect_call' arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x188): undefined reference to `__gcov_time_profiler_counter' arm-none-eabi-ld: nuttx/staging/libc.a(lib_utsname.o):(.data..LPBX0+0x30): undefined reference to `__gcov_merge_time_profile' Signed-off-by: yinshengkai <[email protected]>
[Experimental Bot, please feedback here] This PR appears to mostly meet the NuttX requirements, but is lacking in key details. Here's a breakdown: Strengths:
Weaknesses:
Recommendations for Improvement:
By addressing these points, the PR will be much more complete and easier for reviewers to evaluate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice @Gary-Hobson your commit log message included all needed information to let people start to using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Gary-Hobson :-)
6698258
to
9a4c7dc
Compare
@Gary-Hobson please consider creating later a Guide (https://nuttx.apache.org/docs/latest/guides/index.html) to use GCOV with NuttX using these commands you included in the commit log. |
Yes, we will upload the documentation for checking code coverage in different environments later Currently, we support gcc, clang, simulator, device, it will take some time to verify all environments |
In devices without storage media, you can export data to the command line and then generate the corresponding gcda file It can save the result output by calling __gcov_info_to_gcda The usage is similar to: https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html#Profiling-and-Test-Coverage-in-Freestanding-Environments Usage: ./tools/configure.sh qemu-armv7a:nsh Modify the configuration +CONFIG_COVERAGE_ALL=y +CONFIG_COVERAGE_MINI=y +CONFIG_SYSTEM_GCOV=y Run: qemu-system-arm -cpu cortex-a7 -nographic -smp 4 \ -machine virt,virtualization=off,gic-version=2 \ -net none -chardev stdio,id=con,mux=on -serial chardev:con \ -mon chardev=con,mode=readline -kernel ./nuttx/nuttx -semihosting -s | tee gcov.txt ./nuttx/tools/gcov_convert.py -i ./gcov.txt ./nuttx/tools/gcov.sh -t arm-none-eabi-gcov Signed-off-by: yinshengkai <[email protected]>
Summary
libs: add gcov framework support
In devices without storage media, you can export data to the
command line and then generate the corresponding gcda file
It can save the result output by calling __gcov_info_to_gcda
The usage is similar to:
https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html#Profiling-and-Test-Coverage-in-Freestanding-Environments
Usage:
./tools/configure.sh qemu-armv7a:nsh
Modify the configuration
Run:
Impact
Testing
qemu