Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce9d053

Browse filesBrowse files
committed
Tighten up Windows CRLF conversion in our TAP test scripts.
Back-patch commits 91bdf49 and ffb4cee, so that all branches agree on when and how to do Windows CRLF conversion. This should close the referenced thread. Thanks to Andrew Dunstan for discussion/review. Discussion: https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net
1 parent 2d7738a commit ce9d053
Copy full SHA for ce9d053

File tree

Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed

‎src/bin/pg_rewind/t/RewindTest.pm

Copy file name to clipboardExpand all lines: src/bin/pg_rewind/t/RewindTest.pm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ sub check_query
107107
}
108108
else
109109
{
110-
$stdout =~ s/\r//g if $Config{osname} eq 'msys';
110+
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
111111
is($stdout, $expected_stdout, "$test_name: query result matches");
112112
}
113113
}

‎src/test/perl/PostgresNode.pm

Copy file name to clipboardExpand all lines: src/test/perl/PostgresNode.pm
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,6 @@ sub safe_psql
11221122
print "\n#### End standard error\n";
11231123
}
11241124

1125-
$stdout =~ s/\r//g if $TestLib::windows_os;
11261125
return $stdout;
11271126
}
11281127

@@ -1297,16 +1296,20 @@ sub psql
12971296
}
12981297
};
12991298

1299+
# Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
1300+
# if we're using native Perl, but not if we're using MSys Perl. So do it
1301+
# by hand in the latter case, here and elsewhere.
1302+
13001303
if (defined $$stdout)
13011304
{
1305+
$$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
13021306
chomp $$stdout;
1303-
$$stdout =~ s/\r//g if $TestLib::windows_os;
13041307
}
13051308

13061309
if (defined $$stderr)
13071310
{
1311+
$$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
13081312
chomp $$stderr;
1309-
$$stderr =~ s/\r//g if $TestLib::windows_os;
13101313
}
13111314

13121315
# See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
@@ -1364,8 +1367,8 @@ sub poll_query_until
13641367
[ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ];
13651368
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
13661369

1370+
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
13671371
chomp($stdout);
1368-
$stdout =~ s/\r//g if $TestLib::windows_os;
13691372
if ($stdout eq "t")
13701373
{
13711374
return 1;
@@ -1378,8 +1381,8 @@ sub poll_query_until
13781381

13791382
# The query result didn't change in 180 seconds. Give up. Print the
13801383
# output from the last attempt, hopefully that's useful for debugging.
1384+
$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
13811385
chomp($stderr);
1382-
$stderr =~ s/\r//g if $TestLib::windows_os;
13831386
diag qq(poll_query_until timed out executing this query:
13841387
$query
13851388
expecting this output:

‎src/test/perl/TestLib.pm

Copy file name to clipboardExpand all lines: src/test/perl/TestLib.pm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ sub slurp_file
216216
or die "could not read \"$filename\": $!";
217217
my $contents = <$in>;
218218
close $in;
219-
$contents =~ s/\r//g if $Config{osname} eq 'msys';
219+
$contents =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
220220
return $contents;
221221
}
222222

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.