this is caused by d52d226e5b which caused log_val, pow_val, this_part
to be kept as float instead of the original algorithm which required
casting to int.
To use pass -DCMAKE_BUILD_TYPE=Debug or Asan -DCOVERAGE=ON and build as
usual, then do ninja lcov-initialize && ninja check && ninja
lcov-collect. The result will be a directory, <Builddir>/Coverage
containing lcov tracefiles, including an aggregate file gnucash.info
which you can use for further processing. It will also report an overall summary.
Note that only C/C++ files are included.
There's one more target, lcov-generate-html, that you can run after
lcov-collect. It will generate a simple website in
<Builddir>/Coverage-HTML showing coverage by source directory (the
directories in <Builddir> have coverage for generated files). Each
directory path is a clickable link to a page that shows coverage for
each source file; the filenames link to a page for each showing which
lines have been exercised.
The comment on gnc_pricedb_add_price says that writing to the
GNCPrice* after calling it will produce interesting results, and
calling gnc_price_commit_edit and g_object_unref both qualify, so
remove those calls and the corresponding gnc_price_begin_edit.
Clear the schema_hash at app shutdown via gnc_prefs_remove_registered
and make that function available to the Python bindings so that
python programs can do so too.
Alas, poor yahoo_json. After months of valiant struggle to keep up
with Yahoo!'s moving their API around the Finance::Quote team has
abandoned it, replacing it with a screen saver. Those tend to be
unstable so use alphavantage for testing.
Using a "close" time of 16:00 is a nice idea except that we don't know
what timezone it is, so it's not terribly useful. Use neutral time
instead so that the date will be right in all timezones.
The "source" parameter is checked once at the start before using strcmp()
but is then used later on in GncQuotesImpl::query_fq() with function calls
that can't handle null values.
The pointer passed to the gfec exception handler is
not valid after the exception handler ends
==382525== Invalid read of size 1
==382525== at 0x484B050: memcpy@GLIBC_2.2.5 (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525== by 0x531AB67: __printf_buffer_write (Xprintf_buffer_write.c:39)
==382525== by 0x5322CD4: __printf_buffer (vfprintf-process-arg.c:501)
==382525== by 0x53465F3: __vasprintf_internal (vasprintf.c:102)
==382525== by 0x499C8C1: g_vasprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525== by 0x4969BE0: g_strdup_vprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525== by 0x494B2F6: g_logv (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525== by 0x494B7A2: g_log (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525== by 0x4862862: func_op (gnc-exp-parser.c:342)
==382525== by 0x485D381: primary_exp (expression_parser.c:1222)
==382525== by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525== by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525== Address 0xad387ec is 764 bytes inside a block of size 766 free'd
==382525== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525== by 0x4861D9B: gfec_apply (gfec.c:145)
==382525== by 0x4862813: func_op (gnc-exp-parser.c:339)
==382525== by 0x485D381: primary_exp (expression_parser.c:1222)
==382525== by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525== by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525== by 0x485C9DE: assignment_op (expression_parser.c:886)
==382525== by 0x485C101: parse_string (expression_parser.c:605)
==382525== by 0x4862F07: gnc_exp_parser_parse_separate_vars (gnc-exp-parser.c:535)
==382525== by 0x4862D60: gnc_exp_parser_parse (gnc-exp-parser.c:475)
==382525== by 0x10A963: run_parser_test (test-exp-parser.c:94)
==382525== by 0x10AB99: run_parser_tests (test-exp-parser.c:144)
==382525== Block was alloc'd at
==382525== at 0x4843738: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525== by 0x4A81473: scm_realloc (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==382525== by 0x4AEEF70: scm_to_utf8_stringn (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==382525== by 0x55AA71F: gnc_scm_to_utf8_string (gnc-guile-utils.c:42)
==382525== by 0x4861D4E: gfec_apply (gfec.c:136)
==382525== by 0x4862813: func_op (gnc-exp-parser.c:339)
==382525== by 0x485D381: primary_exp (expression_parser.c:1222)
==382525== by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525== by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525== by 0x485C9DE: assignment_op (expression_parser.c:886)
==382525== by 0x485C101: parse_string (expression_parser.c:605)
==382525== by 0x4862F07: gnc_exp_parser_parse_separate_vars (gnc-exp-parser.c:535)
The test relies on a lot of external dependencies
- installed finance-quote-wrapper
- alpha vantage key
- network
- working remote server
Running ./bin/test-gnc-quotes from the command line
will still include online_wiggle
When the commodity table is registered, the current book will get
a default table assigned. When later setting the table explicitly
using qof_book_set_data() the exisiting table gets overwritten and
is thus leaked.
There is no way of removing or freeing a currency table from a book,
so the best we can do here is to set our own table on the book before
calling gnc_commodity_table_register().
If a function that returns an allocated pointer is passed directly into
something that does not take ownership of the pointer, the allocation is
leaked. This can be fixed by assigning the pointer to a new variable
and freeing it after operation on the memory.
The previous change of the delimiter between namespace and symbol
is needed in both overloads of GncQuoteImpl::query_fq.
Also log the query json string to ease future troubleshooting.