public inbox for [email protected]  
help / color / mirror / Atom feed
003_extrafiles.pl test fails on Windows with the newer Perl versions
7+ messages / 3 participants
[nested] [flat]

* 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 11:21  Nazir Bilal Yavuz <[email protected]>
  0 siblings, 2 replies; 7+ messages in thread

From: Nazir Bilal Yavuz @ 2024-01-30 11:21 UTC (permalink / raw)
  To: PostgreSQL Hackers <[email protected]>

Hi,

I was trying to install newer Perl versions to Windows CI images and
found that 003_extrafiles.pl test fails on Windows with:

(0.183s) not ok 2 - file lists match
(0.000s) #   Failed test 'file lists match'
#   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
(0.000s) #     Structures begin differing at:
#          $got->[0] =
'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir'
#     $expected->[0] =
'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir'

(0.263s) not ok 5 - file lists match
(0.000s) #   Failed test 'file lists match'
#   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
(0.000s) #     Structures begin differing at:
#          $got->[0] =
'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir'
#     $expected->[0] =
'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir'

It looks like File::Find converts backslashes to slashes in the newer
Perl versions. I tried to find the related commit and found this:
https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d

To solve this, I did the same conversion for Windows before comparing
the paths. And to support all Perl versions, I decided to always
convert them on Windows regardless of the Perl's version. The fix is
attached.

I looked at other File::Find appearances in the code but they do not
compare the paths. So, I do not think there is any need to fix them.

Any kind of feedback would be appreciated.

--
Regards,
Nazir Bilal Yavuz
Microsoft


Attachments:

  [application/x-patch] v1-0001-Fix-003_extrafiles.pl-test-for-the-Windows.patch (1.3K, ../../CAN55FZ2XW1B5NP11Vy-y9O2BmMnLFq8grCsHZr_AovcL4QCgdg@mail.gmail.com/2-v1-0001-Fix-003_extrafiles.pl-test-for-the-Windows.patch)
  download | inline diff:
From b28f48fe7d98d3dd7d2fcf652bfa5c8a4cd1c2d6 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <[email protected]>
Date: Tue, 30 Jan 2024 13:12:41 +0300
Subject: [PATCH v1] Fix 003_extrafiles.pl test for the Windows

File::Find converts backslashes to slashes in the newer Perl versions.
See: https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d

So, do the same conversion for Windows before comparing paths. To
support all Perl versions, always convert them on Windows regardless of
the Perl's version.
---
 src/bin/pg_rewind/t/003_extrafiles.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl
index d54dcddcbb6..7e4c2771ce7 100644
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -78,6 +78,19 @@ sub run_test
 		},
 		$test_primary_datadir);
 	@paths = sort @paths;
+
+	# File::Find converts backslashes to slashes in the newer Perl
+	# versions. To support all Perl versions, do the same conversion
+	# for Windows before comparing the paths.
+	if ($PostgreSQL::Test::Utils::windows_os)
+	{
+		for my $filename (@paths)
+		{
+			$filename =~ s{\\}{/}g;
+		}
+		$test_primary_datadir =~ s{\\}{/}g;
+	}
+
 	is_deeply(
 		\@paths,
 		[
-- 
2.43.0



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 11:46  Nazir Bilal Yavuz <[email protected]>
  parent: Nazir Bilal Yavuz <[email protected]>
  1 sibling, 0 replies; 7+ messages in thread

From: Nazir Bilal Yavuz @ 2024-01-30 11:46 UTC (permalink / raw)
  To: PostgreSQL Hackers <[email protected]>

Hi,

On Tue, 30 Jan 2024 at 14:21, Nazir Bilal Yavuz <[email protected]> wrote:
>
> It looks like File::Find converts backslashes to slashes in the newer
> Perl versions. I tried to find the related commit and found this:
> https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d

I forgot to mention that I used Strawberry Perl and these errors
started with 'Perl v5.36.1.1'.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 11:49  Andrew Dunstan <[email protected]>
  parent: Nazir Bilal Yavuz <[email protected]>
  1 sibling, 1 reply; 7+ messages in thread

From: Andrew Dunstan @ 2024-01-30 11:49 UTC (permalink / raw)
  To: Nazir Bilal Yavuz <[email protected]>; PostgreSQL Hackers <[email protected]>


On 2024-01-30 Tu 06:21, Nazir Bilal Yavuz wrote:
> Hi,
>
> I was trying to install newer Perl versions to Windows CI images and
> found that 003_extrafiles.pl test fails on Windows with:
>
> (0.183s) not ok 2 - file lists match
> (0.000s) #   Failed test 'file lists match'
> #   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
> (0.000s) #     Structures begin differing at:
> #          $got->[0] =
> 'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir'
> #     $expected->[0] =
> 'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir'
>
> (0.263s) not ok 5 - file lists match
> (0.000s) #   Failed test 'file lists match'
> #   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
> (0.000s) #     Structures begin differing at:
> #          $got->[0] =
> 'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir'
> #     $expected->[0] =
> 'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir'
>
> It looks like File::Find converts backslashes to slashes in the newer
> Perl versions. I tried to find the related commit and found this:
> https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d
>
> To solve this, I did the same conversion for Windows before comparing
> the paths. And to support all Perl versions, I decided to always
> convert them on Windows regardless of the Perl's version. The fix is
> attached.
>
> I looked at other File::Find appearances in the code but they do not
> compare the paths. So, I do not think there is any need to fix them.
>
> Any kind of feedback would be appreciated.
>

Looks reasonable on the face of it. I'll see about pushing this today.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 22:18  Andrew Dunstan <[email protected]>
  parent: Andrew Dunstan <[email protected]>
  0 siblings, 2 replies; 7+ messages in thread

From: Andrew Dunstan @ 2024-01-30 22:18 UTC (permalink / raw)
  To: Nazir Bilal Yavuz <[email protected]>; PostgreSQL Hackers <[email protected]>


On 2024-01-30 Tu 06:49, Andrew Dunstan wrote:
>
> On 2024-01-30 Tu 06:21, Nazir Bilal Yavuz wrote:
>> Hi,
>>
>> I was trying to install newer Perl versions to Windows CI images and
>> found that 003_extrafiles.pl test fails on Windows with:
>>
>> (0.183s) not ok 2 - file lists match
>> (0.000s) #   Failed test 'file lists match'
>> #   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
>> (0.000s) #     Structures begin differing at:
>> #          $got->[0] =
>> 'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir' 
>>
>> #     $expected->[0] =
>> 'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_local_data/pgdata/tst_both_dir' 
>>
>>
>> (0.263s) not ok 5 - file lists match
>> (0.000s) #   Failed test 'file lists match'
>> #   at C:/cirrus/src/bin/pg_rewind/t/003_extrafiles.pl line 81.
>> (0.000s) #     Structures begin differing at:
>> #          $got->[0] =
>> 'C:/cirrus/build/testrun/pg_rewind/003_extrafiles/data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir' 
>>
>> #     $expected->[0] =
>> 'C:\cirrus\build/testrun/pg_rewind/003_extrafiles\data/t_003_extrafiles_primary_remote_data/pgdata/tst_both_dir' 
>>
>>
>> It looks like File::Find converts backslashes to slashes in the newer
>> Perl versions. I tried to find the related commit and found this:
>> https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d 
>>
>>
>> To solve this, I did the same conversion for Windows before comparing
>> the paths. And to support all Perl versions, I decided to always
>> convert them on Windows regardless of the Perl's version. The fix is
>> attached.
>>
>> I looked at other File::Find appearances in the code but they do not
>> compare the paths. So, I do not think there is any need to fix them.
>>
>> Any kind of feedback would be appreciated.
>>
>
> Looks reasonable on the face of it. I'll see about pushing this today.


Pushed to all live branches. Thanks for the patch.


cheers


andrew

-- 

Andrew Dunstan
EDB: https://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 23:06  Tom Lane <[email protected]>
  parent: Andrew Dunstan <[email protected]>
  1 sibling, 1 reply; 7+ messages in thread

From: Tom Lane @ 2024-01-30 23:06 UTC (permalink / raw)
  To: Andrew Dunstan <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; PostgreSQL Hackers <[email protected]>

Andrew Dunstan <[email protected]> writes:
> Pushed to all live branches. Thanks for the patch.

v12 and v13 branches aren't looking good:

Global symbol "$test_primary_datadir" requires explicit package name (did you forget to declare "my $test_primary_datadir"?) at t/003_extrafiles.pl line 80.
Execution of t/003_extrafiles.pl aborted due to compilation errors.
# Looks like your test exited with 255 before it could output anything.
[17:19:57] t/003_extrafiles.pl .......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/5 subtests 

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-30 23:56  Andrew Dunstan <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Andrew Dunstan @ 2024-01-30 23:56 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; PostgreSQL Hackers <[email protected]>


On 2024-01-30 Tu 18:06, Tom Lane wrote:
> Andrew Dunstan <[email protected]> writes:
>> Pushed to all live branches. Thanks for the patch.
> v12 and v13 branches aren't looking good:
>
> Global symbol "$test_primary_datadir" requires explicit package name (did you forget to declare "my $test_primary_datadir"?) at t/003_extrafiles.pl line 80.
> Execution of t/003_extrafiles.pl aborted due to compilation errors.
> # Looks like your test exited with 255 before it could output anything.
> [17:19:57] t/003_extrafiles.pl ..........
> Dubious, test returned 255 (wstat 65280, 0xff00)
> Failed 5/5 subtests
>
> 	


Will fix.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: 003_extrafiles.pl test fails on Windows with the newer Perl versions
@ 2024-01-31 08:45  Nazir Bilal Yavuz <[email protected]>
  parent: Andrew Dunstan <[email protected]>
  1 sibling, 0 replies; 7+ messages in thread

From: Nazir Bilal Yavuz @ 2024-01-31 08:45 UTC (permalink / raw)
  To: Andrew Dunstan <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>

Hi,

On Wed, 31 Jan 2024 at 01:18, Andrew Dunstan <[email protected]> wrote:
>
> Pushed to all live branches. Thanks for the patch.

Thanks for the push!

-- 
Regards,
Nazir Bilal Yavuz
Microsoft





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2024-01-31 08:45 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 11:21 003_extrafiles.pl test fails on Windows with the newer Perl versions Nazir Bilal Yavuz <[email protected]>
2024-01-30 11:46 ` Nazir Bilal Yavuz <[email protected]>
2024-01-30 11:49 ` Andrew Dunstan <[email protected]>
2024-01-30 22:18   ` Andrew Dunstan <[email protected]>
2024-01-30 23:06     ` Tom Lane <[email protected]>
2024-01-30 23:56       ` Andrew Dunstan <[email protected]>
2024-01-31 08:45     ` Nazir Bilal Yavuz <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox