A note about debugging TAP failures

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: A note about debugging TAP failures
Date: 2017-04-22 17:51:30
Message-ID: 6205.1492883490@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've whined before about how developer-unfriendly the TAP test
infrastructure is. One concrete problem is that if there is a failure,
there is absolutely no way to get any information beyond what is in the
logs, because the test installation's data directory is unconditionally
blown away at run end. I wanted to look at the core file from an
assertion failure, but of course that wasn't there anymore. (I realize
I could've reconfigured my kernel to drop the core file somewhere else,
but what if I'd needed to look at the data directory per se?)

I got around this for the immediate need with this expedient hack:

diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index ae8d178..8f2f09c 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -138,7 +138,7 @@ sub tempdir
return File::Temp::tempdir(
$prefix . '_XXXX',
DIR => $tmp_check,
- CLEANUP => 1);
+ CLEANUP => 0);
}

sub tempdir_short

but that still wasn't exactly friendly, since at the end of the run
I had a bunch of randomly-named data directories and had to guess
which one corresponded to the failing test script.

I think we need to fix TestLib and/or PostgresNode so that there's a way
to make TAP tests not auto-clean their data directories at end of run,
without having to resort to editing the script like this. It'd also be
helpful if the data directory pathname included the test script's name.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sandeep Thakkar 2017-04-22 17:58:49 Re: Patch - Tcl 8.6 version support for PostgreSQL
Previous Message Pierre Ducroquet 2017-04-22 16:46:26 Re: Small patch for pg_basebackup argument parsing