[PATCH] Add tests for src/backend/nodes/extensible.c

Started by Aleksander Alekseev4 months ago5 messageshackers
Jump to latest
#1Aleksander Alekseev
aleksander@timescale.com

Hi,

Currently extensible.c is not covered by any tests. The proposed patch
fixes this. Also it can serve as an example of using CustomScan and
ExtensibleNode.

For the reviewers
-----------------------

Here is how to check the code coverage:

```
git clean -df
rm -r build
meson setup --buildtype debug -Db_coverage=true -Dcassert=true
-Dinjection_points=true -Dtap_tests=enabled -Dldap=disabled
-Dicu=disabled -DPG_TEST_EXTRA="kerberos ldap libpq_encryption
load_balance oauth regress_dump_restore ssl wal_consistency_checking
xid_wraparound" -Dprefix=/home/eax/pginstall build
ninja -C build
meson test -C build
ninja -C build coverage-html
open build/meson-logs/coveragereport/index.html
```

You are going to need `lcov` 1.16 in your $PATH because there are
certain problems with newer versions [1]/messages/by-id/CAJ7c6TN+MCh99EZ8YGhXZAdnqvNQYir6E34B_mmcB5KsxCB00A@mail.gmail.com.

[1]: /messages/by-id/CAJ7c6TN+MCh99EZ8YGhXZAdnqvNQYir6E34B_mmcB5KsxCB00A@mail.gmail.com

--
Best regards,
Aleksander Alekseev

Attachments:

v1-0001-Add-test-module-for-src-backend-nodes-extensible.patchtext/x-patch; charset=UTF-8; name=v1-0001-Add-test-module-for-src-backend-nodes-extensible.patchDownload+575-1
#2Rafia Sabih
rafia.pghackers@gmail.com
In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Add tests for src/backend/nodes/extensible.c

On Tue, 31 Mar 2026 at 20:48, Aleksander Alekseev <aleksander@tigerdata.com>
wrote:

Hi,

Currently extensible.c is not covered by any tests. The proposed patch
fixes this. Also it can serve as an example of using CustomScan and
ExtensibleNode.

For the reviewers
-----------------------

Here is how to check the code coverage:

```
git clean -df
rm -r build
meson setup --buildtype debug -Db_coverage=true -Dcassert=true
-Dinjection_points=true -Dtap_tests=enabled -Dldap=disabled
-Dicu=disabled -DPG_TEST_EXTRA="kerberos ldap libpq_encryption
load_balance oauth regress_dump_restore ssl wal_consistency_checking
xid_wraparound" -Dprefix=/home/eax/pginstall build
ninja -C build
meson test -C build
ninja -C build coverage-html
open build/meson-logs/coveragereport/index.html
```

You are going to need `lcov` 1.16 in your $PATH because there are
certain problems with newer versions [1].

[1]:
/messages/by-id/CAJ7c6TN+MCh99EZ8YGhXZAdnqvNQYir6E34B_mmcB5KsxCB00A@mail.gmail.com

--
Best regards,
Aleksander Alekseev

I looked into this patch and have a few comments.
Firstly, in test_create_custom_scan_state() why hard coding css.slotOps =
&TTSOpsBufferHeapTuple and not using the table_slot_callbacks() for the
purpose and getting the real AM.
Next, in test_plan_custom_path, the last two arguments are never used.
There are no tests for nodeCopy, nodeEqual, nodeOut, and nodeRead routines.

--
Regards,
Rafia Sabih
CYBERTEC PostgreSQL International GmbH

#3Aleksander Alekseev
aleksander@timescale.com
In reply to: Rafia Sabih (#2)
Re: [PATCH] Add tests for src/backend/nodes/extensible.c

Hi Rafia,

I looked into this patch and have a few comments.
Firstly, in test_create_custom_scan_state() why hard coding css.slotOps = &TTSOpsBufferHeapTuple and not using the table_slot_callbacks() for the purpose and getting the real AM.
Next, in test_plan_custom_path, the last two arguments are never used.
There are no tests for nodeCopy, nodeEqual, nodeOut, and nodeRead routines.

Many thanks for the feedback! Here is the corrected patch.

--
Best regards,
Aleksander Alekseev

Attachments:

v2-0001-Add-test-module-for-src-backend-nodes-extensible..patchtext/x-patch; charset=US-ASCII; name=v2-0001-Add-test-module-for-src-backend-nodes-extensible..patchDownload+762-1
#4Rafia Sabih
rafia.pghackers@gmail.com
In reply to: Aleksander Alekseev (#3)
Re: [PATCH] Add tests for src/backend/nodes/extensible.c

On Thu, 30 Jul 2026 at 18:21, Aleksander Alekseev <aleksander@tigerdata.com>
wrote:

Hi Rafia,

I looked into this patch and have a few comments.
Firstly, in test_create_custom_scan_state() why hard coding css.slotOps

= &TTSOpsBufferHeapTuple and not using the table_slot_callbacks() for the
purpose and getting the real AM.

Next, in test_plan_custom_path, the last two arguments are never used.
There are no tests for nodeCopy, nodeEqual, nodeOut, and nodeRead

routines.

Many thanks for the feedback! Here is the corrected patch.

Thanks. There is a typo in the current patch --... the CustomScanStateand

and is expected
Other than that it looks good to me.

--
Regards,
Rafia Sabih
CYBERTEC PostgreSQL International GmbH

#5Aleksander Alekseev
aleksander@timescale.com
In reply to: Rafia Sabih (#4)
Re: [PATCH] Add tests for src/backend/nodes/extensible.c

Hi Rafia,

Thanks. There is a typo in the current patch --... the CustomScanStateand and is expected
Other than that it looks good to me.

Thanks! Fixed.

--
Best regards,
Aleksander Alekseev

Attachments:

v3-0001-Add-test-module-for-src-backend-nodes-extensible..patchtext/x-patch; charset=US-ASCII; name=v3-0001-Add-test-module-for-src-backend-nodes-extensible..patchDownload+762-1