location reporting in TAP test failures

Started by Peter Eisentrautover 8 years ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t38822
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 08:18 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t38822_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t38822_1 && git checkout t38822_1

Patchset v1 (message #1) is on t38822_1

Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Right now, when a TAP test reports a failure, it looks something like this:

# Failed test 'creating a replication slot'
# at
/....../postgresql/src/bin/pg_basebackup/../../../src/test/perl/TestLib.pm
line 371.

That file location is where we call out to the test function provided by
Test::More.

What we'd really want is

# Failed test 'creating a replication slot'
# at t/020_pg_receivewal.pl line 36.

because that's where the code that's doing the testing is.

To achieve that, we need to have our test library functions tell that
they are support functions and not the actual tests. The attached patch
does that. The mechanism is (somewhat) explained in the Test::Builder
man page.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

t38822_1
0001-Use-Test-Builder-Level-in-TAP-test-functions.patchtext/plain; charset=UTF-8; name=0001-Use-Test-Builder-Level-in-TAP-test-functions.patch; x-mac-creator=0; x-mac-type=0Download+27-1
#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Peter Eisentraut (#1)
Re: location reporting in TAP test failures

On 05/06/18 18:28, Peter Eisentraut wrote:

Right now, when a TAP test reports a failure, it looks something like this:

# Failed test 'creating a replication slot'
# at
/....../postgresql/src/bin/pg_basebackup/../../../src/test/perl/TestLib.pm
line 371.

That file location is where we call out to the test function provided by
Test::More.

What we'd really want is

# Failed test 'creating a replication slot'
# at t/020_pg_receivewal.pl line 36.

because that's where the code that's doing the testing is.

To achieve that, we need to have our test library functions tell that
they are support functions and not the actual tests. The attached patch
does that. The mechanism is (somewhat) explained in the Test::Builder
man page.

Looks good. I wish there was some way to remind to do this for any
future test helper functions, too, but I don't have any ideas off the
top of my head.

Since this is purely a test change, IMO this could go to master now, no
need to wait for until v12 development starts.

- Heikki

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Heikki Linnakangas (#2)
Re: location reporting in TAP test failures

On 21.06.18 19:30, Heikki Linnakangas wrote:

Looks good. I wish there was some way to remind to do this for any
future test helper functions, too, but I don't have any ideas off the
top of my head.

Committed.

Since this is purely a test change, IMO this could go to master now, no
need to wait for until v12 development starts.

I didn't want to deal with the potential for some version differences in
the test modules to cause rare problems, so v12 only for now.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#4Michael Paquier
michael@paquier.xyz
In reply to: Peter Eisentraut (#3)
Re: location reporting in TAP test failures

On Sun, Jul 01, 2018 at 01:17:07PM +0200, Peter Eisentraut wrote:

On 21.06.18 19:30, Heikki Linnakangas wrote:

Since this is purely a test change, IMO this could go to master now, no
need to wait for until v12 development starts.

I didn't want to deal with the potential for some version differences in
the test modules to cause rare problems, so v12 only for now.

Totally agreed. Thanks for taking this approach.
--
Michael