* [meta-oe][PATCH 0/3] ptest for PGXS extensions
@ 2026-12-01 20:16 Babanpreet Singh
2026-12-01 20:16 ` [meta-oe][PATCH 1/3] postgresql: package pg_regress in postgresql-regress Babanpreet Singh
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Babanpreet Singh @ 2026-12-01 20:16 UTC (permalink / raw)
To: openembedded-devel; +Cc: Khem Raj, Babanpreet Singh
Add a class that runs a PostgreSQL extension's own regression tests as
its ptest, and use it for pg-cron. pg_regress moves to its own package
so the ptest does not need postgresql-server-dev.
Tested on qemux86-64 with ptest-runner. pgvector, pgaudit and orafce
will follow once their recipes are merged.
Babanpreet Singh (3):
postgresql: package pg_regress in postgresql-regress
ptest-pgxs.bbclass: add class for PGXS extension tests
pg-cron: add ptest support
meta-oe/classes/ptest-pgxs.bbclass | 97 +++++++++++++++++++
.../include/ptest-packagelists-meta-oe.inc | 1 +
meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb | 4 +-
meta-oe/recipes-dbs/postgresql/postgresql.inc | 4 +-
4 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 meta-oe/classes/ptest-pgxs.bbclass
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [meta-oe][PATCH 1/3] postgresql: package pg_regress in postgresql-regress
2026-12-01 20:16 [meta-oe][PATCH 0/3] ptest for PGXS extensions Babanpreet Singh
@ 2026-12-01 20:16 ` Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
2026-12-01 20:16 ` [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests Babanpreet Singh
2026-12-01 20:17 ` [meta-oe][PATCH 3/3] pg-cron: add ptest support Babanpreet Singh
2 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-12-01 20:16 UTC (permalink / raw)
To: openembedded-devel; +Cc: Khem Raj, Babanpreet Singh
pg_regress is needed on the target to run the regression tests of
extensions. Give it its own package, so a ptest does not have to pull
in postgresql-server-dev.
AI-Generated: Uses Claude (claude-opus-5-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
meta-oe/recipes-dbs/postgresql/postgresql.inc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
index 00545ec74e..cf7ffc134e 100644
--- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
+++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
@@ -359,7 +359,7 @@ postgresql_fix_sources () {
}
PACKAGESPLITFUNCS =+ "postgresql_fix_sources"
-PACKAGES =+ "${PN}-client ${PN}-client-doc ${PN}-server-dev ${PN}-timezone \
+PACKAGES =+ "${PN}-client ${PN}-client-doc ${PN}-regress ${PN}-server-dev ${PN}-timezone \
libecpg-compat libecpg-compat-dev \
libecpg libecpg-dev libecpg-staticdev libecpg-doc \
libpq libpq-dev libpq-staticdev \
@@ -421,6 +421,8 @@ FILES:${PN}-timezone = "${datadir}/${BPN}/timezone \
${datadir}/${BPN}/timezonesets \
"
RDEPENDS:${PN} += "${PN}-timezone"
+FILES:${PN}-regress = "${libdir}/${BPN}/pgxs/src/test/regress/pg_regress"
+RDEPENDS:${PN}-regress += "${PN}-client"
FILES:${PN}-server-dev = "${includedir}/${BPN}/server \
${libdir}/${BPN}/pgxs \
"
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests
2026-12-01 20:16 [meta-oe][PATCH 0/3] ptest for PGXS extensions Babanpreet Singh
2026-12-01 20:16 ` [meta-oe][PATCH 1/3] postgresql: package pg_regress in postgresql-regress Babanpreet Singh
@ 2026-12-01 20:16 ` Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
2026-12-01 20:17 ` [meta-oe][PATCH 3/3] pg-cron: add ptest support Babanpreet Singh
2 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-12-01 20:16 UTC (permalink / raw)
To: openembedded-devel; +Cc: Khem Raj, Babanpreet Singh
Run the regression tests of a PostgreSQL extension built with PGXS as
its ptest. The tests and their options come from the extension's own
Makefile.
AI-Generated: Uses Claude (claude-opus-5-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
meta-oe/classes/ptest-pgxs.bbclass | 97 ++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100644 meta-oe/classes/ptest-pgxs.bbclass
diff --git a/meta-oe/classes/ptest-pgxs.bbclass b/meta-oe/classes/ptest-pgxs.bbclass
new file mode 100644
index 0000000000..95ca4be08c
--- /dev/null
+++ b/meta-oe/classes/ptest-pgxs.bbclass
@@ -0,0 +1,97 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Class for running the pg_regress tests of PostgreSQL extensions built
+# with PGXS as ptest
+
+inherit pgxs ptest
+
+PTEST_PGXS_CONF ?= ""
+PTEST_PGXS_CONF[doc] = "Extra postgresql.conf lines for the test server, separated by \\n."
+
+do_install_ptest() {
+ cat > ${WORKDIR}/ptest-pgxs.mk << 'EOF'
+ptest-pgxs-vars:
+ @echo "REGRESS=$(REGRESS)"
+ @echo "REGRESS_OPTS=$(REGRESS_OPTS)"
+EOF
+ vars=$(oe_runmake -s -C ${B} -f Makefile -f ${WORKDIR}/ptest-pgxs.mk ptest-pgxs-vars)
+ regress=$(echo "$vars" | sed -n 's/^REGRESS=//p')
+ conf=""
+ opts=""
+ inputdir=.
+ for o in $(echo "$vars" | sed -n 's/^REGRESS_OPTS=//p'); do
+ case "$o" in
+ --temp-config=*) conf=$(basename "${o#--temp-config=}") ;;
+ --temp-instance=*|--dbname=*) ;;
+ --inputdir=*) inputdir="${o#--inputdir=}"; opts="$opts $o" ;;
+ *) opts="$opts $o" ;;
+ esac
+ done
+
+ install -d ${D}${PTEST_PATH}/tests/$inputdir
+ for d in sql expected input output data; do
+ if [ -d ${S}/$inputdir/$d ]; then
+ cp -r ${S}/$inputdir/$d ${D}${PTEST_PATH}/tests/$inputdir/
+ fi
+ done
+ for o in $opts; do
+ case "$o" in
+ --schedule=*) install -m 0644 ${S}/${o#--schedule=} ${D}${PTEST_PATH}/tests/ ;;
+ esac
+ done
+
+ : > ${D}${PTEST_PATH}/tests/ptest.conf
+ if [ -n "$conf" ] && [ -f ${S}/$conf ]; then
+ cat ${S}/$conf >> ${D}${PTEST_PATH}/tests/ptest.conf
+ fi
+ if [ -n "${PTEST_PGXS_CONF}" ]; then
+ printf '%b\n' "${PTEST_PGXS_CONF}" >> ${D}${PTEST_PATH}/tests/ptest.conf
+ fi
+
+ printf 'REGRESS="%s"\nREGRESS_OPTS="%s"\nPGBIN="%s"\nPG_REGRESS="%s"\n' \
+ "$regress" "$opts" "${bindir}" \
+ "${libdir}/postgresql/pgxs/src/test/regress/pg_regress" \
+ > ${D}${PTEST_PATH}/ptest-pgxs.vars
+
+ if [ ! -f "${UNPACKDIR}/run-ptest" ]; then
+ cat > ${D}${PTEST_PATH}/run-ptest << 'EOF'
+#!/bin/sh
+
+PTEST_PATH=$(dirname "$(readlink -f "$0")")
+. "$PTEST_PATH/ptest-pgxs.vars"
+NAME=$(basename "$(dirname "$PTEST_PATH")")
+
+WORK=$(mktemp -d /tmp/ptest-pgxs.XXXXXX)
+cp -r "$PTEST_PATH/tests/." "$WORK/"
+chown -R postgres:postgres "$WORK"
+
+LOG="$WORK/pg_regress.log"
+{ su postgres -c "cd $WORK && $PG_REGRESS \
+ --temp-instance=$WORK/tmp_check --temp-config=$WORK/ptest.conf \
+ --bindir=$PGBIN --dbname=contrib_regression \
+ $REGRESS_OPTS $REGRESS" 2>&1; echo $? > "$WORK/rc"; } |
+ tee "$LOG" |
+ sed -n -e 's/^ok [0-9]* *[-+] *\([^ ]*\).*/PASS: \1/p' \
+ -e 's/^not ok [0-9]* *[-+] *\([^ ]*\).*/FAIL: \1/p'
+RC=$(cat "$WORK/rc" 2>/dev/null || echo 2)
+
+if [ "$RC" -ne 0 ]; then
+ if [ "$RC" -ne 1 ] || ! grep -q '^\(not \)\{0,1\}ok [0-9]' "$LOG"; then
+ echo "FAIL: $NAME"
+ cat "$LOG"
+ echo
+ fi
+ [ -f "$WORK/regression.diffs" ] && cat "$WORK/regression.diffs"
+fi
+rm -rf "$WORK"
+[ "$RC" -eq 0 ]
+EOF
+ chmod 0755 ${D}${PTEST_PATH}/run-ptest
+ fi
+}
+
+RDEPENDS:${PN}-ptest += "postgresql postgresql-client postgresql-regress"
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests
2026-12-01 20:16 ` [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests Babanpreet Singh
@ 2026-12-02 0:53 ` Khem Raj
2026-12-02 1:26 ` [meta-oe][PATCH " Babanpreet Singh
0 siblings, 1 reply; 8+ messages in thread
From: Khem Raj @ 2026-12-02 0:53 UTC (permalink / raw)
To: openembedded-devel, Babanpreet Singh
On Tue, Dec 1, 2026 at 12:16 PM Babanpreet Singh <bbnpreetsingh@gmail.com> wrote:
> + cat > ${WORKDIR}/ptest-pgxs.mk << 'EOF'
${T} is the usual place for a scratch file like this.
> + for o in $(echo "$vars" | sed -n 's/^REGRESS_OPTS=//p'); do
This splits REGRESS_OPTS on whitespace, so an option whose value has
spaces or quotes is broken apart. Fine for the extensions you mention,
but worth a comment in the class.
> + --temp-instance=*|--dbname=*) ;;
Dropping --dbname and always using contrib_regression changes behaviour
for an extension whose expected output names its own database (pg_cron
only works because PTEST_PGXS_CONF sets cron.database_name). Please
document that in the class header next to PTEST_PGXS_CONF.
> + --schedule=*) install -m 0644 ${S}/${o#--schedule=} ${D}${PTEST_PATH}/tests/ ;;
The schedule is installed under its basename, but $opts still carries
the original --schedule= path, so a schedule in a subdirectory is not
found at run time. Either keep the directory when installing it or
rewrite the option to the basename.
> + "${libdir}/postgresql/pgxs/src/test/regress/pg_regress" \
Minor: postgresql.inc uses ${libdir}/${BPN}; here it is hard-coded.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests
2026-12-02 0:53 ` [PATCH " Khem Raj
@ 2026-12-02 1:26 ` Babanpreet Singh
0 siblings, 0 replies; 8+ messages in thread
From: Babanpreet Singh @ 2026-12-02 1:26 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-devel, Babanpreet Singh
Hi Khem,
Thanks for the careful review, and for catching the schedule path. I
have sent v2 with your points addressed.
The pg_regress path I left as it is: in the class ${BPN} is the
extension's name, so ${libdir}/${BPN} would point to the wrong place.
Happy to change it if you had something else in mind.
Thanks,
Babanpreet
^ permalink raw reply [flat|nested] 8+ messages in thread
* [meta-oe][PATCH 3/3] pg-cron: add ptest support
2026-12-01 20:16 [meta-oe][PATCH 0/3] ptest for PGXS extensions Babanpreet Singh
2026-12-01 20:16 ` [meta-oe][PATCH 1/3] postgresql: package pg_regress in postgresql-regress Babanpreet Singh
2026-12-01 20:16 ` [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests Babanpreet Singh
@ 2026-12-01 20:17 ` Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
2 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-12-01 20:17 UTC (permalink / raw)
To: openembedded-devel; +Cc: Khem Raj, Babanpreet Singh
Test results on qemux86-64:
START: ptest-runner
BEGIN: /usr/lib/pg-cron/ptest
PASS: pg_cron-test
DURATION: 11
END: /usr/lib/pg-cron/ptest
STOP: ptest-runner
TOTAL: 1 FAIL: 0
AI-Generated: Uses Claude (claude-opus-5-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
meta-oe/conf/include/ptest-packagelists-meta-oe.inc | 1 +
meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
index 0e2df75d3f..09f78517e3 100644
--- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
+++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
@@ -56,6 +56,7 @@ PTESTS_FAST_META_OE = "\
openjpeg \
oprofile \
pegtl \
+ pg-cron \
pv \
sdbus-c++ \
tomlplusplus \
diff --git a/meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb b/meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb
index 9f9a59b398..20b16bda44 100644
--- a/meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb
+++ b/meta-oe/recipes-dbs/pg-cron/pg-cron_1.6.8.bb
@@ -10,4 +10,6 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b70f68d78dbcc36c5654d795cee59b0d"
SRC_URI = "git://github.com/citusdata/pg_cron.git;protocol=https;branch=main;tag=v${PV}"
SRCREV = "2323864075a50f234235f98e567eb958f923b2b3"
-inherit pgxs
+inherit ptest-pgxs
+
+PTEST_PGXS_CONF = "cron.database_name = 'contrib_regression'"
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-12-02 1:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 20:16 [meta-oe][PATCH 0/3] ptest for PGXS extensions Babanpreet Singh
2026-12-01 20:16 ` [meta-oe][PATCH 1/3] postgresql: package pg_regress in postgresql-regress Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
2026-12-01 20:16 ` [meta-oe][PATCH 2/3] ptest-pgxs.bbclass: add class for PGXS extension tests Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
2026-12-02 1:26 ` [meta-oe][PATCH " Babanpreet Singh
2026-12-01 20:17 ` [meta-oe][PATCH 3/3] pg-cron: add ptest support Babanpreet Singh
2026-12-02 0:53 ` [PATCH " Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox