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

Commit4506d18

Browse files
committed
Use diff's --strip-trailing-cr flag where appropriate on Windows
Test result files might be checked out using Unix or Windows style lineendings, depening on git flags, so on Windows we use the--strip-trailing-cr flag to tell diff to ignore line endingsdifferences.The flag is added to the diff invocation for the test_json_parser moduletests and the pg_bsd_indent tests. in pg_regress.c we replace thecurrent use of the "-w" flag, which ignore all white space differences,with this one which only ignores line end differences.Discussion:https://postgr.es/m/20240707052030.r77hbdkid3mwksop@awork3.anarazel.de
1 parent0248762 commit4506d18

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

‎src/test/modules/test_json_parser/t/003_test_semantic.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929

3030
close($fh);
3131

32-
($stdout,$stderr) = run_command(["diff","-u",$fname,$test_out ]);
32+
my@diffopts = ("-u");
33+
push(@diffopts,"--strip-trailing-cr")if$windows_os;
34+
($stdout,$stderr) = run_command(["diff",@diffopts,$fname,$test_out ]);
3335

3436
is($stdout,"","no output diff");
3537
is($stderr,"","no diff error");

‎src/test/regress/pg_regress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ static char *shellprog = SHELLPROG;
6565
constchar*basic_diff_opts="";
6666
constchar*pretty_diff_opts="-U3";
6767
#else
68-
constchar*basic_diff_opts="-w";
69-
constchar*pretty_diff_opts="-w -U3";
68+
constchar*basic_diff_opts="--strip-trailing-cr";
69+
constchar*pretty_diff_opts="--strip-trailing-cr -U3";
7070
#endif
7171

7272
/*

‎src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
# Any diffs in the generated files will be accumulated here.
2727
my$diffs_file ="test.diffs";
2828

29+
# options used with diff
30+
my@diffopts = ("-upd");
31+
push(@diffopts,"--strip-trailing-cr")if$windows_os;
32+
2933
# Copy support files to current dir, so *.pro files don't need to know path.
3034
while (my$file =glob("$src_dir/tests/*.list"))
3135
{
@@ -45,7 +49,7 @@
4549
],
4650
"pg_bsd_indent succeeds on$test");
4751
# check result matches, adding any diff to $diffs_file
48-
my$result = run_log(['diff','-upd',"$test_src.stdout","$test.out" ],
52+
my$result = run_log(['diff',@diffopts,"$test_src.stdout","$test.out" ],
4953
'>>',$diffs_file);
5054
ok($result,"pg_bsd_indent output matches for$test");
5155
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp