[cairo] cairowrap for unit testing [feedback]

Ian Britten britten at caris.com
Tue May 26 09:08:21 PDT 2009


Hi all,
Based on a recent discussion about unit-testing my Cairo code, I
looked into
   http://people.freedesktop.org/~jrmuizel/libcairowrap-0.1.tar.gz
as a possible tool for writing unit tests.  Here are my findings...

Although it's an interesting approach, the current version has a
couple of issues that are going to prevent it from being used (by me)
as a viable tool for unit testing.  I'll summarize the issues I
found here (In no particular order) in case anyone is planning to do
any work on it...

- What is its future (and license)?  I wouldn't want to commit to
   using something that is becoming abandonware...  If it's actively
   maintained, will it ever be part of the mainstream Cairo releases?

- Minor compiler error:
   /usr/bin/ld: libcairowrap.o: relocation R_X86_64_32 against `a
     local symbol' can not be used when making a shared object;
     recompile with -fPIC
   As it says, -fPIC is needed in CFLAGS

- As an LD_PRELOAD, I'm suspecting it doesn't work on Windows.  I
   need a way to write tests that are cross-platform.

- Currently, the callbacks just printf() their information, making
   capture of that output difficult.  An ideal (C++) approach would
   be to write to a configurable std::stream - Not sure of the best
   C approach...

- A lot of the output consists of pointer addresses.  Since these
   will vary between architectures (32/64 bit) and platforms
   (Linux/Windows), it won't be possible to capture the output on
   a testing platform and compare it against a single (platform
   independent) master version of the output.

- Since the LD_PRELOAD intercepts *ALL* Cairo calls (globally), it's
   difficult to separate out my Cairo calls from those being done by
   foreign parts of the system (eg: GTK uses Cairo too).  This
   probably isn't an issue for discrete unit tests, but trying to use
   cairowrap within a GUI app (For ad-hoc testing), is overwhelming.

Please don't take this as criticism of cairowrap - It is what it is,
and fulfils its current purpose well.  I'm only pointing out some
things to possibly consider in the future, if any future work is
to be done on this tool (Esp. if it's seen as a possible tool for
unit testing).

Now, I'm going to poke into cairo-trace some...
Keep up the great work!
Ian



More information about the cairo mailing list