Re: PATCH: Unlogged tables re-initialization tests

From: David Steele <david(at)pgmasters(dot)net>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: PATCH: Unlogged tables re-initialization tests
Date: 2018-03-12 18:33:18
Message-ID: 76c4af0b-1b7e-44c1-86af-b36bdd75ff79@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/12/18 11:59 AM, Dagfinn Ilmari Mannsåker wrote:
> David Steele <david(at)pgmasters(dot)net> writes:
>
>> On 3/12/18 11:27 AM, Peter Eisentraut wrote:
>>> On 3/11/18 05:11, Michael Paquier wrote:
>>>> On Fri, Mar 09, 2018 at 05:23:48PM -0500, Peter Eisentraut wrote:
>>>>> This seems like a useful test.
>>>>>
>>>>> On 3/5/18 12:35, David Steele wrote:
>>>>>> +mkdir($tablespaceDir)
>>>>>> + or die "unable to mkdir \"$tablespaceDir\"";
>>>>>
>>>>> Use BAIL_OUT instead of die in tests.
>>>>
>>>> Would it be better to make this practice more uniform? From the code of
>>>> the tests:
>>>> $ git grep die -- */t/*.pl | wc -l
>>>> 50
>>>
>>> Yes, or maybe there is a way to "catch" die and turn it into BAIL_OUT?
>>
>> something like this should work:
>>
>> # Convert die to BAIL_OUT
>> $SIG{__DIE__} = sub {BAIL_OUT(@_)};
>
> $SIG{__DIE__} gets called even for exceptions that would be caught by a
> surrunding eval block, so this should at the very least be:
>
> $SIG{__DIE__} = sub { BAIL_OUT(@_) unless $^S };
>
> However, that is still wrong, because die() and BAIL_OUT() mean
> different things: die() aborts the current test script, while BAIL_OUT()
> aborts the entire 'prove' run, i.e. all subsequent scripts in the same
> test directory.

If that's the case, do we really want to abort all subsequent test
modules if a single module fails? I'm good either way, just throwing it
out there for consideration.

--
-David
david(at)pgmasters(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Grigory Smolkin 2018-03-12 18:51:38 Re: Function to track shmem reinit time
Previous Message Tom Lane 2018-03-12 18:06:51 Re: Ambigous Plan - Larger Table on Hash Side