1# 2# Copyright (c) 2026 Dag-Erling Smørgrav 3# 4# SPDX-License-Identifier: BSD-2-Clause 5# 6 7atf_test_case ctl cleanup 8ctl_head() 9{ 10 atf_set descr "Test that hastd can start, stop, and "\ 11 "communicate with hastctl" 12 atf_set require.user "root" 13} 14ctl_body() 15{ 16 cat >hast.conf <<EOF 17control $PWD/hastctl 18pidfile $PWD/hastd.pid 19listen $PWD/hastd.sock 20EOF 21 atf_check hastd -c $PWD/hast.conf 22 atf_check -o ignore hastctl status -c $PWD/hast.conf 23 atf_check -o ignore hastctl stop -c $PWD/hast.conf 24 rm -f hastd.pid 25} 26ctl_cleanup() 27{ 28 if [ -s hastd.pid ]; then 29 kill -9 "$(cat hastd.pid)" || true 30 fi 31} 32 33atf_init_test_cases() 34{ 35 atf_add_test_case ctl 36} 37