Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7848E6335A1 for ; Sat, 26 Sep 2009 11:45:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 57702-03 for ; Sat, 26 Sep 2009 14:45:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-01.primus.ca (smtp-noauth7.primus.ca [216.254.180.38]) by mail.postgresql.org (Postfix) with ESMTP id 7D214631870 for ; Sat, 26 Sep 2009 11:45:26 -0300 (ADT) Received: from [206.191.44.11] (helo=bambi.pccyber.com) by mail-01.primus.ca with esmtp (Exim 4.69) (envelope-from ) id 1MrYWZ-0007N3-0y; Sat, 26 Sep 2009 10:45:23 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by bambi.pccyber.com (Postfix) with ESMTP id 84B7C1B49CF; Sat, 26 Sep 2009 10:45:22 -0400 (EDT) X-Virus-Scanned: amavisd-new at pccyber.com Received: from bambi.pccyber.com ([127.0.0.1]) by localhost (bambi.pccyber.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PnzfLJe6vQPb; Sat, 26 Sep 2009 10:45:21 -0400 (EDT) Received: from [173.35.103.0] (CPE0050fca9b0e1-CM0018c0d3a5ba.cpe.net.cable.rogers.com [173.35.103.0]) (Authenticated sender: mark@pccyber.com) by bambi.pccyber.com (Postfix) with ESMTPA id AD0FB1B49CE; Sat, 26 Sep 2009 10:45:21 -0400 (EDT) Message-ID: <4ABE28FD.7060404@mark.mielke.cc> Date: Sat, 26 Sep 2009 10:45:17 -0400 From: Mark Mielke User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 MIME-Version: 1.0 To: Simon Riggs CC: Robert Haas , pgsql-hackers Subject: Re: Hot Standby on git References: <1253958559.4449.833.camel@ebony.2ndQuadrant> <603c8f070909260629s1f070a8bl8aa6dc97fa87ce43@mail.gmail.com> <1253973877.4449.899.camel@ebony.2ndQuadrant> In-Reply-To: <1253973877.4449.899.camel@ebony.2ndQuadrant> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/1689 X-Sequence-Number: 146495 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