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

Second proposal for a dpkg testsuite



Hi guys,

    This is only a little experiment :-) I am trying another approach
altogether: just use the Perl tests, and somehow integrate the rest inside
them. I'm using Test::Unit instead of the regular Test::More module.

    I have the whole thing public as a Darcs repository, at:

    http://www.demiurgo.org/darcs/testsuite

To test it (no pun intended), just download it using:

    darcs get http://www.demiurgo.org/darcs/testsuite

and put the resulting directory ("testsuite") inside the dpkg root directory.
Once you have dpkg ./configure'd, running the suite should be as easy as:

    make -C testsuite/

Right now, there is a proof of concept for functional tests using expected
output files, and a wrapper for C unittests with the check library (the same
as with the first, DejaGNU proposal, but implemented using Test::Unit
instead). If this proposal is successful, I already have a couple of ideas to
make it easier to write C unittests, like using #include's so that one only
has to write the tests, and not all the repetitive declaration chunks...

    I think this one addresses all of Scott concerns, and uses one of the dpkg
suite implementation languages (Perl), so the unit tests for that language are
"native" and don't have to be wrapped in any way.

    Example output for "everything fine":

------------------------------------- 8< -------------------------------------
make: Entering directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
perl -w 000-complete_suite.pl
...
Time:  0 wallclock secs ( 0.02 usr +  0.00 sys =  0.02 CPU)

OK (3 tests)
make: Leaving directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
------------------------------------- >8 -------------------------------------

Example output for C unittest fail:

------------------------------------- 8< -------------------------------------
make: Entering directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
perl -w 000-complete_suite.pl
...F
Time:  0 wallclock secs ( 0.01 usr +  0.00 sys =  0.01 CPU)

!!!FAILURES!!!
Test Results:
Run: 3, Failures: 1, Errors: 0

There was 1 failure:
1) TestCUnittests.pm:25 - test_c_unittests(TestCUnittests)
 Simple version comparison

Test was not successful.
make: Leaving directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
------------------------------------- >8 -------------------------------------

This will have to be tweaked, so one knows where the failing test really comes
from (the C source file and line, although the C test name is already
available).

    Finally, example output for a Perl functional test fail:

------------------------------------- 8< -------------------------------------
make: Entering directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
perl -w 000-complete_suite.pl
..F.
Time:  1 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU)

!!!FAILURES!!!
Test Results:
Run: 3, Failures: 1, Errors: 0

There was 1 failure:
1) DpkgTest/FunctionalTest.pm:61 - test_output_files(TestDpkgScanpackages)
expected 'Package: test1
Version: 1.0
Priority: optional
Section: misc
Maintainer: Dpkg testsuite <zoso@debian.org>
Architecture: all
Filename: testsuite/dpkg-scanpackages/1-tree/test1_1.0_all.deb
Size: 2014
Installed-Size: 12
MD5sum: f9664f9347e46f681e4279fe11837301
Description: Dummy test package 1
 long description and info
 .
 second paragraph

', got 'Package: test1
Version: 1.0
Priority: optional
Section: misc
Maintainer: Dpkg testsuite <zoso@debian.org>
Architecture: all
Filename: dpkg-scanpackages/1-tree/test1_1.0_all.deb
Size: 2014
Installed-Size: 12
MD5sum: f9664f9347e46f681e4279fe11837301
Description: Dummy test package 1
 long description and info
 .
 second paragraph

'

Test was not successful.
make: Leaving directory `/home/zoso/src/debian/dpkg-1.13.22/testsuite'
------------------------------------- >8 -------------------------------------

Probably, when comparing output files, we should compare that the diff between
them is not empty, so the error message includes the diff. But this is just a
proof of concept, and I prefer having comments and feeback before investing
more time on this one.

    Best regards,

-- 
Esteban Manchado Velázquez <zoso@debian.org>
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es
Help spread it through the Net in signatures, webpages, whatever!

Attachment: signature.asc
Description: Digital signature


Reply to: