git: 546b910adb88 - stable/14 - savecore: add a test for LOG_PERROR
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 07 Feb 2025 14:47:06 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=546b910adb880934482cbdc1b13c69f5421c52c1
commit 546b910adb880934482cbdc1b13c69f5421c52c1
Author: Stéphane Rochoy <stephane.rochoy@stormshield.eu>
AuthorDate: 2024-12-12 14:11:47 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-02-07 14:46:53 +0000
savecore: add a test for LOG_PERROR
Signed-off-by: Stéphane Rochoy <stephane.rochoy@stormshield.eu>
Reviewed by: markj, oshogbo
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1546
(cherry picked from commit 3dc18af5770f9fc820343021d63dfc4cf09d9906)
---
sbin/savecore/tests/Makefile | 2 +-
sbin/savecore/tests/log_test.sh | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/sbin/savecore/tests/Makefile b/sbin/savecore/tests/Makefile
index b58e79f518ef..81e6b8ce2667 100644
--- a/sbin/savecore/tests/Makefile
+++ b/sbin/savecore/tests/Makefile
@@ -1,3 +1,3 @@
-ATF_TESTS_SH= livedump_test
+ATF_TESTS_SH= livedump_test log_test
.include <bsd.test.mk>
diff --git a/sbin/savecore/tests/log_test.sh b/sbin/savecore/tests/log_test.sh
new file mode 100644
index 000000000000..9b006a2f2644
--- /dev/null
+++ b/sbin/savecore/tests/log_test.sh
@@ -0,0 +1,25 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2025 Stéphane Rochoy <stephane.rochoy@stormshield.eu>
+#
+
+atf_test_case log_perror
+log_perror_head()
+{
+ atf_set "descr" "Test LOG_PERROR behavior"
+}
+log_perror_body()
+{
+ atf_check -s exit:1 \
+ -o ignore \
+ -e save:savecore.err \
+ savecore -vC /dev/missing
+ grep -qE 'savecore [0-9]+ - - /dev/missing: No such file or directory' savecore.err \
+ || atf_fail "missing/invalid error output"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case log_perror
+}