Closed johnsonjh closed 1 year ago
Gcov (assuming a throwaway clone):
pipx install gcovr
git clean -fdx; gmake clean; env CC="gcc" CFLAGS="-fdata-sections -ffunction-sections -fno-inline -fprofile-arcs -ftest-coverage --coverage" LDFLAGS="-fprofile-arcs -ftest-coverage -Wl,--gc-sections -Wl,--print-gc-sections" gmake SIR_NO_SYSTEM_LOGGERS=1 SIR_DEBUG=1 && sleep 5 && build/bin/sirexample && build/bin/sirtests && gcovr --gcov-ignore-parse-errors=negative_hits.warn_once_per_file --html-details out.html
A short and mostly useless summary is available too:
Quick unused function report:
elinks -dump *.html | grep 'not called' | sed 's/[0-9]\+//g' | tr -d '[]' | awk '{ print $1 }' | xargs
report_error sir_makergb sir_syslogcat sir_syslogid sir_sysloglevels sir_syslogopts _sir_getappbasename _sir_getchar _sir_setbitshigh _sir_setbitslow _sir_strsame _sir_syslog_close _sir_syslog_init _sir_syslog_open _sir_syslog_reset _sir_syslog_updated _sir_syslog_write _sir_syslogcat _sir_syslogid _sir_sysloglevels _sir_syslogopts _sir_mutextrylock _sirmutex_destroy mark_test_to_run print_os_error print_test_list print_usage_info sirtest_perf sirtimergetres
Close to 80% coverage so pretty good already 👍🏻
Most of those would be used in the perf test too (and building with system loggers).
report_error sir_makergb sir_syslogcat sir_syslogid sir_sysloglevels sir_syslogopts _sir_getappbasename _sir_getchar _sir_setbitshigh _sir_setbitslow _sir_strsame _sir_syslog_close _sir_syslog_init _sir_syslog_open _sir_syslog_reset _sir_syslog_updated _sir_syslog_write _sir_syslogcat _sir_syslogid _sir_sysloglevels _sir_syslogopts _sir_mutextrylock _sirmutex_destroy mark_test_to_run print_os_error print_test_list print_usage_info sirtest_perf sirtimergetres
Oh, yeah, _sir_getchar
is only if you pass --wait
to the test rig. We don't call trylock on mutexes...
I'll file an issue for destroying mutexes on cleanup.
Redo with just tests checked, OS logger included, unused was:
_makeinit sir_makergb sir_syslogcat sir_syslogid _sir_getchar _sir_strsame _sir_makeinit _sir_syslogcat _sir_syslogid _sir_mutextrylock _sirmutex_destroy mark_test_to_run print_os_error print_test_list print_usage_info sirtest_perf sirtimergetres
The full report is more interesting of course ...
all of those are dependent on which tests are run, or which flags are sent to sirtest
(except for the mutex stuff, that's actually not used).
some of those functions are only called by the example app too, I believe.
Done in master
CI should be running Clang Analyzer, Cppcheck, and Gcov