aremmell / libsir

The Standard Incident Reporter library: A lightweight, cross-platform library for information distribution.
https://libsir.rml.dev/
MIT License
34 stars 5 forks source link

Improve CI #136

Closed johnsonjh closed 1 year ago

johnsonjh commented 1 year ago

CI should be running Clang Analyzer, Cppcheck, and Gcov

johnsonjh commented 1 year ago

Gcov (assuming a throwaway clone):

A short and mostly useless summary is available too:

IMG_7876

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

johnsonjh commented 1 year ago

Close to 80% coverage so pretty good already 👍🏻

Most of those would be used in the perf test too (and building with system loggers).

aremmell commented 1 year ago

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

  1. It looks like SIR_NO_SYSTEM_LOGGERS was defined when that ran, because I know for a fact all of those are called.
  2. It listed a bunch of stuff from tests.c that I know is called as well
  3. I don't even recognize _sir_getchar. I'll have to take a look.
  4. That would suck if it turned out we were leaking mutexes. I'll look at that too.
aremmell commented 1 year ago

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.

johnsonjh commented 1 year ago
  1. It was, yes. I can run the full thing again, it's easy to make a report
johnsonjh commented 1 year ago

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

johnsonjh commented 1 year ago

The full report is more interesting of course ...

aremmell commented 1 year ago

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.

johnsonjh commented 1 year ago

Done in master