mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
hastd: Add rudimentary tests
Test that we can start and stop hastd with an empty configuration. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D59345
This commit is contained in:
1 parent
7dfadd78ba
commit
4ec3ca55f9
4 files changed
+45
No files matched your search
@@ -495,6 +495,8 @@
|
||||
..
|
||||
growfs
|
||||
..
|
||||
hastd
|
||||
..
|
||||
ifconfig
|
||||
..
|
||||
ipfw
|
||||
|
||||
@@ -35,4 +35,7 @@ YFLAGS+=-v
|
||||
|
||||
CLEANFILES=y.tab.c y.tab.h y.output
|
||||
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}= tests
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -0,0 +1,4 @@
|
||||
PACKAGE= tests
|
||||
ATF_TESTS_SH= hastd_test
|
||||
|
||||
.include <bsd.test.mk>
|
||||
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Copyright (c) 2026 Dag-Erling Smørgrav
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
atf_test_case ctl cleanup
|
||||
ctl_head()
|
||||
{
|
||||
atf_set descr "Test that hastd can start, stop, and "\
|
||||
"communicate with hastctl"
|
||||
atf_set require.user "root"
|
||||
}
|
||||
ctl_body()
|
||||
{
|
||||
cat >hast.conf <<EOF
|
||||
control $PWD/hastctl
|
||||
pidfile $PWD/hastd.pid
|
||||
listen $PWD/hastd.sock
|
||||
EOF
|
||||
atf_check hastd -c $PWD/hast.conf
|
||||
atf_check -o ignore hastctl status -c $PWD/hast.conf
|
||||
atf_check -o ignore hastctl stop -c $PWD/hast.conf
|
||||
rm -f hastd.pid
|
||||
}
|
||||
ctl_cleanup()
|
||||
{
|
||||
if [ -s hastd.pid ]; then
|
||||
kill -9 "$(cat hastd.pid)" || true
|
||||
fi
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case ctl
|
||||
}
|
||||
Reference in new issue
Block a user