Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id DF1A66329C7 for ; Sat, 26 Sep 2009 15:29:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 98552-06 for ; Sat, 26 Sep 2009 18:28:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f172.google.com (mail-pz0-f172.google.com [209.85.222.172]) by mail.postgresql.org (Postfix) with ESMTP id E999C632585 for ; Sat, 26 Sep 2009 15:28:53 -0300 (ADT) Received: by pzk2 with SMTP id 2so1492112pzk.28 for ; Sat, 26 Sep 2009 11:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:date:from:to:cc :subject:message-id:mail-followup-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=GFVPX2qCAHh3zpWWsi9PFv9Ib+k3a/1TqIg7vrFtDx4=; b=na6oW3fIZ0aPQN51JNy+wDsIctBUPn9WCLRxee7JPU4z4MpDpyvO1IOqLb/4ZHT/Qp 1lPHMLxkdj1dxtlwUTFFykWAuv4ufF6idlpX36UkZbObPupA+vUIzr69nannExlg3xhJ l886iWInJnv8Q482+Nml1bs+ZCZGR679Mmk58= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; b=jC0kmZKdKCm1XaDcp5KaBffEfw1FK4jRG+BKIvnS7YWaYarv9afz9JFl4JfMkWhVW9 DjGNaomyuMkQgzCMHYNow6YGUiVC34eIGgqkm3hkcJMlaVO28rWQHr7jhb6tTvmLFuqq AOBfIW9QxHFgyEtkrbHZPJPogFmEH/+gWB8zU= Received: by 10.115.38.32 with SMTP id q32mr2174671waj.8.1253989730276; Sat, 26 Sep 2009 11:28:50 -0700 (PDT) Received: from funkstrom.spiretech.com (colish.dsl.spiretech.net [69.168.48.76]) by mx.google.com with ESMTPS id 22sm1240297pzk.14.2009.09.26.11.28.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 26 Sep 2009 11:28:48 -0700 (PDT) Date: Sat, 26 Sep 2009 11:28:59 -0700 From: Dan Colish To: Mark Mielke Cc: Simon Riggs , Robert Haas , pgsql-hackers Subject: Re: Hot Standby on git Message-ID: <20090926182859.GA9544@funkstrom.spiretech.com> Mail-Followup-To: Mark Mielke , Simon Riggs , Robert Haas , pgsql-hackers References: <1253958559.4449.833.camel@ebony.2ndQuadrant> <603c8f070909260629s1f070a8bl8aa6dc97fa87ce43@mail.gmail.com> <1253973877.4449.899.camel@ebony.2ndQuadrant> <4ABE28FD.7060404@mark.mielke.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ABE28FD.7060404@mark.mielke.cc> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=AWL=0.000, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/1698 X-Sequence-Number: 146504 On Sat, Sep 26, 2009 at 10:45:17AM -0400, Mark Mielke wrote: > On 09/26/2009 10:04 AM, Simon Riggs wrote: > >>If you think there's > >>something useful I could do, let me know and I'll take a look. > >I feel like I need a better way of unit testing new code. Some of the > >code in the patch is to handle corner cases, so recreating them is > >fairly hard. It is a nagging feeling that I am missing some knowledge > >here and would welcome some insight, or research, into better ways of > >doing general case unit testing. > > You might try and steal ideas from EasyMock / PowerMock - but not > sure how well the ideas map to C. > > Generally it means allowing the functions to be called from a "mock" > environment, where subroutine calls that might be called are stubbed > out to return sample data that would simulate your scenario. Object > oriented languages that require every object to provide an interface > where most object methods can be overridden are more ideal for > performing this sort of test. > > I rarely ever see this sort of stuff in FOSS projects, and never > that I can remember in FOSS C projects. It's not easy, though. > > I assume you are doing it through code changing right now. > Commenting out lines, replacing them with others, etc? > > Cheers, > mark > > -- > Mark Mielke > > There are a variety of projects dedicated to creating C unit test frameworks. I don't have a lot of experience with them, but I have heard good things about check and cunit. Here's a link I found with a longer list of frameworks. http://www.opensourcetesting.org/unit_c.php -- --Dan