Skip to content

Commit

Permalink
savecore: add a test for LOG_PERROR
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Rochoy <[email protected]>
  • Loading branch information
stephane-rochoy-stormshield committed Jan 21, 2025
1 parent 3d688bd commit e4eb4d1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sbin/savecore/tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ATF_TESTS_SH= livedump_test
ATF_TESTS_SH= livedump_test log_test

.include <bsd.test.mk>
25 changes: 25 additions & 0 deletions sbin/savecore/tests/log_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2025 Stéphane Rochoy <[email protected]>
#

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
}

0 comments on commit e4eb4d1

Please sign in to comment.