aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL/Test/Cluster.pm
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-02-15 09:52:08 +0100
committerPeter Eisentraut <peter@eisentraut.org>2024-02-15 10:29:18 +0100
commit995d400ceca3e552f84fe19f150fb03327bdc0c2 (patch)
treeb6f6f325730be3374c7aad55f4ebb01244f17ba0 /src/test/perl/PostgreSQL/Test/Cluster.pm
parent9bc1eee988c31e66a27e007d41020664df490214 (diff)
downloadpostgresql-995d400ceca3e552f84fe19f150fb03327bdc0c2.tar.gz
postgresql-995d400ceca3e552f84fe19f150fb03327bdc0c2.zip
Allow passing extra options to initdb for tests
Setting the environment variable PG_TEST_INITDB_EXTRA_OPTS passes extra options to initdb run by pg_regress or PostgreSQL::Test::Cluster's init. 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. (Not all tests are going to pass with arbitrary options, but it is useful to run this against specific test suites.) Reviewed-by: Ian Lawrence Barwick <barwick@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/d4d2ad9f-1c1d-47a1-bb4d-c10a747d4f15%40eisentraut.org
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Cluster.pm')
-rw-r--r--src/test/perl/PostgreSQL/Test/Cluster.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index e2e70d0dbf9..07da74cf562 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -114,6 +114,7 @@ use Socket;
use Test::More;
use PostgreSQL::Test::Utils ();
use PostgreSQL::Test::BackgroundPsql ();
+use Text::ParseWords qw(shellwords);
use Time::HiRes qw(usleep);
use Scalar::Util qw(blessed);
@@ -519,6 +520,12 @@ sub init
$params{allows_streaming} = 0 unless defined $params{allows_streaming};
$params{has_archiving} = 0 unless defined $params{has_archiving};
+ my $initdb_extra_opts_env = $ENV{PG_TEST_INITDB_EXTRA_OPTS};
+ if (defined $initdb_extra_opts_env)
+ {
+ push @{ $params{extra} }, shellwords($initdb_extra_opts_env);
+ }
+
mkdir $self->backup_dir;
mkdir $self->archive_dir;