From 271b7a7d59dba6e6230d03b528c1d3807df8cbb0 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: Tue, 5 May 2026 15:09:41 +0200
Subject: [PATCH 3/3] Fix regex searching for page verification failures in
 tests

The test for finding page verification failures in the logfiles
were missing the /m modifier to make sure it anchors to every
newline in the search space buffer, and not just the last one.

Spotted while adding a test for the recently reported issue
with excessive WAL for unlogged relations.

Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAHg+QDeGrpZbNZdLjd_T4b43xKEEXZN0HGhkFm-1bkBdyzK7AQ@mail.gmail.com
---
 .../modules/test_checksums/t/006_pgbench_single.pl   |  6 +++---
 .../modules/test_checksums/t/007_pgbench_standby.pl  | 12 ++++++------
 src/test/modules/test_checksums/t/008_pitr.pl        |  2 +-
 src/test/modules/test_checksums/t/009_fpi.pl         |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/test/modules/test_checksums/t/006_pgbench_single.pl b/src/test/modules/test_checksums/t/006_pgbench_single.pl
index f5ccc1b5b08..b0ccf05fce9 100644
--- a/src/test/modules/test_checksums/t/006_pgbench_single.pl
+++ b/src/test/modules/test_checksums/t/006_pgbench_single.pl
@@ -211,7 +211,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in primary log (during WAL recovery)"
 		);
 		$node_loglocation = -s $node->logfile;
@@ -249,7 +249,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in primary log (outside WAL recovery)"
 		);
 		$node_loglocation = -s $node->logfile;
@@ -276,7 +276,7 @@ my $log =
   PostgreSQL::Test::Utils::slurp_file($node->logfile, $node_loglocation);
 unlike(
 	$log,
-	qr/page verification failed,.+\d$/,
+	qr/page verification failed,.+\d$/m,
 	"no checksum validation errors in primary log");
 $node_loglocation = -s $node->logfile;
 
diff --git a/src/test/modules/test_checksums/t/007_pgbench_standby.pl b/src/test/modules/test_checksums/t/007_pgbench_standby.pl
index 0b3996f1d69..38e17ca38ee 100644
--- a/src/test/modules/test_checksums/t/007_pgbench_standby.pl
+++ b/src/test/modules/test_checksums/t/007_pgbench_standby.pl
@@ -270,7 +270,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_primary_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in primary log (during WAL recovery)"
 		);
 		$node_primary_loglocation = -s $node_primary->logfile;
@@ -299,7 +299,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_standby_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in standby_1 log (during WAL recovery)"
 		);
 		$node_standby_loglocation = -s $node_standby->logfile;
@@ -341,7 +341,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_primary_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in primary log (outside WAL recovery)"
 		);
 		$node_primary_loglocation = -s $node_primary->logfile;
@@ -363,7 +363,7 @@ for (my $i = 0; $i < $TEST_ITERATIONS; $i++)
 			$node_standby_loglocation);
 		unlike(
 			$log,
-			qr/page verification failed,.+\d$/,
+			qr/page verification failed,.+\d$/m,
 			"no checksum validation errors in standby_1 log (outside WAL recovery)"
 		);
 		$node_standby_loglocation = -s $node_standby->logfile;
@@ -394,14 +394,14 @@ my $log = PostgreSQL::Test::Utils::slurp_file($node_primary->logfile,
 	$node_primary_loglocation);
 unlike(
 	$log,
-	qr/page verification failed,.+\d$/,
+	qr/page verification failed,.+\d$/m,
 	"no checksum validation errors in primary log");
 $node_primary_loglocation = -s $node_primary->logfile;
 $log = PostgreSQL::Test::Utils::slurp_file($node_standby->logfile,
 	$node_standby_loglocation);
 unlike(
 	$log,
-	qr/page verification failed,.+\d$/,
+	qr/page verification failed,.+\d$/m,
 	"no checksum validation errors in standby_1 log");
 $node_standby_loglocation = -s $node_standby->logfile;
 
diff --git a/src/test/modules/test_checksums/t/008_pitr.pl b/src/test/modules/test_checksums/t/008_pitr.pl
index 1f8176686fd..913377c9d32 100644
--- a/src/test/modules/test_checksums/t/008_pitr.pl
+++ b/src/test/modules/test_checksums/t/008_pitr.pl
@@ -186,7 +186,7 @@ $node_pitr->stop;
 my $log = PostgreSQL::Test::Utils::slurp_file($node_pitr->logfile, 0);
 unlike(
 	$log,
-	qr/page verification failed,.+\d$/,
+	qr/page verification failed,.+\d$/m,
 	"no checksum validation errors in pitr log");
 
 done_testing();
diff --git a/src/test/modules/test_checksums/t/009_fpi.pl b/src/test/modules/test_checksums/t/009_fpi.pl
index a1cea91f787..1a7dcd0e15d 100644
--- a/src/test/modules/test_checksums/t/009_fpi.pl
+++ b/src/test/modules/test_checksums/t/009_fpi.pl
@@ -58,7 +58,7 @@ $node->stop;
 my $log = PostgreSQL::Test::Utils::slurp_file($node->logfile, 0);
 unlike(
 	$log,
-	qr/page verification failed,.+\d$/,
+	qr/page verification failed,.+\d$/m,
 	"no checksum validation errors in server log");
 
 done_testing();
-- 
2.39.3 (Apple Git-146)

