Allow passing extra options to initdb for tests

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Allow passing extra options to initdb for tests
Date: 2024-02-06 10:54:39
Message-ID: d4d2ad9f-1c1d-47a1-bb4d-c10a747d4f15@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm proposing here a way to pass extra options to initdb when run
internally during test setup in pg_regress or
PostgreSQL::Test::Cluster's init (which covers just about all test
suites other than initdb's own tests).

For example:

make check PG_TEST_INITDB_EXTRA_OPTS='-k -c work_mem=50MB'

We currently document at [0] a way to pass custom server settings to the
tests via PGOPTIONS. But this only works for pg_regress and only for
options that can be changed at run time. My proposal can set initdb
options, and since initdb has the -c option now, it can set any GUC
parameter as well.

I think this can be useful for a wide variety of uses, like running all
tests with checksums enabled, or with JIT enabled, or with different GUC
settings, or with different locale settings. (The existing pg_regress
--no-locale option is essentially a special case of this, but it only
provides one particular locale setting, not things like changing the
default provider etc.)

Of course, not all tests are going to pass with arbitrary options, but
it is useful to run this against specific test suites.

This patch also updates the documentation at [0] to explain the new
method and distinguish it from the previously documented methods.

[0]:
https://www.postgresql.org/docs/devel/regress-run.html#REGRESS-RUN-CUSTOM-SETTINGS

Attachment Content-Type Size
v0-0001-Allow-passing-extra-options-to-initdb-for-tests.patch text/plain 5.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-02-06 11:21:02 Re: Synchronizing slots from primary to standby
Previous Message Alvaro Herrera 2024-02-06 10:53:12 Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock