postgresql: add ptest support
PATCH 1/1 postgresql: add ptest support
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (pg_regress) on the target system.
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ...... All 224 tests passed. waiting for server to shut down.... done server stopped DURATION: 853 END: /usr/lib64/postgresql/ptest 2026-03-24T02:56 STOP: ptest-runner TOTAL: 1 FAIL: 0
--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1 -0
@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "
meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53 -0
53 lines not on this page · raw message
meta-oe/recipes-dbs/postgresql/postgresql.inc +41 -1
60 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 5 lines · guocai he via lists.openembedded.org
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (
pg_regress) on the target system.
Quoted 7 lines
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ......
I'd like to ask just one confirmation question about this "....." here
Is the output machine parseable, i.e. do the results have PASS:/FAIL:
prefix, at least as a final summary?
The run-ptest script doesn't seem to do such conversion, so I'm just curious if the output is usable out of the box.
Quoted 140 lines
All 224 tests passed.
waiting for server to shut down.... done
server stopped
DURATION: 853
END:/usr/lib64/postgresql/ptest
2026-03-24T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0Signed-off-by Guocai He <[email protected]>--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptestmeta-oe/conf/include/ptest-packagelists-meta-oe.inc +1
-0@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53
-0@@ -0,0 +1,53 @@ +#!/bin/sh +# +# PostgreSQL regression test runner for ptest +# +# This script initializes a temporary PostgreSQL database cluster, +# starts a server instance, and executes the standard regression test +# suite via pg_regress against the installed PostgreSQL binaries. +# + +set -e + +PGDATA=/tmp/ptest_pgdata +PTEST_PATH=$(dirname "$(readlink -f "$0")") +TESTDIR="${PTEST_PATH}/test" +PGBIN=$(pg_config --bindir) +PKGLIBDIR=$(pg_config --pkglibdir) + +cleanup() { + su - postgres -c "pg_ctl -D ${PGDATA} stop -m immediate" 2>/dev/null || true + rm -rf "${PGDATA}" +} +trap cleanup EXIT + +# Initialize the database cluster +rm -rf "${PGDATA}" +su - postgres -c "${PGBIN}/initdb -D ${PGDATA} --no-locale" || exit 1 + +# Start the server +su - postgres -c "pg_ctl -D ${PGDATA} -l ${PGDATA}/logfile start -w -t 120" || exit 1 + +# Ensure the test directory is writable by the postgres user for +# regression output files (regression.out, regression.diffs, results/). +chown -R postgres:postgres "${TESTDIR}" + +# Prepare the tablespace test directory +mkdir -p "${TESTDIR}/testtablespace" +chmod 0700 "${TESTDIR}/testtablespace" +chown postgres:postgres "${TESTDIR}/testtablespace" + +# Run the regression tests. +# --dlpath points to the standard PostgreSQL package library directory +# where regress.so and contrib modules (autoinc.so, refint.so, etc.) +# are installed, so that CREATE FUNCTION ... AS tests can locate them. +su - postgres -c "cd ${TESTDIR} && \ + ${TESTDIR}/pg_regress \ + --inputdir=. \ + --bindir=${PGBIN} \ + --dlpath=${PKGLIBDIR} \ + --max-concurrent-tests=20 \ + --schedule=parallel_schedule" +RESULT=$? + +exit ${RESULT}meta-oe/recipes-dbs/postgresql/postgresql.inc +29
-1@@ -29,6 +29,7 @@ SRC_URI = "https://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ file://postgresql.pam \ file://postgresql-setup \ file://postgresql.service \ + file://run-ptest \ " LEAD_SONAME = "libpq.so"@@ -37,7 +38,7 @@ LEAD_SONAME = "libpq.so" export LDFLAGS_SL = "${LDFLAGS}" export LDFLAGS_EX_BE = "-Wl,--export-dynamic" -inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header +inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header ptest CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"@@ -184,6 +185,45 @@ do_compile:append() { done } +do_compile_ptest() { + oe_runmake -C src/test/regress all +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/test + + # Install pg_regress binary + install -m 0755 ${B}/src/test/regress/pg_regress ${D}${PTEST_PATH}/test/ + + # Install test schedules and resultmap + for f in parallel_schedule serial_schedule resultmap; do + [ -f ${S}/src/test/regress/$f ] && install -m 0644 ${S}/src/test/regress/$f ${D}${PTEST_PATH}/test/ + done + + # Install SQL, expected, input, output, and data files + for d in sql expected input output data; do + if [ -d ${S}/src/test/regress/$d ]; then + cp -r ${S}/src/test/regress/$d ${D}${PTEST_PATH}/test/ + fi + done + + # Install the regress test shared library into the standard PostgreSQL + # package library directory (PKGLIBDIR) alongside contrib modules such + # as autoinc.so and refint.so. This allows pg_regress --dlpath to + # resolve all required shared libraries from a single location. + install -d ${D}${libdir}/${BPN}
meta-oe/recipes-dbs/postgresql/postgresql.inc do_compile:append() { · line 224
Quoted 10 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +10
-0+ install -m 0755 ${B}/src/test/regress/regress.so ${D}${libdir}/${BPN}/ + + # Install run-ptest + install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/ + + # Set ownership to postgres user for running tests + chown -R postgres:postgres ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "${PN} ${PN}-client ${PN}-contrib perl"
${PN} is part of this RDEPENDS implicitly, no need to add it separately (granted, it also does no harm by being here)
Quoted 16 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +2
-1+FILES:${PN}-ptest += "${libdir}/${BPN}/regress.so" + # server needs to configure user and group usernum = "28" groupnum = "28" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#125542): https://lists.openembedded.org/g/openembedded-devel/message/125542
Mute This Topic: https://lists.openembedded.org/mt/118479820/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 17 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · guocai he via lists.openembedded.org
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (
pg_regress) on the target system.Quoted 7 lines
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ......
Quoted 6 lines
I'd like to ask just one confirmation question about this "....." here
Is the output machine parseable, i.e. do the results have PASS:/FAIL:
prefix, at least as a final summary?
The run-ptest script doesn't seem to do such conversion, so I'm just curious if the output is usable out of the box.
logs like:
waiting for server to start..... done
server started
# using postmaster on Unix socket, default port ok 1 - test_setup 11275 ms # parallel group (20 tests): int2 name text char varchar int4 oid txid pg_lsn regproc money boolean int8 uuid floa t4 float8 bit enum rangetypes numeric ok 2 + boolean 4823 ms ok 3 + char 3601 ms ok 4 + name 3347 ms ok 5 + varchar 3695 ms ok 6 + text 3364 ms ok 7 + int2 2609 ms ok 8 + int4 3636 ms ok 9 + int8 5066 ms ok 10 + oid 3590 ms
ok 216 + compression 9827 ms ok 217 + memoize 9233 ms ok 218 + stats 23898 ms ok 219 + predicate 3535 ms
# parallel group (2 tests): oidjoins event_trigger ok 220 + oidjoins 7394 ms ok 221 + event_trigger 9363 ms ok 222 - event_trigger_login 2059 ms ok 223 - fast_default 8790 ms ok 224 - tablespace 19201 ms 1..224 # All 224 tests passed. waiting for server to shut down.... done server stopped DURATION: 890 END: /usr/lib64/postgresql/ptest
Quoted 173 lines
Quoted 142 lines
All 224 tests passed.
waiting for server to shut down.... done
server stopped
DURATION: 853
END:/usr/lib64/postgresql/ptest
2026-03-24T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0Signed-off-by Guocai He <[email protected]>--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-)create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1
-0@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53
-0@@ -0,0 +1,53 @@ +#!/bin/sh +# +# PostgreSQL regression test runner for ptest +# +# This script initializes a temporary PostgreSQL database cluster, +# starts a server instance, and executes the standard regression test +# suite via pg_regress against the installed PostgreSQL binaries. +# + +set -e + +PGDATA=/tmp/ptest_pgdata +PTEST_PATH=$(dirname "$(readlink -f "$0")") +TESTDIR="${PTEST_PATH}/test" +PGBIN=$(pg_config --bindir) +PKGLIBDIR=$(pg_config --pkglibdir) + +cleanup() { + su - postgres -c "pg_ctl -D ${PGDATA} stop -m immediate" 2>/dev/null || true + rm -rf "${PGDATA}" +} +trap cleanup EXIT + +# Initialize the database cluster +rm -rf "${PGDATA}" +su - postgres -c "${PGBIN}/initdb -D ${PGDATA} --no-locale" || exit 1 + +# Start the server +su - postgres -c "pg_ctl -D ${PGDATA} -l ${PGDATA}/logfile start -w -t 120" || exit 1 + +# Ensure the test directory is writable by the postgres user for +# regression output files (regression.out, regression.diffs, results/). +chown -R postgres:postgres "${TESTDIR}" + +# Prepare the tablespace test directory +mkdir -p "${TESTDIR}/testtablespace" +chmod 0700 "${TESTDIR}/testtablespace" +chown postgres:postgres "${TESTDIR}/testtablespace" + +# Run the regression tests. +# --dlpath points to the standard PostgreSQL package library directory +# where regress.so and contrib modules (autoinc.so, refint.so, etc.) +# are installed, so that CREATE FUNCTION ... AS tests can locate them. +su - postgres -c "cd ${TESTDIR} && \ + ${TESTDIR}/pg_regress \ + --inputdir=. \ + --bindir=${PGBIN} \ + --dlpath=${PKGLIBDIR} \ + --max-concurrent-tests=20 \ + --schedule=parallel_schedule" +RESULT=$? + +exit ${RESULT}meta-oe/recipes-dbs/postgresql/postgresql.inc +29
-1@@ -29,6 +29,7 @@ SRC_URI = "https://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ file://postgresql.pam \ file://postgresql-setup \ file://postgresql.service \ + file://run-ptest \ " LEAD_SONAME = "libpq.so"@@ -37,7 +38,7 @@ LEAD_SONAME = "libpq.so" export LDFLAGS_SL = "${LDFLAGS}" export LDFLAGS_EX_BE = "-Wl,--export-dynamic" -inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header +inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header ptest CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"@@ -184,6 +185,45 @@ do_compile:append() { done } +do_compile_ptest() { + oe_runmake -C src/test/regress all +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/test + + # Install pg_regress binary + install -m 0755 ${B}/src/test/regress/pg_regress ${D}${PTEST_PATH}/test/ + + # Install test schedules and resultmap + for f in parallel_schedule serial_schedule resultmap; do + [ -f ${S}/src/test/regress/$f ] && install -m 0644 ${S}/src/test/regress/$f ${D}${PTEST_PATH}/test/ + done + + # Install SQL, expected, input, output, and data files + for d in sql expected input output data; do + if [ -d ${S}/src/test/regress/$d ]; then + cp -r ${S}/src/test/regress/$d ${D}${PTEST_PATH}/test/ + fi + done + + # Install the regress test shared library into the standard PostgreSQL + # package library directory (PKGLIBDIR) alongside contrib modules such + # as autoinc.so and refint.so. This allows pg_regress --dlpath to + # resolve all required shared libraries from a single location. + install -d ${D}${libdir}/${BPN}meta-oe/recipes-dbs/postgresql/postgresql.inc do_compile:append() { · line 224
Quoted 10 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +10
-0+ install -m 0755 ${B}/src/test/regress/regress.so ${D}${libdir}/${BPN}/ + + # Install run-ptest + install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/ + + # Set ownership to postgres user for running tests + chown -R postgres:postgres ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "${PN} ${PN}-client ${PN}-contrib perl"${PN} is part of this RDEPENDS implicitly, no need to add it separately (granted, it also does no harm by being here)
Quoted 16 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +2
-1+FILES:${PN}-ptest += "${libdir}/${BPN}/regress.so" + # server needs to configure user and group usernum = "28" groupnum = "28" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#125542): https://lists.openembedded.org/g/openembedded-devel/message/125542
Mute This Topic: https://lists.openembedded.org/mt/118479820/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Thanks Guocai
Quoted 17 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · guocai he via lists.openembedded.org
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (
pg_regress) on the target system.Quoted 7 lines
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ......
Quoted 6 lines
I'd like to ask just one confirmation question about this "....." here
Is the output machine parseable, i.e. do the results have PASS:/FAIL:
prefix, at least as a final summary?
The run-ptest script doesn't seem to do such conversion, so I'm just curious if the output is usable out of the box.
if one case fail, the logs like:
.......
not ok 78 + triggers 38360 ms
......
# 1 of 224 tests failed.
Quoted 173 lines
Quoted 142 lines
All 224 tests passed.
waiting for server to shut down.... done
server stopped
DURATION: 853
END:/usr/lib64/postgresql/ptest
2026-03-24T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0Signed-off-by Guocai He <[email protected]>--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-)create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1
-0@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53
-0@@ -0,0 +1,53 @@ +#!/bin/sh +# +# PostgreSQL regression test runner for ptest +# +# This script initializes a temporary PostgreSQL database cluster, +# starts a server instance, and executes the standard regression test +# suite via pg_regress against the installed PostgreSQL binaries. +# + +set -e + +PGDATA=/tmp/ptest_pgdata +PTEST_PATH=$(dirname "$(readlink -f "$0")") +TESTDIR="${PTEST_PATH}/test" +PGBIN=$(pg_config --bindir) +PKGLIBDIR=$(pg_config --pkglibdir) + +cleanup() { + su - postgres -c "pg_ctl -D ${PGDATA} stop -m immediate" 2>/dev/null || true + rm -rf "${PGDATA}" +} +trap cleanup EXIT + +# Initialize the database cluster +rm -rf "${PGDATA}" +su - postgres -c "${PGBIN}/initdb -D ${PGDATA} --no-locale" || exit 1 + +# Start the server +su - postgres -c "pg_ctl -D ${PGDATA} -l ${PGDATA}/logfile start -w -t 120" || exit 1 + +# Ensure the test directory is writable by the postgres user for +# regression output files (regression.out, regression.diffs, results/). +chown -R postgres:postgres "${TESTDIR}" + +# Prepare the tablespace test directory +mkdir -p "${TESTDIR}/testtablespace" +chmod 0700 "${TESTDIR}/testtablespace" +chown postgres:postgres "${TESTDIR}/testtablespace" + +# Run the regression tests. +# --dlpath points to the standard PostgreSQL package library directory +# where regress.so and contrib modules (autoinc.so, refint.so, etc.) +# are installed, so that CREATE FUNCTION ... AS tests can locate them. +su - postgres -c "cd ${TESTDIR} && \ + ${TESTDIR}/pg_regress \ + --inputdir=. \ + --bindir=${PGBIN} \ + --dlpath=${PKGLIBDIR} \ + --max-concurrent-tests=20 \ + --schedule=parallel_schedule" +RESULT=$? + +exit ${RESULT}meta-oe/recipes-dbs/postgresql/postgresql.inc +29
-1@@ -29,6 +29,7 @@ SRC_URI = "https://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ file://postgresql.pam \ file://postgresql-setup \ file://postgresql.service \ + file://run-ptest \ " LEAD_SONAME = "libpq.so"@@ -37,7 +38,7 @@ LEAD_SONAME = "libpq.so" export LDFLAGS_SL = "${LDFLAGS}" export LDFLAGS_EX_BE = "-Wl,--export-dynamic" -inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header +inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header ptest CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"@@ -184,6 +185,45 @@ do_compile:append() { done } +do_compile_ptest() { + oe_runmake -C src/test/regress all +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/test + + # Install pg_regress binary + install -m 0755 ${B}/src/test/regress/pg_regress ${D}${PTEST_PATH}/test/ + + # Install test schedules and resultmap + for f in parallel_schedule serial_schedule resultmap; do + [ -f ${S}/src/test/regress/$f ] && install -m 0644 ${S}/src/test/regress/$f ${D}${PTEST_PATH}/test/ + done + + # Install SQL, expected, input, output, and data files + for d in sql expected input output data; do + if [ -d ${S}/src/test/regress/$d ]; then + cp -r ${S}/src/test/regress/$d ${D}${PTEST_PATH}/test/ + fi + done + + # Install the regress test shared library into the standard PostgreSQL + # package library directory (PKGLIBDIR) alongside contrib modules such + # as autoinc.so and refint.so. This allows pg_regress --dlpath to + # resolve all required shared libraries from a single location. + install -d ${D}${libdir}/${BPN}meta-oe/recipes-dbs/postgresql/postgresql.inc do_compile:append() { · line 224
Quoted 10 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +10
-0+ install -m 0755 ${B}/src/test/regress/regress.so ${D}${libdir}/${BPN}/ + + # Install run-ptest + install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/ + + # Set ownership to postgres user for running tests + chown -R postgres:postgres ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "${PN} ${PN}-client ${PN}-contrib perl"${PN} is part of this RDEPENDS implicitly, no need to add it separately (granted, it also does no harm by being here)
Quoted 16 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +2
-1+FILES:${PN}-ptest += "${libdir}/${BPN}/regress.so" + # server needs to configure user and group usernum = "28" groupnum = "28" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#125542): https://lists.openembedded.org/g/openembedded-devel/message/125542
Mute This Topic: https://lists.openembedded.org/mt/118479820/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Thanks Guocai
Quoted 28 lines · guocai he via lists.openembedded.org
Quoted 17 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · guocai he via lists.openembedded.org
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (
pg_regress) on the target system.Quoted 7 lines
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ......Quoted 6 lines
I'd like to ask just one confirmation question about this "....." here
Is the output machine parseable, i.e. do the results have PASS:/FAIL:
prefix, at least as a final summary?
The run-ptest script doesn't seem to do such conversion, so I'm just curious if the output is usable out of the box.if one case fail, the logs like:
Quoted 8 lines
.......
not ok 78 + triggers 38360 ms
......
# 1 of 224 tests failed.
Thanks. The problem with this is that it will always show up as a failure on the autobuilder, because it can't parse any results - the logparser looks explicitly for PASS: and FAIL: patterns at the start of the output to detect passing/failing tests.
Most frequently this is done by sed commands in the run-ptest script, converting the test output to something ptest-compatible. But at the least, could you please add a summary to the end of the run-ptest script, something like
if [ "${RESULT}" == "0" ]; then
echo PASS: all tests passed
else
echo FAIL: some tests failed
fi
This would allow automatic evaluation of the results.
Quoted 177 lines
Quoted 177 lines
Quoted 142 lines
All 224 tests passed.
waiting for server to shut down.... done
server stopped
DURATION: 853
END:/usr/lib64/postgresql/ptest
2026-03-24T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0Signed-off-by Guocai He <[email protected]>--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-)create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1
-0@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53
-0@@ -0,0 +1,53 @@ +#!/bin/sh +# +# PostgreSQL regression test runner for ptest +# +# This script initializes a temporary PostgreSQL database cluster, +# starts a server instance, and executes the standard regression test +# suite via pg_regress against the installed PostgreSQL binaries. +# + +set -e + +PGDATA=/tmp/ptest_pgdata +PTEST_PATH=$(dirname "$(readlink -f "$0")") +TESTDIR="${PTEST_PATH}/test" +PGBIN=$(pg_config --bindir) +PKGLIBDIR=$(pg_config --pkglibdir) + +cleanup() { + su - postgres -c "pg_ctl -D ${PGDATA} stop -m immediate" 2>/dev/null || true + rm -rf "${PGDATA}" +} +trap cleanup EXIT + +# Initialize the database cluster +rm -rf "${PGDATA}" +su - postgres -c "${PGBIN}/initdb -D ${PGDATA} --no-locale" || exit 1 + +# Start the server +su - postgres -c "pg_ctl -D ${PGDATA} -l ${PGDATA}/logfile start -w -t 120" || exit 1 + +# Ensure the test directory is writable by the postgres user for +# regression output files (regression.out, regression.diffs, results/). +chown -R postgres:postgres "${TESTDIR}" + +# Prepare the tablespace test directory +mkdir -p "${TESTDIR}/testtablespace" +chmod 0700 "${TESTDIR}/testtablespace" +chown postgres:postgres "${TESTDIR}/testtablespace" + +# Run the regression tests. +# --dlpath points to the standard PostgreSQL package library directory +# where regress.so and contrib modules (autoinc.so, refint.so, etc.) +# are installed, so that CREATE FUNCTION ... AS tests can locate them. +su - postgres -c "cd ${TESTDIR} && \ + ${TESTDIR}/pg_regress \ + --inputdir=. \ + --bindir=${PGBIN} \ + --dlpath=${PKGLIBDIR} \ + --max-concurrent-tests=20 \ + --schedule=parallel_schedule" +RESULT=$? + +exit ${RESULT}meta-oe/recipes-dbs/postgresql/postgresql.inc +29
-1@@ -29,6 +29,7 @@ SRC_URI = "https://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ file://postgresql.pam \ file://postgresql-setup \ file://postgresql.service \ + file://run-ptest \ " LEAD_SONAME = "libpq.so"@@ -37,7 +38,7 @@ LEAD_SONAME = "libpq.so" export LDFLAGS_SL = "${LDFLAGS}" export LDFLAGS_EX_BE = "-Wl,--export-dynamic" -inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header +inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header ptest CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"@@ -184,6 +185,45 @@ do_compile:append() { done } +do_compile_ptest() { + oe_runmake -C src/test/regress all +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/test + + # Install pg_regress binary + install -m 0755 ${B}/src/test/regress/pg_regress ${D}${PTEST_PATH}/test/ + + # Install test schedules and resultmap + for f in parallel_schedule serial_schedule resultmap; do + [ -f ${S}/src/test/regress/$f ] && install -m 0644 ${S}/src/test/regress/$f ${D}${PTEST_PATH}/test/ + done + + # Install SQL, expected, input, output, and data files + for d in sql expected input output data; do + if [ -d ${S}/src/test/regress/$d ]; then + cp -r ${S}/src/test/regress/$d ${D}${PTEST_PATH}/test/ + fi + done + + # Install the regress test shared library into the standard PostgreSQL + # package library directory (PKGLIBDIR) alongside contrib modules such + # as autoinc.so and refint.so. This allows pg_regress --dlpath to + # resolve all required shared libraries from a single location. + install -d ${D}${libdir}/${BPN}meta-oe/recipes-dbs/postgresql/postgresql.inc do_compile:append() { · line 224
Quoted 10 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +10
-0+ install -m 0755 ${B}/src/test/regress/regress.so ${D}${libdir}/${BPN}/ + + # Install run-ptest + install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/ + + # Set ownership to postgres user for running tests + chown -R postgres:postgres ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "${PN} ${PN}-client ${PN}-contrib perl"${PN} is part of this RDEPENDS implicitly, no need to add it separately (granted, it also does no harm by being here)
Quoted 20 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +2
-1+FILES:${PN}-ptest += "${libdir}/${BPN}/regress.so" + # server needs to configure user and group usernum = "28" groupnum = "28" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#125545): https://lists.openembedded.org/g/openembedded-devel/message/125545
Mute This Topic: https://lists.openembedded.org/mt/118479820/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 47 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 25 lines · guocai he via lists.openembedded.org
Quoted 16 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · guocai he via lists.openembedded.org
From: Guocai He <[email protected]>
Add ptest infrastructure to run the PostgreSQL standard regression test suite (
pg_regress) on the target system.Quoted 7 lines
Test logs:
root@qemux86-64:~# ptest-runner postgresql START: ptest-runner 2026-03-24T02:42 BEGIN: /usr/lib64/postgresql/ptest ...... ......Quoted 6 lines
I'd like to ask just one confirmation question about this "....." here
Is the output machine parseable, i.e. do the results have PASS:/FAIL:
prefix, at least as a final summary?
The run-ptest script doesn't seem to do such conversion, so I'm just curious if the output is usable out of the box.if one case fail, the logs like:
Quoted 8 lines
.......
not ok 78 + triggers 38360 ms
......
# 1 of 224 tests failed.
Thanks. The problem with this is that it will always show up as a failure on the autobuilder, because it can't parse any results - the logparser looks explicitly for PASS: and FAIL: patterns at the start of the output to detect passing/failing tests.
Most frequently this is done by sed commands in the run-ptest script, converting the test output to something ptest-compatible. But at the least, could you please add a summary to the end of the run-ptest script, something like
Quoted 7 lines
if [ "${RESULT}" == "0" ]; then
echo PASS: all tests passed
else
echo FAIL: some tests failed
fiThis would allow automatic evaluation of the results.
Thanks.
I will send V2 after updated.
Quoted 176 lines
Quoted 176 lines
Quoted 176 lines
Quoted 142 lines
All 224 tests passed.
waiting for server to shut down.... done
server stopped
DURATION: 853
END:/usr/lib64/postgresql/ptest
2026-03-24T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0Signed-off-by Guocai He <[email protected]>--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-dbs/postgresql/files/run-ptest | 53 +++++++++++++++++++ meta-oe/recipes-dbs/postgresql/postgresql.inc | 42 ++++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-)create mode 100644 meta-oe/recipes-dbs/postgresql/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1
-0@@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ fftw \ libusb-compat \ mariadb \ + postgresql \ re2 \ rocksdb \ "meta-oe/recipes-dbs/postgresql/files/run-ptest new file +53
-0@@ -0,0 +1,53 @@ +#!/bin/sh +# +# PostgreSQL regression test runner for ptest +# +# This script initializes a temporary PostgreSQL database cluster, +# starts a server instance, and executes the standard regression test +# suite via pg_regress against the installed PostgreSQL binaries. +# + +set -e + +PGDATA=/tmp/ptest_pgdata +PTEST_PATH=$(dirname "$(readlink -f "$0")") +TESTDIR="${PTEST_PATH}/test" +PGBIN=$(pg_config --bindir) +PKGLIBDIR=$(pg_config --pkglibdir) + +cleanup() { + su - postgres -c "pg_ctl -D ${PGDATA} stop -m immediate" 2>/dev/null || true + rm -rf "${PGDATA}" +} +trap cleanup EXIT + +# Initialize the database cluster +rm -rf "${PGDATA}" +su - postgres -c "${PGBIN}/initdb -D ${PGDATA} --no-locale" || exit 1 + +# Start the server +su - postgres -c "pg_ctl -D ${PGDATA} -l ${PGDATA}/logfile start -w -t 120" || exit 1 + +# Ensure the test directory is writable by the postgres user for +# regression output files (regression.out, regression.diffs, results/). +chown -R postgres:postgres "${TESTDIR}" + +# Prepare the tablespace test directory +mkdir -p "${TESTDIR}/testtablespace" +chmod 0700 "${TESTDIR}/testtablespace" +chown postgres:postgres "${TESTDIR}/testtablespace" + +# Run the regression tests. +# --dlpath points to the standard PostgreSQL package library directory +# where regress.so and contrib modules (autoinc.so, refint.so, etc.) +# are installed, so that CREATE FUNCTION ... AS tests can locate them. +su - postgres -c "cd ${TESTDIR} && \ + ${TESTDIR}/pg_regress \ + --inputdir=. \ + --bindir=${PGBIN} \ + --dlpath=${PKGLIBDIR} \ + --max-concurrent-tests=20 \ + --schedule=parallel_schedule" +RESULT=$? + +exit ${RESULT}meta-oe/recipes-dbs/postgresql/postgresql.inc +29
-1@@ -29,6 +29,7 @@ SRC_URI = "https://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ file://postgresql.pam \ file://postgresql-setup \ file://postgresql.service \ + file://run-ptest \ " LEAD_SONAME = "libpq.so"@@ -37,7 +38,7 @@ LEAD_SONAME = "libpq.so" export LDFLAGS_SL = "${LDFLAGS}" export LDFLAGS_EX_BE = "-Wl,--export-dynamic" -inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header +inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header ptest CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"@@ -184,6 +185,45 @@ do_compile:append() { done } +do_compile_ptest() { + oe_runmake -C src/test/regress all +} + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/test + + # Install pg_regress binary + install -m 0755 ${B}/src/test/regress/pg_regress ${D}${PTEST_PATH}/test/ + + # Install test schedules and resultmap + for f in parallel_schedule serial_schedule resultmap; do + [ -f ${S}/src/test/regress/$f ] && install -m 0644 ${S}/src/test/regress/$f ${D}${PTEST_PATH}/test/ + done + + # Install SQL, expected, input, output, and data files + for d in sql expected input output data; do + if [ -d ${S}/src/test/regress/$d ]; then + cp -r ${S}/src/test/regress/$d ${D}${PTEST_PATH}/test/ + fi + done + + # Install the regress test shared library into the standard PostgreSQL + # package library directory (PKGLIBDIR) alongside contrib modules such + # as autoinc.so and refint.so. This allows pg_regress --dlpath to + # resolve all required shared libraries from a single location. + install -d ${D}${libdir}/${BPN}meta-oe/recipes-dbs/postgresql/postgresql.inc do_compile:append() { · line 224
Quoted 10 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +10
-0+ install -m 0755 ${B}/src/test/regress/regress.so ${D}${libdir}/${BPN}/ + + # Install run-ptest + install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/ + + # Set ownership to postgres user for running tests + chown -R postgres:postgres ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "${PN} ${PN}-client ${PN}-contrib perl"${PN} is part of this RDEPENDS implicitly, no need to add it separately (granted, it also does no harm by being here)
Quoted 20 lines
meta-oe/recipes-dbs/postgresql/postgresql.inc +2
-1+FILES:${PN}-ptest += "${libdir}/${BPN}/regress.so" + # server needs to configure user and group usernum = "28" groupnum = "28" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#125545): https://lists.openembedded.org/g/openembedded-devel/message/125545
Mute This Topic: https://lists.openembedded.org/mt/118479820/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Thanks Guocai