Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41CD5F532EE for ; Tue, 24 Mar 2026 08:16:50 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15152.1774340201626736069 for ; Tue, 24 Mar 2026 01:16:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20251104 header.b=ZGfgG5Ox; spf=pass (domain: gmail.com, ip: 209.85.128.44, mailfrom: skandigraun@gmail.com) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-486fd5360d4so10715555e9.1 for ; Tue, 24 Mar 2026 01:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774340200; x=1774945000; darn=lists.openembedded.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=l97NTDE2+VhSbMUQc2Uo1X7qXC64uhKlUy3EWejRu7Y=; b=ZGfgG5OxxFzxR7ZFlLoYUXchpT3SQsXHN8qz4tFN+BLLXZJ3nAYzslhPO8BPcSka8R APbrsuNf2FUKeZf+yJqNJaBIVjfZ0Q6c01lEqUji+z7wIQF5AHvI+vKjd8Nq6q+WHiQ6 /NnIkeaql8WV5zPvNcVcXU8V6dCsFMj3AoO10xjX8W1+8m6EvdblCm22NLM037bugPDp 5awIpICQW9MG0pfpGJYmQQNnfRqJr9/cWVT4YOw6CL+f29qbQc4Rf59fl7VoI3UoFYMT RYmuOmJ083x22Kbv+oujYjqbrNw5nIQieQgU1KU2SexxbHFkxVR+3KV4ziUNFJ5719ke sOtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774340200; x=1774945000; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l97NTDE2+VhSbMUQc2Uo1X7qXC64uhKlUy3EWejRu7Y=; b=R7kNGCXkJCcoDUaeiMCJwTGl7Ars78FKFy7yZfgCCnwwuhD4itaDvhcr+55N5+/hFD IR8FCVP9WtjPQonU6GvaEHdpcrcBagk/3dmx1FqRkp7E/sZZrDP558dXPSLPU2zs6WbG F8q2Cvy3TGUVEeATo/DGx3ZVa8I18vNeS6PUtQBEGSkkxUoEgqXW5WNTt8w7udivLhXO dmB2r5V2y8diEBRAirO/OMeTZyQh5kD2ARGkfXvZF3D9ENHV35GjDJNT+H6gH5VJx3Xo exIUE2WTf/fkd5Vmk2nnkwnjta5dxcEpebnzbfxXDv51s6f5hwpcdGdF6z0Hbyt2wqo7 sH2Q== X-Forwarded-Encrypted: i=1; AJvYcCXC3Zd7ug/ccVl09J17QlEmKZIQTJk/DLyb3cWBDA9qCxFrnuvTN/kcxescd+6+2PPsk/320z+MowllsCRilcy7TyU=@lists.openembedded.org X-Gm-Message-State: AOJu0YwuVoCjaw871l/CKC/AHd68KJkDm5QCt9Edx5YACYmfN7A1IM+L 9YQF0cHOPX3gRFlmq2VrieEFq9uREcdUmkp20pYD3xpaW0etmmAqs7GK X-Gm-Gg: ATEYQzwnjXL4nIUOUzLZL+cJP2K/oBD/Mi/n1eMoT3lh03Q8AVkaEOYwqQBnQtPepHV WuB5ax3Oy3LlPcikMpHKqxR99D2WtYwjjYFRtUPHzu5Y6n4vJiBg4DJgvFVn672G83G6UoJCb/F EyapVDNdfETf9Kgox7KCcuGQXFQZ5kQpnD3os22fWtKUGkMWaL/uroyXkQAPRQMXHe85ePBOjg3 wh9h202VmRqJDSeby7JB0OUrI9FmYhp1VKKCqnyWqaUwKU9XQMPZdWC8N/lkLv0+E4xoUDArt6K zpQc2/nNr6hqAmgyFOCufP1HCJhOK01VoiHKJ6mtKEhmusVua1+EakpQ75o70d9JLy0fCdFpR0K Z0eD1Xxo7bWAx3RxS2DpMXwtH5cqaeXnfsMJ3zxOJ9NDJZ++RKPPxVUjeGr7NYNgXvF01qnQ4KJ KiFUHnGjc4BvfhFxfdpTyDrSOWtd/jhfo= X-Received: by 2002:a05:600c:c167:b0:483:9139:4c1d with SMTP id 5b1f17b1804b1-486fedd4143mr204544595e9.14.1774340199432; Tue, 24 Mar 2026 01:16:39 -0700 (PDT) Received: from [192.168.1.106] ([51.154.145.205]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b644ae37dsm36785691f8f.2.2026.03.24.01.16.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2026 01:16:38 -0700 (PDT) Message-ID: <1a786966-d0f3-48de-80b4-08eeb25dec58@gmail.com> Date: Tue, 24 Mar 2026 09:16:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [oe][meta-oe][PATCH] postgresql: add ptest support To: guocai.he.cn@windriver.com, openembedded-devel@lists.openembedded.org References: <20260324071621.3104812-1-guocai.he.cn@windriver.com> <8b2343c3-f3de-442a-8e9a-548afdfa5c1c@windriver.com> Content-Language: en-US From: Gyorgy Sarvari In-Reply-To: <8b2343c3-f3de-442a-8e9a-548afdfa5c1c@windriver.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 24 Mar 2026 08:16:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/125546 On 3/24/26 09:05, guocai he via lists.openembedded.org wrote: > > On 3/24/26 15:36, Gyorgy Sarvari wrote: >> 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. >> >> On 3/24/26 08:16, guocai he via lists.openembedded.org wrote: >>> From: Guocai He >>> >>> 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 >>> ...... >>> ...... >> >> 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. > 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. >> >> >>> 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 >>> >>> Signed-off-by: Guocai He >>> --- >>> .../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 >>> >>> diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc >>> index 4de602ac1c..0e395db48a 100644 >>> --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc >>> +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc >>> @@ -76,6 +76,7 @@ PTESTS_SLOW_META_OE = "\ >>> fftw \ >>> libusb-compat \ >>> mariadb \ >>> + postgresql \ >>> re2 \ >>> rocksdb \ >>> " >>> diff --git a/meta-oe/recipes-dbs/postgresql/files/run-ptest b/meta-oe/recipes-dbs/postgresql/files/run-ptest >>> new file mode 100644 >>> index 0000000000..004cf2ba87 >>> --- /dev/null >>> +++ b/meta-oe/recipes-dbs/postgresql/files/run-ptest >>> @@ -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} >>> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc >>> index 040b3d5e34..dfc624f07e 100644 >>> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc >>> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc >>> @@ -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} >>> + 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) >> >> >>> +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: openembedded-devel+owner@lists.openembedded.org >>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com] >>> -=-=-=-=-=-=-=-=-=-=-=- >>>