Re: [HACKERS] Show backtrace when tap tests fail

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] Show backtrace when tap tests fail
Дата
Msg-id 20170919204256.yvl63qzyjjv65wbx@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Show backtrace when tap tests fail  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
Ответы Re: [HACKERS] Show backtrace when tap tests fail  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2017-09-19 21:37:26 +0100, Dagfinn Ilmari Mannsåker wrote:
> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> 
> > On 09/19/2017 01:31 PM, Andres Freund wrote:
> >> Hi,
> >>
> >> I've had a couple cases where tap tests died, and I couldn't easily see
> >> where / why. For development of a new test I found it useful to show
> >> backtraces in that case - just adding a
> >> use Carp::Always;
> >> at the start of the relevant module did the trick.
> >>
> >> I'm wondering if we shouldn't always do so if the module is
> >> installed. I.e. have PostgresNode or something do something like
> 
> I think TestLib would be a better place, since PostgresNode uses TestLib
> and there are some tests that use TestLib but notf PostgresNode.

Fair.


> >> # Include module showing backtraces upon failures. As it's a
> >> non-standard module, don't fail if not installed.
> >> eval { use Carp::Always; }
> >>
> >> Comments?
> >
> > Or maybe Devel::Confess ?
> 
> Devel::Confess is more thorough, so +1 on that.

Or just try Devel::Confess first, and if the require fails, go to
Carp::always.

> > In an eval you need a 'require' rather than a 'use', AFAIK.
> 
> Yes, because 'use' happens as soon as the statement is parsed at compile
> time, long before the eval { } gets executed.  Devel::Confess does its
> setup in the 'import' method (called implicitly by 'use'), so we'd need:
> 
>   eval { require Devel::Confess; Devel::Confess->import };

My perl's rusty ;)

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [HACKERS] Re: issue: record or row variable cannot be part ofmultiple-item INTO list
Следующее
От: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Дата:
Сообщение: Re: [HACKERS] Show backtrace when tap tests fail