From: Dan Colish <dan@unencrypted.org>
To: Mark Mielke <mark@mark.mielke.cc>
Cc: Simon Riggs <simon@2ndQuadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Hot Standby on git
Date: Sat, 26 Sep 2009 11:28:59 -0700
Message-ID: <20090926182859.GA9544@funkstrom.spiretech.com> (raw)
In-Reply-To: <4ABE28FD.7060404@mark.mielke.cc>
References: <1253958559.4449.833.camel@ebony.2ndQuadrant>
<603c8f070909260629s1f070a8bl8aa6dc97fa87ce43@mail.gmail.com>
<1253973877.4449.899.camel@ebony.2ndQuadrant>
<4ABE28FD.7060404@mark.mielke.cc>
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<mark@mielke.cc>
>
>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: dan@unencrypted.org, mark@mark.mielke.cc, simon@2ndQuadrant.com, robertmhaas@gmail.com
Subject: Re: Hot Standby on git
In-Reply-To: <20090926182859.GA9544@funkstrom.spiretech.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox