Page MenuHomeFreeBSD

D59345.id185851.diff
No OneTemporary

D59345.id185851.diff

diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -495,6 +495,8 @@
..
growfs
..
+ hastd
+ ..
ifconfig
..
ipfw
diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile
--- a/sbin/hastd/Makefile
+++ b/sbin/hastd/Makefile
@@ -35,4 +35,7 @@
CLEANFILES=y.tab.c y.tab.h y.output
+HAS_TESTS=
+SUBDIR.${MK_TESTS}= tests
+
.include <bsd.prog.mk>
diff --git a/sbin/hastd/tests/Makefile b/sbin/hastd/tests/Makefile
new file mode 100644
--- /dev/null
+++ b/sbin/hastd/tests/Makefile
@@ -0,0 +1,4 @@
+PACKAGE= tests
+ATF_TESTS_SH= hastd_test
+
+.include <bsd.test.mk>
diff --git a/sbin/hastd/tests/hastd_test.sh b/sbin/hastd/tests/hastd_test.sh
new file mode 100644
--- /dev/null
+++ b/sbin/hastd/tests/hastd_test.sh
@@ -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
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 7, 6:08 PM (13 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38377169
Default Alt Text
D59345.id185851.diff (1 KB)

Event Timeline