From 130f0286765d6eb5fcd931f98f5c2b690381ca20 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Tue, 16 Dec 2025 15:07:14 +0300
Subject: [PATCH] Skip Kerberos tests on Windows platforms

Kerberos/GSSAPI tests are not supported on Windows, so add explicit
checks to skip these tests on Windows in both
005_negotiate_encryption.pl and 001_auth.pl test scripts.
---
 src/interfaces/libpq/t/005_negotiate_encryption.pl | 7 +++++--
 src/test/kerberos/t/001_auth.pl                    | 6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/interfaces/libpq/t/005_negotiate_encryption.pl b/src/interfaces/libpq/t/005_negotiate_encryption.pl
index ac6d8bcb4a6..5891e95e75f 100644
--- a/src/interfaces/libpq/t/005_negotiate_encryption.pl
+++ b/src/interfaces/libpq/t/005_negotiate_encryption.pl
@@ -84,10 +84,13 @@ if (!$ENV{PG_TEST_EXTRA} || $ENV{PG_TEST_EXTRA} !~ /\blibpq_encryption\b/)
 }
 
 # Only run the GSSAPI tests when compiled with GSSAPI support and
-# PG_TEST_EXTRA includes 'kerberos'
+# PG_TEST_EXTRA includes 'kerberos'. 'kerberos' tests are not supported on
+# Windows, so skip them.
 my $gss_supported = $ENV{with_gssapi} eq 'yes';
 my $kerberos_enabled =
-  $ENV{PG_TEST_EXTRA} && $ENV{PG_TEST_EXTRA} =~ /\bkerberos\b/;
+	!$windows_os
+  && $ENV{PG_TEST_EXTRA}
+  && $ENV{PG_TEST_EXTRA} =~ /\bkerberos\b/;
 my $ssl_supported = $ENV{with_ssl} eq 'openssl';
 
 ###
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index b0be96f2beb..9eea03f28cc 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -29,6 +29,12 @@ if ($ENV{with_gssapi} ne 'yes')
 {
 	plan skip_all => 'GSSAPI/Kerberos not supported by this build';
 }
+elsif ($ENV{PG_TEST_EXTRA}
+	&& $ENV{PG_TEST_EXTRA} =~ /\bkerberos\b/
+	&& $windows_os)
+{
+	plan skip_all => 'GSSAPI/Kerberos tests are not supported on Windows';
+}
 elsif (!$ENV{PG_TEST_EXTRA} || $ENV{PG_TEST_EXTRA} !~ /\bkerberos\b/)
 {
 	plan skip_all =>
-- 
2.51.0

