From 3ccaafa454140436b50e2ab2f414bf5094f745db Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 14 Feb 2022 11:05:14 +0100 Subject: [PATCH 1/2] Make Windows detection in TAP tests consistent Use the exported variable $windows_os from the test harness to ensure that Windows detection is done consistently across the tests. --- src/bin/pg_rewind/t/RewindTest.pm | 3 +-- src/test/recovery/t/006_logical_decoding.pl | 2 +- src/test/recovery/t/021_row_visibility.pl | 2 +- src/test/recovery/t/022_crash_temp_files.pl | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm index 60e3234788..9c33d12654 100644 --- a/src/bin/pg_rewind/t/RewindTest.pm +++ b/src/bin/pg_rewind/t/RewindTest.pm @@ -35,7 +35,6 @@ use strict; use warnings; use Carp; -use Config; use Exporter 'import'; use File::Copy; use File::Path qw(rmtree); @@ -115,7 +114,7 @@ sub check_query } else { - $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; + $stdout =~ s/\r\n/\n/g if $windows_os; is($stdout, $expected_stdout, "$test_name: query result matches"); } return; diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl index fa6bd45332..a4d51eb995 100644 --- a/src/test/recovery/t/006_logical_decoding.pl +++ b/src/test/recovery/t/006_logical_decoding.pl @@ -143,7 +143,7 @@ SKIP: { # some Windows Perls at least don't like IPC::Run's start/kill_kill regime. - skip "Test fails on Windows perl", 2 if $Config{osname} eq 'MSWin32'; + skip "Test fails on Windows perl", 2 if $windows_os; my $pg_recvlogical = IPC::Run::start( [ diff --git a/src/test/recovery/t/021_row_visibility.pl b/src/test/recovery/t/021_row_visibility.pl index e2743518de..e01f3f57c7 100644 --- a/src/test/recovery/t/021_row_visibility.pl +++ b/src/test/recovery/t/021_row_visibility.pl @@ -183,7 +183,7 @@ sub send_query_and_wait while (1) { # See PostgreSQL::Test::Cluster.pm's psql() - $$psql{stdout} =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; + $$psql{stdout} =~ s/\r\n/\n/g if $windows_os; last if $$psql{stdout} =~ /$untl/; diff --git a/src/test/recovery/t/022_crash_temp_files.pl b/src/test/recovery/t/022_crash_temp_files.pl index 6ab3092874..c37723a144 100644 --- a/src/test/recovery/t/022_crash_temp_files.pl +++ b/src/test/recovery/t/022_crash_temp_files.pl @@ -9,7 +9,7 @@ use PostgreSQL::Test::Utils; use Test::More; use Config; -if ($Config{osname} eq 'MSWin32') +if ($windows_os) { plan skip_all => 'tests hang on Windows'; exit; -- 2.24.3 (Apple Git-128)