Running unit tests under valgrind

John Ralls jralls at ceridwen.us
Tue May 22 16:36:02 EDT 2012


On May 21, 2012, at 1:30 PM, John Ralls wrote:

> As for uninitialized variables, the compiler will find those if you build with -Wall -Werror. No need to take Valgrind's performance hit for that.

There's a little bug in Swig [1] that prevents this from working cleanly, but it's easily enough patched:
--- a/Lib/guile/guile_scm_run.swg~	Tue Mar  6 14:17:58 2012
+++ b/Lib/guile/guile_scm_run.swg	Mon May 21 16:38:09 2012
@@ -74,7 +74,7 @@
  char *ret;
  size_t l;

-  SCM_ASSERT (gh_string_p(str), str, 1, FUNC_NAME);
+  SCM_ASSERT (scm_string_p(str), str, 1, FUNC_NAME);

  #ifdef HAC_SCM_C_STRING_LENGTH
  l = scn_c_string_length(str);

That file is $PREFIX/share/swig/2.0.x/guile/guile_scm_run.swg if you want to fix an installed swig.

It would be A Good Thing™ to add -Wall to -Werror when --enable-error-on-warning is set in configure (so that it's the default from building from a subversion or git checkout), but I'm afraid that until Swig gets that bug fixed and the fixed version is widespread in distros that it would cause more trouble than good.

Regards,
John Ralls

[1] https://sourceforge.net/tracker/?func=detail&aid=3528887&group_id=1645&atid=101645




More information about the gnucash-devel mailing list