Should "REGRESS_OPTS = --temp-config" be working for 3rd party extensions? - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Should "REGRESS_OPTS = --temp-config" be working for 3rd party extensions?
Date
Msg-id CAJ7c6TN5b9guT7pieBtQGiF36esBiduw=Q-8BoxLJtjg_D+XkA@mail.gmail.com
Whole thread Raw
Responses Re: Should "REGRESS_OPTS = --temp-config" be working for 3rd party extensions?
List pgsql-hackers
Hi,

I tried to use `REGRESS_OPTS = --temp-config` in order to test a 3rd
party extension with a custom .conf file similarly to how PostgreSQL
does it for src/test/modules/test_slru. It didn't work and "38.18.
Extension Building Infrastructure" [1] doesn't seem to be much help.

Here is my Makefile:

```
EXTENSION = experiment
MODULES = experiment
DATA = experiment--1.0.sql experiment.conf
REGRESS_OPTS = --temp-config
$(top_srcdir)/../../../share/postgresql/extension/experiment.conf
REGRESS = experiment

PG_CPPFLAGS = -g -O0
SHLIB_LINK =

ifndef PG_CONFIG
    PG_CONFIG := pg_config
endif
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
```

And the result I get:

```
$ make clean && make install && make installcheck
...

# note: experiment.conf is copied according to DATA value:

/bin/sh /Users/eax/pginstall/lib/postgresql/pgxs/src/makefiles/../../config/install-sh
-c -m 644 .//experiment--1.0.sql .//experiment.conf
'/Users/eax/pginstall/share/postgresql/extension/'

# note: --temp-conf path is correct

echo "# +++ regress install-check in  +++" &&
/Users/eax/pginstall/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress
--inputdir=./ --bindir='/Users/eax/pginstall/bin'    --temp-config
/Users/eax/pginstall/lib/postgresql/pgxs/src/makefiles/../../../../../share/postgresql/extension/experiment.conf
--dbname=contrib_regression experiment
# +++ regress install-check in  +++
# using postmaster on Unix socket, default port
not ok 1     - experiment                                382 ms

# note: shared_preload_libraries had no effect and I got elog() from
the extension:

$ cat /Users/eax/projects/c/postgresql-extensions/007-gucs/regression.diffs
...
+FATAL:  Please use shared_preload_libraries
```

This comment in Makefile for test_slru seems to explain why this happens:

```
# Disabled because these tests require "shared_preload_libraries=test_slru",
# which typical installcheck users do not have (e.g. buildfarm clients).
NO_INSTALLCHECK = 1
```

The complete example is available on GitHub [2].

Is it accurate to say that the author of a 3rd party extension that
uses shared_preload_libraries can't be using SQL tests and has to use
TAP tests instead? If not then what did I miss?

[1]: https://www.postgresql.org/docs/current/extend-pgxs.html
[2]: https://github.com/afiskon/postgresql-extensions/tree/temp_config_experiment/007-gucs

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: [PATCH] Slight improvement of worker_spi.c example
Next
From: Alexander Lakhin
Date:
Subject: Re: Avoid unused value (src/fe_utils/print.c)