Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2011 09:14:49 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Sebastian Huber <sebastian.huber@embedded-brains.de>
Subject:   Re: Unit Tests for FreeBSD Kernel APIs?
Message-ID:  <201106240914.49279.jhb@freebsd.org>
In-Reply-To: <4E043B5F.3080908@embedded-brains.de>
References:  <4E043B5F.3080908@embedded-brains.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, June 24, 2011 3:23:11 am Sebastian Huber wrote:
> Hello,
> 
> exists there some unit tests for FreeBSD kernel APIs, e.g. mutex(9),
> condvar(9), etc.?
> 
> Have a nice day!

Hmm, I have a kernel module that does some tests, but it is not in the tree.  
One of the issues is that many of the tests you want to do for some of these
APIs involve timing.  For rwlocks, for example, I used KTR traces and used
a kernel module that forked 4 threads to all compete over a single lock.  I
then verified via KTR traces that every branch was taken (and made liberal
use of KASSERT()s which caught a few edge cases I had missed initially).

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106240914.49279.jhb>