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
This commit is contained in:
Stéphane Rochoy 2024-12-12 15:11:47 +01:00 committed by Mark Johnston
parent c901e89d8e
commit 3dc18af577
2 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,3 @@
ATF_TESTS_SH= livedump_test
ATF_TESTS_SH= livedump_test log_test
.include <bsd.test.mk>

View file

@ -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
}