Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4c17c5a

Browse files
committed
Tighten up Windows CRLF conversion in our TAP test scripts.
Back-patch commits91bdf49 andffb4cee, so that all branchesagree on when and how to do Windows CRLF conversion.This should close the referenced thread. Thanks to Andrew Dunstanfor discussion/review.Discussion:https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net
1 parent765ad26 commit4c17c5a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

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

Lines 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//gif$Config{osname}eq'msys';
110+
$stdout =~s/\r\n/\n/gif$Config{osname}eq'msys';
111111
is($stdout,$expected_stdout,"$test_name: query result matches");
112112
}
113113
}

‎src/test/perl/PostgresNode.pm

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@ sub safe_psql
11331133
print"\n#### End standard error\n";
11341134
}
11351135

1136-
$stdout =~s/\r//gif$TestLib::windows_os;
11371136
return$stdout;
11381137
}
11391138

@@ -1309,16 +1308,20 @@ sub psql
13091308
}
13101309
};
13111310

1311+
# Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
1312+
# if we're using native Perl, but not if we're using MSys Perl. So do it
1313+
# by hand in the latter case, here and elsewhere.
1314+
13121315
if (defined$$stdout)
13131316
{
1317+
$$stdout =~s/\r\n/\n/gif$Config{osname}eq'msys';
13141318
chomp$$stdout;
1315-
$$stdout =~s/\r//gif$TestLib::windows_os;
13161319
}
13171320

13181321
if (defined$$stderr)
13191322
{
1323+
$$stderr =~s/\r\n/\n/gif$Config{osname}eq'msys';
13201324
chomp$$stderr;
1321-
$$stderr =~s/\r//gif$TestLib::windows_os;
13221325
}
13231326

13241327
# See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
@@ -1381,8 +1384,8 @@ sub poll_query_until
13811384
{
13821385
my$result = IPC::Run::run$cmd,'>', \$stdout,'2>', \$stderr;
13831386

1387+
$stdout =~s/\r\n/\n/gif$Config{osname}eq'msys';
13841388
chomp($stdout);
1385-
$stdout =~s/\r//gif$TestLib::windows_os;
13861389

13871390
if ($stdouteq$expected)
13881391
{
@@ -1397,8 +1400,8 @@ sub poll_query_until
13971400

13981401
# The query result didn't change in 180 seconds. Give up. Print the
13991402
# output from the last attempt, hopefully that's useful for debugging.
1403+
$stderr =~s/\r\n/\n/gif$Config{osname}eq'msys';
14001404
chomp($stderr);
1401-
$stderr =~s/\r//gif$TestLib::windows_os;
14021405
diagqq(poll_query_until timed out executing this query:
14031406
$query
14041407
expecting this output:
@@ -1796,8 +1799,8 @@ sub pg_recvlogical_upto
17961799
}
17971800
};
17981801

1799-
$stdout =~s/\r//gif$TestLib::windows_os;
1800-
$stderr =~s/\r//gif$TestLib::windows_os;
1802+
$stdout =~s/\r\n/\n/gif$Config{osname}eq'msys';
1803+
$stderr =~s/\r\n/\n/gif$Config{osname}eq'msys';
18011804

18021805
if (wantarray)
18031806
{

‎src/test/perl/TestLib.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ sub slurp_file
240240
ordie"could not read\"$filename\":$!";
241241
my$contents = <$in>;
242242
close$in;
243-
$contents =~s/\r//gif$Config{osname}eq'msys';
243+
$contents =~s/\r\n/\n/gif$Config{osname}eq'msys';
244244
return$contents;
245245
}
246246

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp