Re: PATCH: Unlogged tables re-initialization tests - Mailing list pgsql-hackers

From ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Subject Re: PATCH: Unlogged tables re-initialization tests
Date
Msg-id d8j3715qo81.fsf@dalvik.ping.uio.no
Whole thread Raw
In response to Re: PATCH: Unlogged tables re-initialization tests  (David Steele <david@pgmasters.net>)
Responses Re: PATCH: Unlogged tables re-initialization tests  (David Steele <david@pgmasters.net>)
Re: PATCH: Unlogged tables re-initialization tests  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
David Steele <david@pgmasters.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.

- ilmari
-- 
- Twitter seems more influential [than blogs] in the 'gets reported in
  the mainstream press' sense at least.               - Matt McLeod
- That'd be because the content of a tweet is easier to condense down
  to a mainstream media article.                      - Calle Dybedahl


pgsql-hackers by date:

Previous
From: Pavel Luzanov
Date:
Subject: Re: [HACKERS] proposal: schema variables
Next
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Allow UNIQUE indexes on partitioned tables