diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-06-27 19:00:59 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-06-27 19:00:59 +0300 |
commit | 187b8991f70fc3d2a13dc709edd408a8df0be055 (patch) | |
tree | 05bcba574b14a34d514353d845e14a912dd4d5e9 /src/test/perl/PostgreSQL/Test/BackgroundPsql.pm | |
parent | b8f953d8d7bff6ca5d7fc8cb0f37a9d3d7a7462b (diff) | |
download | postgresql-187b8991f70fc3d2a13dc709edd408a8df0be055.tar.gz postgresql-187b8991f70fc3d2a13dc709edd408a8df0be055.zip |
Backport BackgroundPsql perl test module
Backport the new BackgroundPsql modules and the constructor functions,
background_psql() and interactive_psql, to all supported
branches. That makes it easier to backpatch tests that use it.
BackgroundPsql was introduced in version 16. On version 16, this
commit backports just the new timeout argument from master (commit
334f512f45). On older branches, the whole facility. This includes the
change to `use warnings FATAL => 'all'`, which we haven't otherwise
backported, but it seems good to keep the file identical across
branches.
Discussion: https://www.postgresql.org/message-id/b7c64f20-ea01-4f15-9088-0cd6832af149@iki.fi
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/BackgroundPsql.pm')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/BackgroundPsql.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm index 764f0a53801..4091c311b8a 100644 --- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm +++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm @@ -1,5 +1,5 @@ -# Copyright (c) 2021-2023, PostgreSQL Global Development Group +# Copyright (c) 2021-2024, PostgreSQL Global Development Group =pod @@ -54,7 +54,7 @@ initiated by PostgreSQL::Test::Cluster. package PostgreSQL::Test::BackgroundPsql; use strict; -use warnings; +use warnings FATAL => 'all'; use Carp; use Config; @@ -68,7 +68,7 @@ use Test::More; =over -=item PostgreSQL::Test::BackgroundPsql->new(interactive, @params) +=item PostgreSQL::Test::BackgroundPsql->new(interactive, @psql_params, timeout) Builds a new object of class C<PostgreSQL::Test::BackgroundPsql> for either an interactive or background session and starts it. If C<interactive> is @@ -81,7 +81,7 @@ string. For C<interactive> sessions, IO::Pty is required. sub new { my $class = shift; - my ($interactive, $psql_params) = @_; + my ($interactive, $psql_params, $timeout) = @_; my $psql = { 'stdin' => '', 'stdout' => '', @@ -96,8 +96,10 @@ sub new "Forbidden caller of constructor: package: $package, file: $file:$line" unless $package->isa('PostgreSQL::Test::Cluster'); - $psql->{timeout} = - IPC::Run::timeout($PostgreSQL::Test::Utils::timeout_default); + $psql->{timeout} = IPC::Run::timeout( + defined($timeout) + ? $timeout + : $PostgreSQL::Test::Utils::timeout_default); if ($interactive) { |