From nobody Tue Apr 25 14:08:26 2023 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 4Q5P3t6Z3Mz47FFZ; Tue, 25 Apr 2023 14:08:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q5P3t5s6tz3GYB; Tue, 25 Apr 2023 14:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682431706; 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=ZmgBCFy4U4fasDGm3BAEqYG2d3VSjY/ztN6yxSsamZA=; b=Jo/UrKSYTu3TbjznSHdZKHUAsvpHK2y81aKoQ0iB9jnMvB1eRLvXlQjaZ7TSDSn/DqpGfT dB5dn14J0+RhZF1tc8999JPwO5InBTwbzEWZ/cb4jPtPQcno6I8GElLidW0R6eyWEr8osx Te6lQmJ/MLQUpEBSWF2DYHDKMWud1fd3Tcs82bPR211UxXYbz+onJ6wMwrNxsqlgXpOjR6 v2F59jRuyGPKcpS/8b9AOFRaKCT3TLjQ4s37wOu4eMTvBdoaTX7MshgCrG2UaTrSvpN/fI nU5inQWWJCa+KLhWZAbb5nw73vISZg3eLjkQNJw9mRyPS0j6UHTXyWBBFo6PAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682431706; 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=ZmgBCFy4U4fasDGm3BAEqYG2d3VSjY/ztN6yxSsamZA=; b=Ti9V7zUaShiIM3B4iXgU4Cb/k5M4flRXS0ElwoTzyyoM1T8p6RtCCGEiUNzTSFqffRJRAg 2PWgn6RedOCRtvnNA87pNJhr4cApZkignppDMLoknJjb8rTZs7I58lb4tOrg6QPbtoOWVw nyds4hX6G+akoX0HF0z8hMrfWhxI8FyGgDsNN77eSt/emM7mkRhqSep5N2kzIjpCmQ8gtY dM1bPiBjI1OnnJFNdlnq3kOBJLYx6T93wSEJkhQjoqUguJHMs1yY9WKpzIGgbsbWHPMmEv UTa4e+k4zFQOVl/6tTr4Wai4ORVyJlkyaPz06GoBzyDsliaFhgDVOtepSSiKwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682431706; a=rsa-sha256; cv=none; b=cA3JrIvVeWu5gjek/osgJ75QLkAjkNhgIeNOlgFj0zhosjDnXQiAvXwtf60V+CQ/+L3kR5 yIU6EJtcPtr4SgwUOeECTealXVBakzjvR29HCH4NKJLTN4lX7/uq+zHH15g1bKH5w3paev qI4qQIoum3UEBlTAAw63hGhh/NeuuxMTpb4IqQ4NxYFuOsc8my9XkYpITAFegG/+rbbjWn j7eVZGTbjO7AfRx63dmpMaysOjNjCx+V/O0cQCmIe39PF73EB5WlNjXha6rwzfX06ggdvp O/CB29QMj9rV0cxG3+X3GeMjUv9niit7En8aLM8AeU9wi7ANDp2uhG8PshZoGg== 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 4Q5P3t4xB4z197q; Tue, 25 Apr 2023 14:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33PE8QTV094365; Tue, 25 Apr 2023 14:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33PE8QE9094364; Tue, 25 Apr 2023 14:08:26 GMT (envelope-from git) Date: Tue, 25 Apr 2023 14:08:26 GMT Message-Id: <202304251408.33PE8QE9094364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8a271827e7b5 - main - tests: Add ATF_REQUIRE_SYSCTL_BOOL 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a271827e7b5d5310e06df1f9f49ba0ef9efd263 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8a271827e7b5d5310e06df1f9f49ba0ef9efd263 commit 8a271827e7b5d5310e06df1f9f49ba0ef9efd263 Author: Mark Johnston AuthorDate: 2023-04-25 13:54:23 +0000 Commit: Mark Johnston CommitDate: 2023-04-25 13:54:23 +0000 tests: Add ATF_REQUIRE_SYSCTL_BOOL Modify a capability mode test to use it for kern.trap_enotcap, to avoid false positives. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/freebsd_test_suite/macros.h | 17 +++++++++++++++-- tests/sys/vfs/lookup_cap_dotdot.c | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/freebsd_test_suite/macros.h b/tests/freebsd_test_suite/macros.h index c5a3a3838ff7..dfce2fb810e1 100644 --- a/tests/freebsd_test_suite/macros.h +++ b/tests/freebsd_test_suite/macros.h @@ -53,6 +53,18 @@ } \ } while(0) +#define ATF_REQUIRE_SYSCTL_BOOL(_mib_name, _required_value) do { \ + bool value; \ + size_t size = sizeof(value); \ + if (sysctlbyname(_mib_name, &value, &size, NULL, 0) == -1) { \ + atf_tc_skip("sysctl for %s failed: %s", _mib_name, \ + strerror(errno)); \ + } \ + if (value != (_required_value)) \ + atf_tc_skip("requires %s=%d, =%d", (_mib_name), \ + (_required_value), value); \ +} while (0) + #define ATF_REQUIRE_SYSCTL_INT(_mib_name, _required_value) do { \ int value; \ size_t size = sizeof(value); \ @@ -60,8 +72,9 @@ atf_tc_skip("sysctl for %s failed: %s", _mib_name, \ strerror(errno)); \ } \ - if (value != _required_value) \ - atf_tc_skip("requires %s=%d", _mib_name, _required_value); \ + if (value != (_required_value)) \ + atf_tc_skip("requires %s=%d, =%d", (_mib_name), \ + (_required_value), value); \ } while(0) #define PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do { \ diff --git a/tests/sys/vfs/lookup_cap_dotdot.c b/tests/sys/vfs/lookup_cap_dotdot.c index dee1e0b11780..e023a50f8152 100644 --- a/tests/sys/vfs/lookup_cap_dotdot.c +++ b/tests/sys/vfs/lookup_cap_dotdot.c @@ -80,7 +80,7 @@ check_capsicum(void) { ATF_REQUIRE_FEATURE("security_capabilities"); ATF_REQUIRE_FEATURE("security_capability_mode"); - ATF_REQUIRE_SYSCTL_INT("kern.trap_enotcap", 0); + ATF_REQUIRE_SYSCTL_BOOL("kern.trap_enotcap", false); } /*