Commit 8b5cd373 authored by Andrew Dunstan's avatar Andrew Dunstan

Remove most msys special processing in TAP tests

Following migration of Windows buildfarm members running TAP tests to
use of ucrt64 perl for those tests, special processing for msys perl is
no longer necessary and so is removed.

Backpatch to release 10

Discussion: https://postgr.es/m/c65a8781-77ac-ea95-d185-6db291e1baeb@dunslane.net
parent 652ff988
...@@ -46,16 +46,7 @@ my $ctlcmd = [ ...@@ -46,16 +46,7 @@ my $ctlcmd = [
'pg_ctl', 'start', '-D', "$tempdir/data", '-l', 'pg_ctl', 'start', '-D', "$tempdir/data", '-l',
"$TestLib::log_path/001_start_stop_server.log" "$TestLib::log_path/001_start_stop_server.log"
]; ];
if ($Config{osname} ne 'msys') command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
{
command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
}
else
{
# use the version of command_like that doesn't hang on Msys here
command_like_safe($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
}
# sleep here is because Windows builds can't check postmaster.pid exactly, # sleep here is because Windows builds can't check postmaster.pid exactly,
# so they may mistake a pre-existing postmaster.pid for one created by the # so they may mistake a pre-existing postmaster.pid for one created by the
......
...@@ -115,7 +115,6 @@ sub check_query ...@@ -115,7 +115,6 @@ sub check_query
} }
else else
{ {
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
is($stdout, $expected_stdout, "$test_name: query result matches"); is($stdout, $expected_stdout, "$test_name: query result matches");
} }
return; return;
......
...@@ -846,9 +846,7 @@ sub kill9 ...@@ -846,9 +846,7 @@ sub kill9
local %ENV = $self->_get_env(); local %ENV = $self->_get_env();
print "### Killing node \"$name\" using signal 9\n"; print "### Killing node \"$name\" using signal 9\n";
# kill(9, ...) fails under msys Perl 5.8.8, so fall back on pg_ctl. kill(9, $self->{_pid});
kill(9, $self->{_pid})
or TestLib::system_or_bail('pg_ctl', 'kill', 'KILL', $self->{_pid});
$self->{_pid} = undef; $self->{_pid} = undef;
return; return;
} }
...@@ -1772,19 +1770,13 @@ sub psql ...@@ -1772,19 +1770,13 @@ sub psql
} }
}; };
# Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
# if we're using native Perl, but not if we're using MSys Perl. So do it
# by hand in the latter case, here and elsewhere.
if (defined $$stdout) if (defined $$stdout)
{ {
$$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stdout; chomp $$stdout;
} }
if (defined $$stderr) if (defined $$stderr)
{ {
$$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stderr; chomp $$stderr;
} }
...@@ -2261,9 +2253,7 @@ sub poll_query_until ...@@ -2261,9 +2253,7 @@ sub poll_query_until
my $result = IPC::Run::run $cmd, '<', \$query, my $result = IPC::Run::run $cmd, '<', \$query,
'>', \$stdout, '2>', \$stderr; '>', \$stdout, '2>', \$stderr;
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stdout); chomp($stdout);
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stderr); chomp($stderr);
if ($stdout eq $expected && $stderr eq '') if ($stdout eq $expected && $stderr eq '')
...@@ -2717,9 +2707,6 @@ sub pg_recvlogical_upto ...@@ -2717,9 +2707,6 @@ sub pg_recvlogical_upto
} }
}; };
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
if (wantarray) if (wantarray)
{ {
return ($ret, $stdout, $stderr, $timeout); return ($ret, $stdout, $stderr, $timeout);
......
...@@ -382,7 +382,6 @@ sub run_command ...@@ -382,7 +382,6 @@ sub run_command
my ($cmd) = @_; my ($cmd) = @_;
my ($stdout, $stderr); my ($stdout, $stderr);
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr; my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
chomp($stdout); chomp($stdout);
chomp($stderr); chomp($stderr);
return ($stdout, $stderr); return ($stdout, $stderr);
...@@ -467,7 +466,6 @@ sub slurp_file ...@@ -467,7 +466,6 @@ sub slurp_file
$contents = <$fh>; $contents = <$fh>;
close $fh; close $fh;
$contents =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
return $contents; return $contents;
} }
...@@ -825,7 +823,6 @@ sub command_like ...@@ -825,7 +823,6 @@ sub command_like
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr; my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
ok($result, "$test_name: exit code 0"); ok($result, "$test_name: exit code 0");
is($stderr, '', "$test_name: no stderr"); is($stderr, '', "$test_name: no stderr");
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
like($stdout, $expected_stdout, "$test_name: matches"); like($stdout, $expected_stdout, "$test_name: matches");
return; return;
} }
...@@ -878,7 +875,6 @@ sub command_fails_like ...@@ -878,7 +875,6 @@ sub command_fails_like
print("# Running: " . join(" ", @{$cmd}) . "\n"); print("# Running: " . join(" ", @{$cmd}) . "\n");
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr; my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
ok(!$result, "$test_name: exit code not 0"); ok(!$result, "$test_name: exit code not 0");
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
like($stderr, $expected_stderr, "$test_name: matches"); like($stderr, $expected_stderr, "$test_name: matches");
return; return;
} }
...@@ -923,8 +919,6 @@ sub command_checks_all ...@@ -923,8 +919,6 @@ sub command_checks_all
if $ret & 127; if $ret & 127;
$ret = $ret >> 8; $ret = $ret >> 8;
foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
# check status # check status
ok($ret == $expected_ret, ok($ret == $expected_ret,
"$test_name status (got $ret vs expected $expected_ret)"); "$test_name status (got $ret vs expected $expected_ret)");
......
...@@ -187,9 +187,6 @@ sub send_query_and_wait ...@@ -187,9 +187,6 @@ sub send_query_and_wait
$$psql{run}->pump_nb(); $$psql{run}->pump_nb();
while (1) while (1)
{ {
# See PostgresNode.pm's psql()
$$psql{stdout} =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
last if $$psql{stdout} =~ /$untl/; last if $$psql{stdout} =~ /$untl/;
if ($psql_timeout->is_expired) if ($psql_timeout->is_expired)
......
...@@ -7,11 +7,4 @@ use warnings; ...@@ -7,11 +7,4 @@ use warnings;
die "wrong number of arguments" if @ARGV != 2; die "wrong number of arguments" if @ARGV != 2;
my ($source, $target) = @ARGV; my ($source, $target) = @ARGV;
exit if $source !~ /history/; exit if $source !~ /history/;
if ($^O eq 'msys')
{
# make a windows path look like an msys path if necessary
$source =~ s!^([A-Za-z]):!'/' . lc($1)!e;
$source =~ s!\\!/!g;
}
copy($source, $target) or die "couldn't copy $source to $target: $!"; copy($source, $target) or die "couldn't copy $source to $target: $!";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment