From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 24 13:26:34 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67262106564A for ; Fri, 24 Jun 2011 13:26:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 407798FC17 for ; Fri, 24 Jun 2011 13:26:34 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D078346B03; Fri, 24 Jun 2011 09:26:33 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6FE3B8A01F; Fri, 24 Jun 2011 09:26:33 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 24 Jun 2011 09:14:49 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <4E043B5F.3080908@embedded-brains.de> In-Reply-To: <4E043B5F.3080908@embedded-brains.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106240914.49279.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 24 Jun 2011 09:26:33 -0400 (EDT) Cc: Sebastian Huber Subject: Re: Unit Tests for FreeBSD Kernel APIs? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2011 13:26:34 -0000 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