Having issues getting the test coverage to work.

John Ralls jralls at ceridwen.us
Sat Jan 10 17:20:15 EST 2026


Stefan,

I’d say it isn’t unexpected. GnuCash has plenty of real leaks and plenty more cases where its unorthodox memory management makes the sanitizer think there are leaks. I think the sanitizer reports those leaks as errors so it’s reasonable for ninja and ctest to count that as a test failure.

What we expect from the coverage report build is what the CI results are, and they don’t emit a message summary so they’re quieter and everything passes. That might be down to a different gcc version or lcov version.  Maybe the failure reason is logged in the output file (/home/sk/gnucash/build-debug/Coverage/gnucash-cli_result.info <http://gnucash-cli_result.info/>)?

Regards,
John Ralls

> On Jan 10, 2026, at 09:53, Stefan Koch <stefan.koch.micro at gmail.com> wrote:
> 
> Excellent.  Your confirmation helped me focus on the right thing.  I
> had build type as Asan and had -DLEAKS=ON.
> 
> The tests themselves were passing, but there were many leaks that were
> causing the tests to fail in that configuration.  Is that expected?
> 
> My next issue is with coverage.  Some [5 and 7 of 28] of the "ninja
> lcov-collect" commands fail.
> 
> The full output is:
> $ ninja lcov-collect
> [1/28] cd /home/sk/gnucash/build-debug/libgnucash/backend/xml && lcov
> --quiet ...ml.dir -o
> /home/sk/gnucash/build-debug/Coverage/gncmod-backend-xml_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [2/28] cd /home/sk/gnucash/build-debug/libgnucash/gnc-module && lcov
> --quiet -...gnc-module.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-module_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [3/28] cd /home/sk/gnucash/build-debug/libgnucash/core-utils && lcov
> --quiet -...-utils.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-core-utils_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [4/28] cd /home/sk/gnucash/build-debug/libgnucash/backend/dbi && lcov
> --quiet ...bi.dir -o
> /home/sk/gnucash/build-debug/Coverage/gncmod-backend-dbi_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [5/28] cd /home/sk/gnucash/build-debug/gnucash && lcov --quiet
> --exclude "/usr...Files/gnucash.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnucash_result.inf
> FAILED: gnucash/CMakeFiles/lcov-collect-gnucash
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/lcov-collect-gnucash
> cd /home/sk/gnucash/build-debug/gnucash && lcov --quiet --exclude
> "/usr/local/*" --exclude "/usr/*" --exclude "//*" --exclude "/usr/*"
> --exclude "/home/sk/gnc-dev-install/*" --exclude "/usr/X11R6/*"
> --exclude "/usr/pkg/*" --exclude "/opt/*" --ignore-errors
> unused,unused --ignore-errors mismatch,mismatch --ignore-errors
> empty,empty --rc geninfo_unexecuted_blocks=1 --branch-coverage
> --demangle-cpp c++filt -c --directory
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnucash_result.info
> Message summary:
>  10 ignore messages:
>    empty: 2
>    unused: 8
> [6/28] cd /home/sk/gnucash/build-debug/libgnucash/tax && lcov --quiet
> --exclud...le-tax.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-locale-tax_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [7/28] cd /home/sk/gnucash/build-debug/gnucash && lcov --quiet
> --exclude "/usr...ucash-cli.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnucash-cli_result.inf
> FAILED: gnucash/CMakeFiles/lcov-collect-gnucash-cli
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/lcov-collect-gnucash-cli
> cd /home/sk/gnucash/build-debug/gnucash && lcov --quiet --exclude
> "/usr/local/*" --exclude "/usr/*" --exclude "//*" --exclude "/usr/*"
> --exclude "/home/sk/gnc-dev-install/*" --exclude "/usr/X11R6/*"
> --exclude "/usr/pkg/*" --exclude "/opt/*" --ignore-errors
> unused,unused --ignore-errors mismatch,mismatch --ignore-errors
> empty,empty --rc geninfo_unexecuted_blocks=1 --branch-coverage
> --demangle-cpp c++filt -c --directory
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnucash-cli_result.info
> Message summary:
>  10 ignore messages:
>    empty: 2
>    unused: 8
> [8/28] cd /home/sk/gnucash/build-debug/libgnucash/backend/xml && lcov
> --quiet ...dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-backend-xml-utils_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [9/28] cd /home/sk/gnucash/build-debug/libgnucash/app-utils && lcov
> --quiet --...p-utils.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-app-utils_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [10/28] cd /home/sk/gnucash/build-debug/libgnucash/backend/sql && lcov
> --quiet...d-sql.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-backend-sql_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [11/28] cd /home/sk/gnucash/build-debug/gnucash/gnome && lcov --quiet
> --exclud...s/gnc-gnome.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-gnome_result.inf
> Message summary:
>  7 ignore messages:
>    unused: 7
> [12/28] cd /home/sk/gnucash/build-debug/libgnucash/engine && lcov
> --quiet --ex...gnc-engine.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnc-engine_result.inf
> Message summary:
>  17 ignore messages:
>    mismatch: 10
>    unused: 7
> ninja: build stopped: subcommand failed.
> 
> When I ran the first command that failed with --verbose instead of
> --quiet I got the below.  Nothing in there jumps out at me that there
> was a problem.  I did vefivy that the lcov call returned 1 (not 0) on
> the command line.
> 
> cd /home/sk/gnucash/build-debug/gnucash && lcov --verbose  --exclude
> "/usr/local/*" --exclude "/usr/*" --exclude "//*" --exclude "/usr/*"
> --exclude "/home/sk/gnc-dev-install/*" --exclude "/usr/X11R6/*"
> --exclude "/usr/pkg/*" --exclude "/opt/*" --ignore-errors
> unused,unused --ignore-errors mismatch,mismatch --ignore-errors
> empty,empty --rc geninfo_unexecuted_blocks=1 --branch-coverage
> --demangle-cpp c++filt -c --directory
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir -o
> /home/sk/gnucash/build-debug/Coverage/gnucash-cli_result.info
> apply --rc overrides
> Capturing coverage data from
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir
> geninfo cmd: '/usr/bin/geninfo
> /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir
> --toolname lcov --output-filename
> /home/sk/gnucash/build-debug/Coverage/gnucash-cli_result.info
> --verbose --ignore-errors unused --ignore-errors unused
> --ignore-errors mismatch --ignore-errors mismatch --ignore-errors
> empty --ignore-errors empty --branch-coverage --rc
> geninfo_unexecuted_blocks=1 --demangle-cpp c++filt --exclude
> /usr/local/* --exclude /usr/* --exclude //* --exclude /usr/* --exclude
> /home/sk/gnc-dev-install/* --exclude /usr/X11R6/* --exclude /usr/pkg/*
> --exclude /opt/*'
> apply --rc overrides
> gcov is '/usr/bin/gcov'
> Found gcov version: 14.2.0
> Using intermediate gcov format
> lcov:  applying '--filter region,branch_region' by default - see the
> '--no-markers' section in the man page for more information.
> Recording 'internal' directories:
>        /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir
> Writing temporary data to /tmp/geninfo_datO8RV
> Scanning /home/sk/gnucash/build-debug/gnucash/CMakeFiles/gnucash-cli.dir
> for .gcda files ...
> using: chunkSize: 1, nchunks:0, intervalLength:0
> Finished processing 0 GCDA files
> Message summary:
>  10 ignore messages:
>    empty: 2
>    unused: 8
> 
> 
> On Sat, Jan 10, 2026 at 11:55 AM John Ralls <jralls at ceridwen.us> wrote:
>> 
>> Stefan,
>> 
>> Something is wrong with your build environment then. The tests should all pass. Check the CI on the latest build. We have CI on the Github repo. You can see the results by clicking the green check (when they all pass) or red X (when something fails) next to commits in history and the latest commit on the front page https://github.com/gnucash/gnucash.
>> 
>> What is the output of the first failure, test-exp-parser?
>> 
>> Look at https://gnucash.github.io/gnucash/Coverage-HTML/libgnucash/engine/index.html instead of https://gnucash.github.io/gnucash/Coverage-HTML/build/libgnucash/engine/index.html : The difference is that the latter contains those files that are created as part of the build process. iso-4217-currencies.c is created from iso-4217-currencies.xml (https://github.com/Gnucash/gnucash/blob/stable/libgnucash/engine/iso-4217-currencies.xml) using the XSLT stylesheet https://github.com/Gnucash/gnucash/blob/stable/libgnucash/engine/iso-currencies-to-c.xsl.
>> 
>> Regards,
>> John Ralls
>> 
>> On Jan 10, 2026, at 05:53, Stefan Koch <stefan.koch.micro at gmail.com> wrote:
>> 
>> Thanks for the reply.
>> 
>> So, I have made a clean debian 13 vm and still have much the same
>> errors as I did before.
>> 
>> I am happy to drill down into the issues.  I just wanted to make sure
>> that my build system is setup properly.
>> 
>> Do people that have been doing ongoing development get the same many
>> failures that I do.  If so I can get to work on fixing them.  If not,
>> then I still have an issue with my build setup.
>> 
>> The reason that I think I may not is that if you drill down on the
>> coverage page https://gnucash.github.io/gnucash/Coverage-HTML/ into
>> the html engine page here:
>> https://gnucash.github.io/gnucash/Coverage-HTML/build/libgnucash/engine/index.html,
>> the only file that looks to be checked is the iso-4217-currencies.c
>> file.  That is why I thought there may be a problem.  If there was at
>> least some coverage on more files in libgnucash/engine I would have
>> expected to see them there.  I know there are more tests for it.
>> Maybe they all fail and therefore are not shown in the coverage
>> report.
>> 
>> Drilling down looks confusing.  Specifically, the test-cashobject.c
>> test does not show up as a failed test, but the
>> libgnucash/engine/cashobject.cpp does not show up in the coverage
>> summary.
>> 
>> These are the errors I still get on a clean VM:
>> The following tests FAILED:
>>         1 - test-exp-parser (Failed)
>>         3 - test-sx (Failed)
>>         4 - test-gnc-quotes (Failed)
>>         5 - test-autoclear (Failed)
>>         7 - test-kvp-frames (Failed)
>>         9 - test-load-xml2 (Failed)
>>        10 - test-load-example-account (Failed)
>>        11 - test-load-save-files (Failed)
>>        12 - test-xml-contents (Failed)
>>        14 - test-xml-account (Failed)
>>        15 - test-xml-commodity (Failed)
>>        16 - test-xml-pricedb (Failed)
>>        17 - test-xml-transaction (Failed)
>>        19 - test-backend-dbi (Failed)
>>        21 - test-sqlbe (Failed)
>>        22 - test-gnc-glib-utils (Failed)
>>        33 - test-engine (Failed)
>>        40 - test-transaction-reversal (Failed)
>>        41 - test-transaction-voiding (Failed)
>>        51 - test-kvp-value (Failed)
>>        59 - test-import-map (Failed)
>>        63 - test-load-c (Failed)
>>        68 - test-link-module-tax-us (Failed)
>>        69 - test-invoice-report-builtin-default (Failed)
>>        70 - test-assistant-stock-transaction (Failed)
>>        71 - test-load-gnome-utils-module (Failed)
>>        72 - test-import-parse (Failed)
>>        73 - test-import-pending-matches (Failed)
>>        76 - test-aqb (Failed)
>>        81 - test-qif-imp (Failed)
>>        82 - test-qif-parse (Failed)
>>        83 - test-qif-merge-groups (Failed)
>>        84 - test-split-register-copy-ops (Failed)
>>        85 - test-standard-category-report (Failed)
>>        86 - test-standard-net-linechart (Failed)
>>        87 - test-standard-net-barchart (Failed)
>>        88 - test-cashflow-barchart (Failed)
>>        89 - test-charts (Failed)
>>        90 - test-transaction (Failed)
>>        91 - test-account-summary (Failed)
>>        92 - test-balsheet-pnl (Failed)
>>        93 - test-income-gst (Failed)
>>        94 - test-budget (Failed)
>>        95 - test-register (Failed)
>>        96 - test-trial-balance (Failed)
>>        97 - test-equity-statement (Failed)
>>        98 - test-average-balance (Failed)
>>        99 - test-ifrs-cost-basis (Failed)
>>       100 - test-invoice (Failed)
>>       101 - test-new-owner-report (Failed)
>>       102 - test-owner-report (Failed)
>>       103 - test-portfolios (Failed)
>>       104 - test-stress-options (Failed)
>>       105 - test-cash-flow (Failed)
>>       106 - test-load-report-module (Failed)
>>       107 - test-test-extras (Failed)
>>       108 - test-commodity-utils (Failed)
>>       109 - test-report-utilities (Failed)
>>       110 - test-html-utilities-srfi64 (Failed)
>>       111 - test-html-fonts (Failed)
>>       112 - test-html-chart (Failed)
>>       113 - test-report-html (Failed)
>>       114 - test-report (Failed)
>>       115 - test-scm-query (Failed)
>>       116 - test-create-account (Failed)
>>       117 - test-core-utils (Failed)
>>       118 - test-business-core (Failed)
>>       119 - test-scm-engine (Failed)
>>       120 - test-scm-kvpvalue (Failed)
>>       121 - test-options (Failed)
>>       122 - test-scm-utilities (Failed)
>>       123 - test-module-deprecation (Failed)
>>       124 - test-c-interface (Failed)
>>       125 - test-load-app-utils-module (Failed)
>>       126 - test-gnc-optiondb (Failed)
>>       127 - test-gnc-option-scheme-output (Failed)
>>       128 - test-date-utilities (Failed)
>>       129 - test-print-queries (Failed)
>>       130 - test-scm-query-string (Failed)
>>       132 - python-bindings (Failed)
>> Errors while running CTest
>> 
>> On Fri, Jan 9, 2026 at 11:32 PM John Ralls <jralls at ceridwen.us> wrote:
>> 
>> 
>> 
>> 
>> On Jan 9, 2026, at 12:54, Stefan Koch <stefan.koch.micro at gmail.com> wrote:
>> [Removed a bunch of my stuff.]
>> 
>> Working with unit tests would be a great way to learn the code base.
>> 
>> Perhaps you misunderstand how the aggregate for libgnucash/engine is computed. 75% doesn’t mean that every file is at 75% coverage or that 75% coverage is the worst file. It means that there are 26572 lines and 5301 functions in all of the files in libgnucash/engine and that 17661 lines and 2775 functions are covered. (And yes, that’s not 75% it’s 66.5% of lines and 52.3% of functions, the score in this afternoon’s coverage run.
>> 
>> Note that in https://gnucash.github.io/gnucash/Coverage-HTML/ you can drill right down to the file to see which functions and lines need attention.
>> 
>> But before you start work you need to get a clean build. All of the tests should pass,
>> 
>> Note that Linux has a linkage problem if you have GnuCash installed in a way that ld.so.conf can see it: The linux linker isn’t very smart and it will link the installed libraries in preference to the just-built ones. That’s also true for Guile, which is even less bright. That means that you need to construct a build environment that’s isolated from where GnuCash is installed. I think the easiest way to do that is to use a flatpak GnuCash for your accounting work and develop on the system. More difficult possibilities are to set up a build environment in a flatpak sandbox or construct a chroot jail to develop in.
>> 
>> One other thing: ninja check is *supposed* to build everything, but I never trust it. I always run ninja && ninja check.
>> 
>> If that’s not the problem or if you still can’t get tests to pass after isolating your build then you’ll need to dig into the test failures—the detailed test output is in ${topbuilddir}//Testing/Temporary/LastTest.log and you can run individual tests wth `ctest -R test-name`. Add `-V` and it will print the output to stdout as well as to LastTest.log.
>> 
>> Regards,
>> John Ralls
>> 
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20260110/24a0d2fc/attachment-0001.htm>


More information about the gnucash-devel mailing list