| From: | Peter Dyballa <Peter_Dyballa(at)T-Online(dot)DE> |
|---|---|
| To: | Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net> |
| Cc: | pgsql-de-allgemein(at)lists(dot)postgresql(dot)org, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
| Subject: | Re: Testen von PostgreSQL 16 in MacPorts |
| Date: | 2026-11-21 12:13:10 |
| Message-ID: | F64726EB-FB65-4C4C-A365-1698A39DFFA3@T-Online.DE |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-de-allgemein |
> Am 20.11.2026 um 15:33 schrieb Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net>:
>
> Aber wie Laurenz schon schreibt, sind solche Relocatable Verrenkungen eher speziell und zum Testen nicht nötig: Ein Build mit beliebiger PREFIX, make install dorthin und make installcheck funktioniert unter macOS wunderbar.
Das tut's hier nicht, jedenfalls nicht mit MacPorts, weil diese ein Managementsystem für binäre Softwarepakete sind.
Wenn die Quellen fertig und erfolgreich kompiliert sind, wird, bezogen auf $(top_srcdir) in ../destroot zwischen-installiert und dann gegebenenfalls, wenn explizit gewünscht, dort getestet, hernach wird das Paket gebaut und aus dem verstauten Paket heraus wird die Software installiert. Mit dem install_name_tool zu arbeiten schafft nur neue Arbeit, denn vor der Installation müssten die Änderungen für die Tests rückgängig gemacht werden (was alles automatisierbar ist, denn es gibt für jede Phase Prä und Post-Subphasen oder -Schritte).
Was allem Anschein nach gut klappt ist z. B. dieser (eigentlich unnötig komplizierte) Aufruf aus dem src/test/regress-Verzeichnis heraus:
env DYLD_LIBRARY_PATH=../../../../destroot/opt/local/lib/postgresql16 ../../../../destroot/opt/local/lib/postgresql16/bin/psql --help
psql is the PostgreSQL interactive terminal.
Usage:
psql [OPTION]... [DBNAME [USERNAME]]
General options:
-c, --command=COMMAND run only single command (SQL or internal) and exit
-d, --dbname=DBNAME database name to connect to (default: "root")
-f, --file=FILENAME execute commands from file, then exit
-l, --list list available databases, then exit
-v, --set=, --variable=NAME=VALUE
set psql variable NAME to VALUE
(e.g., -v ON_ERROR_STOP=1)
-V, --version output version information, then exit
-X, --no-psqlrc do not read startup file (~/.psqlrc)
-1 ("one"), --single-transaction
execute as a single transaction (if non-interactive)
-?, --help[=options] show this help, then exit
etc.
oder:
env DYLD_LIBRARY_PATH=../../../../destroot/opt/local/lib/postgresql16 ../../../src/test/regress/pg_regress --help
PostgreSQL regression test driver
Usage:
pg_regress [OPTION]... [EXTRA-TEST]...
Options:
--bindir=BINPATH use BINPATH for programs that are run;
if empty, use PATH from the environment
--config-auth=DATADIR update authentication settings for DATADIR
--create-role=ROLE create the specified role before testing
--dbname=DB use database DB (default "regression")
--debug turn on debug mode in programs that are run
--dlpath=DIR look for dynamic libraries in DIR
--encoding=ENCODING use ENCODING as the encoding
--expecteddir=DIR take expected files from DIR (default ".")
-h, --help show this help, then exit
etc.
Es ließe sich also eine stimmige Ablaufumgebung mit Variablen aus den GNUmakefiles (und src/Makefile.global) bzw. MacPorts basteln. Ich kann sogar einen solchen Testbeginn für 'make check' bewirken (Leerzeile extra eingefügt):
gnumake[2]: Nothing to be done for `all'.
echo "# +++ regress check in src/test/regress +++" && PATH="/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/tmp_install/opt/local/lib/postgresql16/bin:/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress:$PATH" DYLD_LIBRARY_PATH="/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/tmp_install/opt/local/lib/postgresql16" env DYLD_LIBRARY_PATH=/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16 ../../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=. --bindir= --dlpath=.:/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16 --bindir=/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin --max-concurrent-tests=20 --schedule=./parallel_schedule
# +++ regress check in src/test/regress +++
# could not set core size: disallowed by hard limit
sh: line 1: 8765 Abort trap: 6 "/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin/initdb" -D "/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress/tmp_check/data" --no-clean --no-sync > "/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress/log/initdb.log" 2>&1
# initdb failed
# Examine "/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress/log/initdb.log" for the reason.
# Command was: "/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin/initdb" -D "/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress/tmp_check/data" --no-clean --no-sync > "/opt/local/var/macports/build/postgresql16-bc3af295/work/postgresql-16.15/src/test/regress/log/initdb.log" 2>&1
Bail out!gnumake[1]: *** [check] Error 2
gnumake: *** [check] Error 2
'make installcheck' bringt:
gnumake[2]: Nothing to be done for `all'.
echo "# +++ regress install-check in src/test/regress +++" && env DYLD_LIBRARY_PATH=/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16 ../../../src/test/regress/pg_regress --inputdir=. --bindir='/opt/local/lib/postgresql16/bin' --dlpath=.:/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16 --bindir=/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin --max-concurrent-tests=20 --schedule=./parallel_schedule --max-connections=1
# +++ regress install-check in src/test/regress +++
# using postmaster on Unix socket, default port
# could not set core size: disallowed by hard limit
dyld[18836]: Library not loaded: /opt/local/lib/postgresql16/libpq.5.dylib
Referenced from: <C557870D-7BA5-349A-99B8-81383EAD098A> /opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin/psql
Reason: tried: '/opt/local/lib/postgresql16/libpq.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/postgresql16/libpq.5.dylib' (no such file), '/opt/local/lib/postgresql16/libpq.5.dylib' (no such file)
# command failed: "/opt/local/var/macports/build/postgresql16-bc3af295/work/destroot/opt/local/lib/postgresql16/bin/psql" -X -q -c "SET client_min_messages = warning" -c "DROP DATABASE IF EXISTS \"regression\"" "postgres"
Bail out!gnumake[1]: *** [installcheck] Error 2
gnumake: *** [installcheck] Error 2
Wie schon von Tobias beschrieben, die korrekt bestimmten neuen initdb oder psql erhalten keine Kenntnis davon, wo ihr Zubehör liegt. Durch Eingriffe ins src/test/regress/GNUmakefile und src/Makefile.global kamen die Ergebnisse zustande, und zwar per Tcl-Funktion reinplace in MacPorts' Portfile:
reinplace "s,\$(top_builddir)/src/test/regress/pg_regress,env DYLD_LIBRARY_PATH=${destroot}${prefix}/lib/postgresql16 \$(top_builddir)/src/test/regress/pg_regress," ${worksrcpath}/src/Makefile.global
reinplace "s,--dlpath=.,--dlpath=.:${destroot}${prefix}/lib/postgresql16 --bindir=${destroot}${prefix}/lib/postgresql16/bin," ${worksrcpath}/src/test/regress/GNUmakefile
Reinplace gibt seine Argumente an sed weiter, so dass die Ausdrücke noch Potenzial für Optimierung haben (Wiederverwendung). Die Änderungen werden vorgenommen, wenn die neue Software in destroot zwischengelagert wird.
Das Einrichten einer funktionierenden Ablaufumgebung für src/test/regress/pg_regress wird also nicht weitervererbt! Und vermutlich spielt der dlpath bei UNIX keine Rolle, weil rein entsprechendes Resultat. Da hilft wohl nur noch ein Eingriff in den code … Es könnte der dlpath (wohl für MS Windows?) durch den DYLD_LIBRARY_PATH (mit "." wg. einiger dylibs in src/test/regress) ersetzt werden, oder wenn pg_regress einen neuen Prozess startet, wird dem der DYLD_LIBRARY_PATH eingeschrieben.
Was mich noch brennend interessiert: Welches Shell-Skript wird bei 'make check' ausgeführt, das sich im Fehlerfall mit "sh: line 1:" meldet?
Übrigens gibt es keinerlei Probleme mit dem Beglaubigen zum Ausführen (quasi eigener oder eher) selbst kompilierter Quellen. Denn es ist nicht nötig: Es ist nichts Fremdes, das aus dem gefährlichen Internet kam, shrink-wrapped oder prêt-à-exécuter.
--
Mit friedvollen Grüßen
Pete
The light at the end of the tunnel has been turned off due to budget cuts.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Dyballa | 2026-11-21 13:25:34 | Re: Testen von PostgreSQL 16 in MacPorts |
| Previous Message | Peter Dyballa | 2026-11-20 14:37:11 | Re: Testen von PostgreSQL 16 in MacPorts |