| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Aleksander Alekseev <aleksander(at)tigerdata(dot)com>, Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Gregory Burd <greg(at)burd(dot)me>, Melanie Plageman <melanieplageman(at)gmail(dot)com> |
| Subject: | Re: Python/pytest test framework take two |
| Date: | 2026-09-18 03:48:23 |
| Message-ID: | CAGRkXqQ_Z7r9futBfn17qWrzP+3uJheKNwtWWL0twXn-YVrKZQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi
I came here from the pg_stat_progress_vacuum thread [1], where Michael
pointed to Python for tests like that.
On 2026-08-19, Andres Freund wrote:
> What's your plan for validating that these do not actually reduce test
> coverage substantially?
>
> I think this needs some systematic work. E.g. build with coverage, clear
all
> coverage, running the perl test, collect coverage, clear coverage, run the
> python test, compare the two coverages, including branch coverage.
Attached is a small script for that. It runs two tests from zeroed
counters and lists, per function, the lines only one of them hits. It
needs a -Db_coverage=true build and lcov. It prints a Markdown table
by default, or plain text with --format text.
nocfbot-covdiff.py --format text --top 8 \
test_aio/001_aio test_aio/test_001_aio
perl = test_aio/001_aio
python = test_aio/test_001_aio
Lines only in one test, per function, largest first.
Showing 8 of 408 functions, use --top N for more, --top 0 for all.
perl python file:function
130 psql/mainloop.c:MainLoop
126 tcop/postgres.c:exec_bind_message
121 psql/startup.c:main
121 fe_utils/psqlscan.l:(no function)
84 psql/common.c:ExecQueryAndProcessResults
84 tcop/postgres.c:exec_simple_query
78 nodes/copyfuncs.c:copyObjectImpl
71 tcop/postgres.c:exec_execute_message
Lines hit: perl 68887, python 68420
Lines only in it: perl 2372, python 1893
On 001_aio from v1, the lines only the Perl test hits are psql, libpq
and the simple query path, and the rest of the suite covers all of
them. One real difference: Cluster.pm sets wal_level = minimal by
default and pypg does not, so the Python test misses the WAL skip path,
like smgrDoPendingSyncs().
Given we have not started migration yet, I am not sure whether a script like
this should go in the tree or live somewhere else. I would leave that to you
folks.
[1] https://postgr.es/m/aqxxGzx6Ll_sbIMH@paquier.xyz
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-covdiff.py | text/x-python-script | 8.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Haibo Yan | 2026-09-18 03:57:15 | Re: Global temporary tables |
| Previous Message | Amit Kapila | 2026-09-18 03:43:06 | Re: Distinguish publication exclusions in object addresses |