On 29/10/10 01:04, Björn Fahller wrote:
On Thursday 28 October 2010 15.52.49 Jeroen van Meeuwen (Kolab Systems) wrote:
Greg Banks wrote:
In the short term I was hoping to get some point regression tests for
some of the lower-level code happening.  I was thinking of using CUnit
http://cunit.sourceforge.net/ to help manage the tests.  Thoughts?
I obviously missed this discussion. What are the specifics you want to test
for?

I want to write some unit tests for parts of the Cyrus code, starting with low-level library code and working upwards to more complex parts of the code. At the moment I have some mostly-working infrastructure and a few tests, like this:

### Making check in /home/gnb/software/cyrus/imapd/cunit
make[1]: Entering directory `/home/gnb/software/cyrus/imapd/cunit'
./unit


     CUnit - A Unit testing framework for C - Version 2.1-0
     http://cunit.sourceforge.net/


Suite: lib/glob
  Test: star ... passed
  Test: percent ... passed
  Test: percent_percent ... passed
  Test: questionmark ... passed
  Test: star_substring ... passed
  Test: star_icase ... passed
Suite: lib/md5
  Test: single ... passed
  Test: multiple ... passed
Suite: lib/parseaddr
  Test: single ... passed
  Test: single_append ... passed
  Test: multiple ... passed
  Test: quoted_name ... passed
  Test: quoted_name_comma ... passed
  Test: comment_name ... passed
  Test: quoted_mailbox ... passed
  Test: mailbox_comment ... FAILED
    1. test/parseaddr.c:135  - CU_ASSERT_STRING_EQUAL(a->mailbox="Wilt . 
Chamberlain","Wilt.Chamberlain"="Wilt.Chamberlain")
  Test: domain_literal ... passed
  Test: dotted_mailbox ... passed
  Test: long_domain ... passed
  Test: group ... passed
Suite: imap/times
  Test: rfc3501 ... passed
  Test: military_timezones ... passed
Suite: imap/message
  Test: parse_mapped ... passed

--Run Summary: Type      Total     Ran  Passed  Failed
               suites        5       5     n/a       0
               tests        23      23      22       1
               asserts     175     175     174       1
make[1]: Leaving directory `/home/gnb/software/cyrus/imapd/cunit'



Depending on your needs, may I humbly and shamelessly plug
http://crpcut.sourceforge.net ?

Fascinating...it's always nice to see yet another test infrastructure implementation.

I've only scanned the User's Guide, so please correct me if I'm wrong, but I don't see any significant advantage over CUnit + Valgrind? And it requires C++, which nothing in Cyrus uses so far (and hopefully nothing ever will). Also, rather conveniently CUnit is already packaged on Ubunbtu where I do my development.


Advantage: Very easy to test pesky low level failures that are quite difficult
to achieve in a controlled way in a running system (close() fails, broken
connections, disk full, read() corrupts, out of memory, etc.)

I'm quite a way away from testing abnormal conditions, although that will be very useful when testing the mailbox code.

--
Greg.

Reply via email to