[cairo] Fault Injector
Chris Wilson
chris at chris-wilson.co.uk
Fri Mar 16 09:59:11 PDT 2007
Behdad made a very good suggestion that Cairo should undergo
malloc-failure testing. We could either replace all calls to malloc and
kin with _cairo_malloc() and implement a system similar to dbus. Or do
something similar with LD_PRELOAD (except becareful for calls outside of
Cairo that do not handle a NULL return, e.g. in the test harnesses).
The method I chose was to make a very simple valgrind skin. The
fault-injector wraps malloc() and checks the callstack for named
functions (or simple cairo* style globs) and if found will randomly
fail. Similary it checks another list to see if should protect the
caller from failure. For example,
$ ./libtool --mode=execute valgrind --tool=faultinjector \
--allow-regex=cairo* \
--deny-fn=xasprintf \
--deny-fn=xmalloc \
--deny-fn=cairo_create \
perf/cairo-perf
Seems to be a good start. Patch against valgrind trunk.
[memprof is included as well for good measure ;-]
--
Chris Wilson
More information about the cairo
mailing list