[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg unittests



On Sun, Oct 31, 2004 at 03:02:28PM +0000, Scott James Remnant wrote:
> On Sun, 2004-10-31 at 14:20 +0000, Esteban Manchado Velázquez wrote:
> 
> > Some months ago (Apr 2004) I talked to Wichert about trying to add tests
> > to dpkg.  After some "research", I came up with some initial test
> > infrastructure in dejagnu and the check C library (both available as Debian
> > packages).
> > 
> That'd be excellent to see ... I've been wondering how to do it myself
> for a while, I've not really found any really truly decent test
> framework for unit testing C code (as apposed to functionally testing
> the resulting binaries)
> 
> How did you go about it?

    Right now, I have only two initial types of tests, one for
dpkg-parsechangelog (as Wichert advised me to begin with), which is a
"functional" one, as you call it, and a generic one, for unit testing C, based
on check, as I already said. The idea is having Tcl wrapper scripts to
automate as much as possible: for example, in the dpkg-parsechangelog scripts,
you have a special directory (namely scripts.filebased/dpkg-parsechangelog) in
which you put files named *.input and *.expected. The Tcl script simply reads
all the *.input files, and feeds them to dpkg-parsechangelog, comparing its
output with the corresponding *.expected. OTOH, the unittesting one finds all
*.c files in dpkg.check, runs the corresponding binary (supposedly already
compiled via the main Makefile rules, but I'm not sure if that's the best
way), and catches the check-style errors (they have a fixed format).

    I still don't have _real_ tests for dpkg, I was simply experimenting a
little bit with the available tools.

> > I don't know if now, as Sarge is coming, is the right time to begin
> > working in the post-Sarge version of dpkg, or if it would be better waiting a
> > little bit. Moreover, I don't know if I should begin working with the CVS
> > version or if I should wait until somebody says it's OK working with HEAD
> > (ISTR that Scott said something about dpkg's CVS not being in good shape, but
> > it was some months ago and I could be mistaken).
> > 
> I'm working exclusively in Arch these days -- CVS is too much pain.  I
> put together a guide for people who want to hack on dpkg;
> <http://people.ubuntu.com/~scott/arch/Arch-For-Dpkg>

    Oooh, great. I like Arch for what I've read, and I guess that's a good
excuse to learn it by actually _using_ it :-)

> >     Meanwhile, we can simply discuss the testing framework, before putting
> > to much effort in it...
> > 
> Oh, I'm full-on pro-unit-testing :o)  I'd like to discuss the framework
> a bit to make sure it's easy to use;

    Yes, I also wanted to show the framework to the developers, so you all can
tell me what can be enhanced.

> I also might mention a slight allergy to TCL at some point <g>

    Yes, I didn't like it either (not that I like it now, but anyway), but
dejagnu seemed to be the best tool to integrate unittests, functional tests
and whatever we may need. If anyone comes with something better (already
written, if possible), I also would like to stay away of Tcl O:-)

> but yeah, let's see what we can do!

    I've posted the files on the web: there are two patches
(Makefile.{conf.,}in.patch) and a new directory, compressed as
testsuite.tar.bz2. They are in people.d.o/~zoso/stuff/dpkg-tests/ with a
little README. Please send any comments.

    Regards,

-- 
Esteban Manchado Velázquez <zoso@foton.es> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es

Attachment: signature.asc
Description: Digital signature


Reply to: