From 021042e28f45cac2e4bb8da6786ca094bf289a3e Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 21 Jan 2024 13:14:15 +0900
Subject: [PATCH 0290/1160] test: check pam warning message

(cherry picked from commit 88b8d0827691a6c9643c6bd06e73f4ab86dba578)
---
 src/shared/pam-util.c | 1 +
 test/units/end.sh     | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/shared/pam-util.c b/src/shared/pam-util.c
index 46a2915638..f5814ef700 100644
--- a/src/shared/pam-util.c
+++ b/src/shared/pam-util.c
@@ -95,6 +95,7 @@ static void pam_bus_data_destroy(pam_handle_t *handle, void *data, int error_sta
         PamBusData *d = data;
         if (FLAGS_SET(error_status, PAM_DATA_SILENT) &&
             d->bus && bus_origin_changed(d->bus))
+                /* Please adjust test/units/end.sh when updating the log message. */
                 pam_syslog(handle, LOG_DEBUG, "Attempted to close sd-bus after fork whose connection is opened before the fork, this should not happen.");
 
         pam_bus_data_free(data);
diff --git a/test/units/end.sh b/test/units/end.sh
index dd50654f8d..230b716e2f 100755
--- a/test/units/end.sh
+++ b/test/units/end.sh
@@ -6,5 +6,8 @@ set -o pipefail
 
 (! journalctl -q -o short-monotonic --grep "didn't pass validation" >>/failed)
 
+# Here, the redundant '[.]' at the end is for making not the logged self command hit the grep.
+(! journalctl -q -o short-monotonic --grep 'Attempted to close sd-bus after fork whose connection is opened before the fork, this should not happen[.]' >>/failed)
+
 systemctl poweroff --no-block
 exit 0
-- 
2.33.0