[RFC PATCH 0/5] valgrind in test scripts
- From
Jeff King <peff@peff.net>
- Date
- Oct 22, 2008, 20:28 UTC
- Message-ID
- <20081022202810.GA4439@coredump.intra.peff.net>
I spent some time last week running git through the paces with valgrind's memcheck tool. The good news is that I didn't find any serious issues, so we are doing a pretty good job overall. The bad news is that running the whole test suite with valgrind takes a few hours on a quad-core (but thank goodness for "make -j4 test").
I did uncover a few potential problems, and patches are in the latter part of the series. I suppose an argument could be made that these fixes are code churn, since these are not problems in practice, but I think they are worth fixing. The fixes are few in number and small, and we are very close to a valgrind-error-free code-base, which would make it easy to spot any new problems when they arise. We could always suppress these errors, but there is the possibility of an overzealous suppression masking a real problem (especially if one of these issues changes from theoretical to practical).
There are a few things I don't like:
1. The "fake git PATH" is set up by the Makefile, since it needs to
know which dashed commands to override (based on $(PROGRAMS)). I think it would be nicer if the test script itself set this up when
--memcheck was requested, so that we always know it is fresh. But: - if the fake PATH isn't inside the trash directory, then we have
a problem with multiple tests trying to set it up at the same
time - if the fake PATH is inside the trash directory, I'm not sure of
the best place to put it, as I don't want to influence the
outcome of the tests. It could go into .git/valgrind, without
hurting anything. 2. I wanted to have a completely clean valgrind run before posting.
With these patches, the only errors I get are for an uninitialized
"struct stat" in t4121 and t4127. After much looking (including
carefully reading the code, and using a a debugger, which shows the
data in question looking very much initialized) I can't figure out
what the problem might be. So it might simply be a false positive in
valgrind, but I would like another set of eyes.-Peff