> On Jan 9, 2026, at 12:54, Stefan Koch <[email protected]> wrote:
> 
> I am recently retired with extra time on my hands and am interested in
> helping the gnucash project.  It seems to have good overlap with my
> skillset C++, Python/GUI/SQL, some lisp from emacs and older style c
> coding.  To get started, since I don'\t know anything about the
> codebase, I was thinking about either the python bindings, or the unit
> test coverage (both of which I saw somewhere needed help).
> 
> I got further with unit test coverage, so my question is there.
> 
> Questions:
> 1. Is it belived that the end of stable should have clean tests?  If
>   so, any suggestions on what I can look for to see what is different
>   on my mashine?
> 2. Is there any value in the converage report if the tests are
>   failing?
> 3. The libgnucash/engine coverage is listed at 75%, but when you look
>   at the details, only the iso-4217-currencies.c file is listed at
>   75%.  the libgnucash/engine/tests directory looks like it is doing
>   much more.
> 
> Since it looks like I have done mostly what the live page did, it does
> not look so good for the unit test coverage.  Is there something I can
> do to help?  Any suggestions on how I can get started?
> 
> 
> I did the following:
>  git clone https://github.com/Gnucash/gnucash.git
>  cd gnucash
>  cmake -G Ninja -S. -Bbuild-coverage
> -DCMAKE_INSTALL_PREFIX=$HOME/gnc-dev-install -DWITH_PYTHON=ON
> -DCOVERAGE=ON -DGUILE_COVERAGE=ON -DLEAKS=ON -DCMAKE_BUILD_TYPE=Asan
>  cd build-coverage
>  ninja lcov-initialize
>  ninja check
> 
> The ninja check reported errors.  I was not expecting that.  Here is
> the straight ctest output (Just the failed lines).
>   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)
>        131 - sqlite3test (Failed)
>        132 - python-bindings (Failed)
> 
> Then I tried "ninja lcov-collect" to see about the covertage.  This failed 
> with:
>    [13/28] cd /home/sk/gnucash/build....-coverage/libgnucash/engine
> && lcov --quiet --exclude "/usr/loc...gine/CMakeFiles/gnc-engine.dir
> -o /home/sk/gnucash/build-coverage/Coverage/gnc-engine_result.inf
>    Message summary:
>      21 ignore messages:
>        mismatch: 14
>        unused


> : 7
>    ninja: build stopped: subcommand failed.
> 
> I got the full set of commands with "ninja -n lcov-collect" and
> running all without stoping on failure. Then I did the "ninja
> lcov-generate-html" which was sucessful.  The resulting report looks
> like one one online at:
> https://gnucash.github.io/gnucash/Coverage-HTML/

Stefan,

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 <http://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

_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to