From daa781b2e0e57108ac9425f02ca4eb7a5f3da2d2 Mon Sep 17 00:00:00 2001
From: Andrew Dunstan <andrew@dunslane.net>
Date: Sat, 22 Aug 2026 17:38:06 -0400
Subject: [PATCH 3/4] Make the platform guards in two regression tests match meson
 builds

collate.linux.utf8 skips itself unless version() matches "linux-gnu",
and infinite_recurse skips itself when version() matches
"powerpc64[^,]*-linux-gnu".  configure substitutes the GNU host triplet
into that string, but the meson build composes it from
host_machine.cpu_family() and host_system, which gives "aarch64-linux"
and never carries the ABI suffix.  So ever since meson support arrived
in 16, collate.linux.utf8 has not run at all on a meson build, and
infinite_recurse has been running on ppc64 Linux the very case it means
to stay away from.

Fix by matching "-linux[-,]" and "powerpc64[^,]*-linux", which match
both spellings.  Keeping the punctuation on either side confines the
match to the platform field.

Backpatch to 16, where the meson build was introduced.
---
 src/test/regress/expected/collate.linux.utf8.out   | 2 +-
 src/test/regress/expected/collate.linux.utf8_1.out | 2 +-
 src/test/regress/expected/infinite_recurse.out     | 2 +-
 src/test/regress/expected/infinite_recurse_1.out   | 2 +-
 src/test/regress/sql/collate.linux.utf8.sql        | 2 +-
 src/test/regress/sql/infinite_recurse.sql          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/test/regress/expected/collate.linux.utf8.out b/src/test/regress/expected/collate.linux.utf8.out
index e0a39e4c300..27b5e57f6db 100644
--- a/src/test/regress/expected/collate.linux.utf8.out
+++ b/src/test/regress/expected/collate.linux.utf8.out
@@ -5,7 +5,7 @@
  */
 SELECT getdatabaseencoding() <> 'UTF8' OR
        (SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR
-       version() !~ 'linux-gnu'
+       version() !~ '-linux[-,]'
        AS skip_test \gset
 \if :skip_test
 \quit
diff --git a/src/test/regress/expected/collate.linux.utf8_1.out b/src/test/regress/expected/collate.linux.utf8_1.out
index ede5fdb5dcc..01faaa9fd1d 100644
--- a/src/test/regress/expected/collate.linux.utf8_1.out
+++ b/src/test/regress/expected/collate.linux.utf8_1.out
@@ -5,7 +5,7 @@
  */
 SELECT getdatabaseencoding() <> 'UTF8' OR
        (SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR
-       version() !~ 'linux-gnu'
+       version() !~ '-linux[-,]'
        AS skip_test \gset
 \if :skip_test
 \quit
diff --git a/src/test/regress/expected/infinite_recurse.out b/src/test/regress/expected/infinite_recurse.out
index aa102fadd83..f86b433b13e 100644
--- a/src/test/regress/expected/infinite_recurse.out
+++ b/src/test/regress/expected/infinite_recurse.out
@@ -10,7 +10,7 @@ create function infinite_recurse() returns int as
 -- production kernels, so disable this test on such platforms.
 -- (We still create the function, so as not to have a cross-platform
 -- difference in the end state of the regression database.)
-SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
+SELECT version() ~ 'powerpc64[^,]*-linux'
        AS skip_test \gset
 \if :skip_test
 \quit
diff --git a/src/test/regress/expected/infinite_recurse_1.out b/src/test/regress/expected/infinite_recurse_1.out
index b2c99a0d0d4..296f24146f0 100644
--- a/src/test/regress/expected/infinite_recurse_1.out
+++ b/src/test/regress/expected/infinite_recurse_1.out
@@ -10,7 +10,7 @@ create function infinite_recurse() returns int as
 -- production kernels, so disable this test on such platforms.
 -- (We still create the function, so as not to have a cross-platform
 -- difference in the end state of the regression database.)
-SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
+SELECT version() ~ 'powerpc64[^,]*-linux'
        AS skip_test \gset
 \if :skip_test
 \quit
diff --git a/src/test/regress/sql/collate.linux.utf8.sql b/src/test/regress/sql/collate.linux.utf8.sql
index 6d726ee9c99..9e627db3abb 100644
--- a/src/test/regress/sql/collate.linux.utf8.sql
+++ b/src/test/regress/sql/collate.linux.utf8.sql
@@ -6,7 +6,7 @@
 
 SELECT getdatabaseencoding() <> 'UTF8' OR
        (SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR
-       version() !~ 'linux-gnu'
+       version() !~ '-linux[-,]'
        AS skip_test \gset
 \if :skip_test
 \quit
diff --git a/src/test/regress/sql/infinite_recurse.sql b/src/test/regress/sql/infinite_recurse.sql
index 151dba4a7ae..b60a0599d03 100644
--- a/src/test/regress/sql/infinite_recurse.sql
+++ b/src/test/regress/sql/infinite_recurse.sql
@@ -13,7 +13,7 @@ create function infinite_recurse() returns int as
 -- (We still create the function, so as not to have a cross-platform
 -- difference in the end state of the regression database.)
 
-SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
+SELECT version() ~ 'powerpc64[^,]*-linux'
        AS skip_test \gset
 \if :skip_test
 \quit
-- 
2.43.0

