From nobody Sat Dec 14 05:18:54 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y9DyR2YkSz5ghy3; Sat, 14 Dec 2024 05:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y9DyR0zJtz42wF; Sat, 14 Dec 2024 05:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734153535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E3bwVCEqMg4yjb3x5jys/HuGuLF/tJXgwQvbXkRvrjo=; b=uVJ2O5MGTjvTXafh5ZffKzuEbZMjRLVcXysI7fHYAHnefAzEdbKr78c8ez/Amzx/2tFwiw o4ximNtnIe9rVgctP6vTJPWJXctYwzMbNtSj/5rvzZpNCNsyrHC4cRYFI/kRJJX9PXZr5n ZL+anktPt8gHeazfbFDDfarHJrp0hLj2TC6x3sHjTYp7ZbCVuoj9E0fqCl9tPq9TPG714J jRXiQxGA+c/C4Sw86PL03GtHN//Rne/IxWlfPMfedXLiJ05s6iATy9ePxVHS4wgU3jDWuF LaNSwE+kC23Il6narztP1YrHeiCx86oILFy/dTrH49JcGiwKYJxCWobtpbRGBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734153535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E3bwVCEqMg4yjb3x5jys/HuGuLF/tJXgwQvbXkRvrjo=; b=l1afR4sClhbRa/kWCMaH3ZVTEh0BDS2OBe3dhK+4eYpazBA90GfgQeqcV6yJucG/v5shuV h6VBdv5q3YAvXqwMZ5Y9pHJa5XUAjENU+b9sYE3B1LK7m5SeRlJzBU4cYSB8IdhzCJswPB c9qb76X1prrTmoyVJCTOLbuosCRFGdYiXhncXUaNv2EOFdG8UJW5UKdYyT8tramTOnfGGd zlKzgrluImq8/z8Ce37LQiVxDEGw5J9SbQBIv2V34RyaOAfc0VYxnNUxDPFF/v2Mnmj60J 4jKSEdbFLSsjknggrnOmi+FQm8/2rZ1L5SUCANQ6X8Vo0/Cg38ifBnrUwYFfTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734153535; a=rsa-sha256; cv=none; b=kJEMaFYQXY9SiwvfFsNljeWco0zY90Vs2nNPLqR8eFik/3F1uMrjnFxXmwp78GqijVNLFx z7ejs9W4D8RAHAJd2ePrxLIbkkED8d4fYgQbDcIbgkeA1/kmVYOLs5RlQstEMCyoiefAiE 2wcCtk7KLZTy32gysJS1WZtEgFKaWhkeHmpavPjN+6bCvstMcSDoupO0w7X1dojh3btcR9 YXEPKGWPnFOhBWPenBd6UnsJs0lZHQe84kQeanCp6+hhKimeYm9N9XJ3c4GpvBylvVmZfw feLIBAZcyFwL2LSGbUi2lLc0JxEwsiUlOjLqJrezzwjZgfPWDiVhzQxRMpgKXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y9DyR0FrXz18XN; Sat, 14 Dec 2024 05:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BE5Is14025678; Sat, 14 Dec 2024 05:18:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BE5IsGb025675; Sat, 14 Dec 2024 05:18:54 GMT (envelope-from git) Date: Sat, 14 Dec 2024 05:18:54 GMT Message-Id: <202412140518.4BE5IsGb025675@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 9647bf242362 - main - tests: kern: add some tests for recently added logsigexit List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9647bf242362752f513b2aeac659dd4ee41174f7 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9647bf242362752f513b2aeac659dd4ee41174f7 commit 9647bf242362752f513b2aeac659dd4ee41174f7 Author: Kyle Evans AuthorDate: 2024-12-14 05:17:20 +0000 Commit: Kyle Evans CommitDate: 2024-12-14 05:18:31 +0000 tests: kern: add some tests for recently added logsigexit We don't bother tweaking the sysctl in these tests, we'll just try with it forced both on and off via proccontrol(1). This could be problematic in the face of pid wrapping if we got really unfortunate, but the potential solutions need careful consideration- you probably don't want to assume a certain velocity of messages into syslog, so just checking the last N lines is probably similarly flakey. --- tests/sys/kern/Makefile | 1 + tests/sys/kern/logsigexit_test.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 8785caf4e293..be05f5d01faa 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -58,6 +58,7 @@ ATF_TESTS_C+= sigsys TEST_METADATA.sigsys+= is_exclusive="true" ATF_TESTS_SH+= coredump_phnum_test +ATF_TESTS_SH+= logsigexit_test ATF_TESTS_SH+= sonewconn_overflow TEST_METADATA.sonewconn_overflow+= required_programs="python" TEST_METADATA.sonewconn_overflow+= required_user="root" diff --git a/tests/sys/kern/logsigexit_test.sh b/tests/sys/kern/logsigexit_test.sh new file mode 100644 index 000000000000..c40c033bbefd --- /dev/null +++ b/tests/sys/kern/logsigexit_test.sh @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024 Kyle Evans +# +# SPDX-License-Identifier: BSD-2-Clause +# + +atf_test_case basic +basic_body() +{ + + # SIGABRT carefully chosen to avoid issues when run under Kyua. No + # matter the value of the global kern.logsigexit, these should force + # the messages as appropriate and we'll all be happy. + proccontrol -m logsigexit -s enable \ + sh -c 'echo $$ > enabled.out; kill -ABRT $$' + proccontrol -m logsigexit -s disable \ + sh -c 'echo $$ > disabled.out; kill -ABRT $$' + + atf_check test -s enabled.out + atf_check test -s disabled.out + + read enpid < enabled.out + read dispid < disabled.out + + 1>&2 echo "$enpid" + 1>&2 echo "$dispid" + + atf_check grep -Eq "$enpid.+exited on signal" /var/log/messages + atf_check -s not-exit:0 \ + grep -Eq "$dispid.+exited on signal" /var/log/messages +} + +atf_init_test_cases() +{ + atf_add_test_case basic +}