From nobody Sun May 07 18:00:00 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 4QDsdX6qJvz49J8b; Sun, 7 May 2023 18:00:00 +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 4QDsdX4SmBz49RY; Sun, 7 May 2023 18:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683482400; 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=UcIu1+NuhPVGGWGPA3pGAcdKdO5IqaNsgf5p9km5OFM=; b=Q7pZvI2pz4j+2+lhXy/vG4AuV4HwCA7HBSiM7eAe0RIR1E8VODDdfH17UmhAuwwdOH/X3S 8cDnuq0oX+01lvU4itwsM+lf+6vYVCyugs7GlqHURWwN2a/8IRS0h9mGBG1Br2n98Zejhh cIKjB/hl2SfKf+IoFcdq1q9pLkZfjOf/rxNWm2kqwtMsPbpF1A33OPwzJgMHlGVkzSUy5h 18CTj94Mj8dXbRmBRq/v8cz2YdKDk5t2rPuLaSpw7wIec/pulmYy2n9aXVwJaZMEVd6m88 WGQOdeFQFnroNzfI2JYR7MLEIOBuqi3Kg+iXlBpKeAXVH4ez78zpmXs40B22UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683482400; 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=UcIu1+NuhPVGGWGPA3pGAcdKdO5IqaNsgf5p9km5OFM=; b=jomU/lUqPYz3vt1aAqMVkF3bRL4nuogqUMj+4NyCTOWIbSqmboyxkrTs4IPrZQiRgqKZr1 MBz/vFESEHsbYz93/nSZ5tVLfHucu+HAGhUhVBtnO28RiYxfF+XKg9sLrGxhfO20Np0T36 J9LKdm7vU74wQL96Ue5+mIEKjdThNPTX2G+Y6ZDf8g3WjEZSNLmekcLgKIObx0PpfR+oEh A+XiKZhusI/jHkxxEZfk53GON8Mwr6Kk1nq+EXe+o02jj55H0RKfdTSE3lQ7ERYTKeNJMX dPn9AEgJuMqhh2FdMdVdVWcQhOg+Eu7N2Z1xrWhjvibT1SLjunj2IfefFR5E8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683482400; a=rsa-sha256; cv=none; b=bkqG54hQBNuMpHWmCEBS0MVj+qFwWfSzaejS38Ac7AF0r4jukupyBqcB5u4MsdGNQpUsKw 77r/gRY1utbxr9ZecdJD+RANz5V6yvJvMef/CSo9m6UtgXwsmbpMqhQOIcrSdCigwHzGku gA7dCdwcUYte11OZCYE5tIUTCds6eRttIs6/s5L9i2FWGPRcJP8/1hXdvHYZagiGBvPhcT sGLKkcUBlvNzMGVaqL43PEkk8fTqaj1xbHpvc/ivxXgjCFevzXCd8BhIsMAuOtwO5JqfX6 AsMIkBheTMY/jdHfgz9LHX4dhWpj93MXLv116ynSu1JAdG+9ELaPVg0t/bfTBw== 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 4QDsdX3YqgzShK; Sun, 7 May 2023 18:00:00 +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 347I00g1008785; Sun, 7 May 2023 18:00:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 347I00dS008763; Sun, 7 May 2023 18:00:00 GMT (envelope-from git) Date: Sun, 7 May 2023 18:00:00 GMT Message-Id: <202305071800.347I00dS008763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a9732ce7b904 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a9732ce7b904f5f52fce4bba4a52a2898ca97782 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a9732ce7b904f5f52fce4bba4a52a2898ca97782 commit a9732ce7b904f5f52fce4bba4a52a2898ca97782 Author: Mark Johnston AuthorDate: 2023-04-25 13:54:23 +0000 Commit: Mark Johnston CommitDate: 2023-05-07 17:54:09 +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 (cherry picked from commit 8a271827e7b5d5310e06df1f9f49ba0ef9efd263) --- 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); } /*