19647bf24SKyle Evans# 29647bf24SKyle Evans# Copyright (c) 2024 Kyle Evans <kevans@FreeBSD.org> 39647bf24SKyle Evans# 49647bf24SKyle Evans# SPDX-License-Identifier: BSD-2-Clause 59647bf24SKyle Evans# 69647bf24SKyle Evans 79647bf24SKyle Evansatf_test_case basic 89647bf24SKyle Evansbasic_body() 99647bf24SKyle Evans{ 109647bf24SKyle Evans 11*1a2a0db0SKyle Evans if ! dmesg >/dev/null 2>&1; then 12*1a2a0db0SKyle Evans atf_skip "No dmesg(8) access" 13*1a2a0db0SKyle Evans fi 14*1a2a0db0SKyle Evans 159647bf24SKyle Evans # SIGABRT carefully chosen to avoid issues when run under Kyua. No 169647bf24SKyle Evans # matter the value of the global kern.logsigexit, these should force 179647bf24SKyle Evans # the messages as appropriate and we'll all be happy. 189647bf24SKyle Evans proccontrol -m logsigexit -s enable \ 199647bf24SKyle Evans sh -c 'echo $$ > enabled.out; kill -ABRT $$' 209647bf24SKyle Evans proccontrol -m logsigexit -s disable \ 219647bf24SKyle Evans sh -c 'echo $$ > disabled.out; kill -ABRT $$' 229647bf24SKyle Evans 239647bf24SKyle Evans atf_check test -s enabled.out 249647bf24SKyle Evans atf_check test -s disabled.out 259647bf24SKyle Evans 269647bf24SKyle Evans read enpid < enabled.out 279647bf24SKyle Evans read dispid < disabled.out 289647bf24SKyle Evans 29*1a2a0db0SKyle Evans atf_check -o save:dmesg.out dmesg 30*1a2a0db0SKyle Evans atf_check grep -Eq "$enpid.+exited on signal" dmesg.out 31*1a2a0db0SKyle Evans atf_check -s not-exit:0 grep -Eq "$dispid.+exited on signal" dmesg.out 329647bf24SKyle Evans} 339647bf24SKyle Evans 349647bf24SKyle Evansatf_init_test_cases() 359647bf24SKyle Evans{ 369647bf24SKyle Evans atf_add_test_case basic 379647bf24SKyle Evans} 38