diff mbox series

[meta-oe] ptest-pgxs.bbclass: read the tests from a subdirectory

Message ID 20261203183457.7-1-bbnpreetsingh@gmail.com
State Under Review
Headers show
Series [meta-oe] ptest-pgxs.bbclass: read the tests from a subdirectory | expand

Commit Message

Babanpreet Singh Dec. 3, 2026, 6:34 p.m. UTC
Some extensions keep their regression tests in a subdirectory with its
own Makefile. PTEST_PGXS_DIR lets the recipe name that subdirectory.

Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
A pg-repack recipe that uses this will follow once this is merged.

 meta-oe/classes/ptest-pgxs.bbclass | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/classes/ptest-pgxs.bbclass b/meta-oe/classes/ptest-pgxs.bbclass
index 8e1eda3602..fd2832085a 100644
--- a/meta-oe/classes/ptest-pgxs.bbclass
+++ b/meta-oe/classes/ptest-pgxs.bbclass
@@ -17,6 +17,8 @@  inherit pgxs ptest
 
 PTEST_PGXS_CONF ?= ""
 PTEST_PGXS_CONF[doc] = "Extra postgresql.conf lines for the test server, separated by \\n."
+PTEST_PGXS_DIR ?= "."
+PTEST_PGXS_DIR[doc] = "Directory, relative to ${S}, whose Makefile lists the regression tests."
 
 do_install_ptest() {
 	cat > ${T}/ptest-pgxs.mk << 'EOF'
@@ -24,7 +26,7 @@  ptest-pgxs-vars:
 	@echo "REGRESS=$(REGRESS)"
 	@echo "REGRESS_OPTS=$(REGRESS_OPTS)"
 EOF
-	vars=$(oe_runmake -s -C ${B} -f Makefile -f ${T}/ptest-pgxs.mk ptest-pgxs-vars)
+	vars=$(oe_runmake -s -C ${B}/${PTEST_PGXS_DIR} -f Makefile -f ${T}/ptest-pgxs.mk ptest-pgxs-vars)
 	regress=$(echo "$vars" | sed -n 's/^REGRESS=//p')
 	conf=""
 	opts=""
@@ -47,17 +49,17 @@  EOF
 
 	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/
+		if [ -d ${S}/${PTEST_PGXS_DIR}/$inputdir/$d ]; then
+			cp -r ${S}/${PTEST_PGXS_DIR}/$inputdir/$d ${D}${PTEST_PATH}/tests/$inputdir/
 		fi
 	done
 	for s in $schedules; do
-		install -m 0644 ${S}/$s ${D}${PTEST_PATH}/tests/
+		install -m 0644 ${S}/${PTEST_PGXS_DIR}/$s ${D}${PTEST_PATH}/tests/
 	done
 
 	: > ${D}${PTEST_PATH}/tests/ptest.conf
-	if [ -n "$conf" ] && [ -f ${S}/$conf ]; then
-		cat ${S}/$conf >> ${D}${PTEST_PATH}/tests/ptest.conf
+	if [ -n "$conf" ] && [ -f ${S}/${PTEST_PGXS_DIR}/$conf ]; then
+		cat ${S}/${PTEST_PGXS_DIR}/$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