Skip psql's TAP test for query cancellation entirely on Windows
This changes 020_cancel.pl so as the test is entirely skipped on Windows. This test was already doing nothing under WIN32, except initializing and starting a node without using it so this shaves a few test cycles. Author: Yugo NAGATA Reviewed-by: Fabien Coelho Discussion: https://postgr.es/m/20230810125935.22c2922ea5250ba79358965b@sraoss.co.jp Backpatch-through: 15
This commit is contained in:
parent
e434e21e11
commit
c53e288dba
@ -9,21 +9,22 @@ use PostgreSQL::Test::Utils;
|
|||||||
use Test::More;
|
use Test::More;
|
||||||
use Time::HiRes qw(usleep);
|
use Time::HiRes qw(usleep);
|
||||||
|
|
||||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
|
||||||
|
|
||||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
|
||||||
$node->init;
|
|
||||||
$node->start;
|
|
||||||
|
|
||||||
# Test query canceling by sending SIGINT to a running psql
|
# Test query canceling by sending SIGINT to a running psql
|
||||||
#
|
#
|
||||||
# There is, as of this writing, no documented way to get the PID of
|
# There is, as of this writing, no documented way to get the PID of
|
||||||
# the process from IPC::Run. As a workaround, we have psql print its
|
# the process from IPC::Run. As a workaround, we have psql print its
|
||||||
# own PID (which is the parent of the shell launched by psql) to a
|
# own PID (which is the parent of the shell launched by psql) to a
|
||||||
# file.
|
# file.
|
||||||
SKIP:
|
if ($windows_os)
|
||||||
{
|
{
|
||||||
skip "cancel test requires a Unix shell", 2 if $windows_os;
|
plan skip_all => "cancel test requires a Unix shell";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||||
|
|
||||||
|
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||||
|
$node->init;
|
||||||
|
$node->start;
|
||||||
|
|
||||||
local %ENV = $node->_get_env();
|
local %ENV = $node->_get_env();
|
||||||
|
|
||||||
@ -49,9 +50,9 @@ SKIP:
|
|||||||
my $psql_pid;
|
my $psql_pid;
|
||||||
until (
|
until (
|
||||||
-s "$tempdir/psql.pid"
|
-s "$tempdir/psql.pid"
|
||||||
and ($psql_pid =
|
and
|
||||||
PostgreSQL::Test::Utils::slurp_file("$tempdir/psql.pid")) =~
|
($psql_pid = PostgreSQL::Test::Utils::slurp_file("$tempdir/psql.pid"))
|
||||||
/^\d+\n/s)
|
=~ /^\d+\n/s)
|
||||||
{
|
{
|
||||||
($count++ < 100 * $PostgreSQL::Test::Utils::timeout_default)
|
($count++ < 100 * $PostgreSQL::Test::Utils::timeout_default)
|
||||||
or die "pid file did not appear";
|
or die "pid file did not appear";
|
||||||
@ -75,6 +76,5 @@ SKIP:
|
|||||||
$stderr,
|
$stderr,
|
||||||
qr/canceling statement due to user request/,
|
qr/canceling statement due to user request/,
|
||||||
'query was canceled');
|
'query was canceled');
|
||||||
}
|
|
||||||
|
|
||||||
done_testing();
|
done_testing();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user