From nobody Sun Mar 16 10:56:32 2025 X-Original-To: dev-commits-src-branches@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 4ZFw5X50Fmz5qHgf; Sun, 16 Mar 2025 10:56:32 +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 4ZFw5X46DXz3L5B; Sun, 16 Mar 2025 10:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742122592; 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=Tt49/NhH9RgIV1Ixo4j44kamxcecIGbq0FkK3LS9+jY=; b=YyjKx5sK4+QMA8BwNwFZFk4urPh9UxVl/petzrTVAPfOrFuKuhhgihvJa3YTMwNfDEOOjL MUQLqI9ui0i2XjXXEKhgZOQ0I1Y+7lCHipAUwszpA946gjpU6gZ7YqqW+oxJpf6bh2/D3L dMNPV8pbsJcoq40J6rMHg1o7SMNkVdlYWL8JLE1VWbB4PE0T0AgP2xqqVM4530lcsSx3br 0UoPL6aVWh6F33qPG+SMpq3ZcwdQ6Kr56m4PBsV3C4LRWUO9j0rdSzRBhK0rvBz+kvK5RI 8dTEY4n6MTddv2d0iCBAnt2/UUhkiaXBfSDzUwNDeD2/XRkL2JW1d33oHURVew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742122592; a=rsa-sha256; cv=none; b=AIMyBFecjH+VeoLJO6VEfg3lI9FW4GyoP2Hkn1dYd4LqaNJQucQG9mbbIbUdufas23Q3fu qEJRDrIuqKH/ma/wbJnYmo815CC5B0lZBN09PkK04lhbeNi6wf93qAZ8CCGzL2+39QxJfw F7zwTqPICuFrhv1tRDtem95nSLpOtivEgkr+u0qwiK55XlkF13qqOk1Yezp5t76pQF/47z gc2r4KFkO5Bz5reTsqDUHwJfOYDtVwiSmh89lvlU/bg1t1YqUvieV2g0VhTijOSrJqlRdK GwDDN8j6rBGMYSOfz2YLvCF1Rxsdjcab7o/il2kkaKtj1nGeukdfKsHFWeJA9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742122592; 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=Tt49/NhH9RgIV1Ixo4j44kamxcecIGbq0FkK3LS9+jY=; b=l0aV4L6w2yWVmIe3kRUTTTphbXxwpBSjGy/vUjBanyzYl7Ik1aSryzv1Q7S2Anlw/mZXv8 QHGGXtVFWlnHDRsMour+airUlgkGTLxnWDzW9i2ApSkpgl/V2Jn0AnaQjVC9clhBVKhING DSRt+fpcgdy2WTX3AFgJDFpoAtH40bZBRLkpTMazeOmXd4FrG7+vXl3VG2/PcPyvwJNaHR fZkg3ba11jQVdkFAG/QJ07GPKL2OGbRy5PS9wQTlZnj+nXzKGtk+mlGzkn8tXGQo1yrlTd SPntdCPeNrMayoTsfvAAt9xWmGS/+rXk6O6NUBgGHLyrPuYAl/u/oaNZ1hTKkg== 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 4ZFw5X3h3pzxsv; Sun, 16 Mar 2025 10:56:32 +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 52GAuWCA064079; Sun, 16 Mar 2025 10:56:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52GAuW3d064076; Sun, 16 Mar 2025 10:56:32 GMT (envelope-from git) Date: Sun, 16 Mar 2025 10:56:32 GMT Message-Id: <202503161056.52GAuW3d064076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Igor Ostapenko Subject: git: 40a8746a775c - stable/14 - kyua: Pass unprivileged user config prop to ATF using all known names List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: igoro X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 40a8746a775cecbfb0b89536a977dff2391380e7 Auto-Submitted: auto-generated The branch stable/14 has been updated by igoro: URL: https://cgit.FreeBSD.org/src/commit/?id=40a8746a775cecbfb0b89536a977dff2391380e7 commit 40a8746a775cecbfb0b89536a977dff2391380e7 Author: Igor Ostapenko AuthorDate: 2025-02-23 10:41:58 +0000 Commit: Igor Ostapenko CommitDate: 2025-03-16 10:46:22 +0000 kyua: Pass unprivileged user config prop to ATF using all known names Kyua and ATF speak different naming styles. In this case, the unprivileged user property can be named with underscore on the Kyua side, and with a hyphen on the ATF side. Sometimes it is not obvious which style should be used in which situation. For instance, a test case may require this configuration property being set using require.config. Also, a test case may want to read the property using something like atf_tc_get_config_var(). Which names should be used in these cases? From the perspective of the original code, it is expected to be this: require.config unprivileged-user atf_tc_get_config_var(tc, "unprivileged-user") But, as long as Kyua is the main interface, its users expect to work with kyua.conf(5), which says that it must be named as unprivileged_user (with underscore). As a result, test authors tend to do this instead: require.config unprivileged_user atf_tc_get_config_var(tc, "unprivileged_user") Kyua already has hacks to understand both unprivileged_user and unprivileged-user coming from require.config. And this patch covers the missing second part -- make Kyua pass both names back to ATF as two identical configuration properties named different ways. Reviewed by: ngie, asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D49039 (cherry picked from commit 51a8eb6410461c94c8e0f2b59e3417cfb5d7da75) --- contrib/kyua/engine/scheduler.cpp | 3 ++ contrib/kyua/engine/scheduler_test.cpp | 1 + contrib/kyua/integration/cmd_test_test.sh | 43 +++++++++++++++++++++++++++++ contrib/kyua/integration/helpers/config.cpp | 10 +++++-- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/contrib/kyua/engine/scheduler.cpp b/contrib/kyua/engine/scheduler.cpp index e75091a40e38..d4507a247323 100644 --- a/contrib/kyua/engine/scheduler.cpp +++ b/contrib/kyua/engine/scheduler.cpp @@ -1632,7 +1632,10 @@ scheduler::generate_config(const config::tree& user_config, if (user_config.is_set("unprivileged_user")) { const passwd::user& user = user_config.lookup< engine::user_node >("unprivileged_user"); + // The property is duplicated using both ATF and Kyua naming styles + // for better UX. props["unprivileged-user"] = user.name; + props["unprivileged_user"] = user.name; } return props; diff --git a/contrib/kyua/engine/scheduler_test.cpp b/contrib/kyua/engine/scheduler_test.cpp index e144761d8f01..d91c448f2e5e 100644 --- a/contrib/kyua/engine/scheduler_test.cpp +++ b/contrib/kyua/engine/scheduler_test.cpp @@ -1192,6 +1192,7 @@ ATF_TEST_CASE_BODY(generate_config__some_matches) config::properties_map exp_props; exp_props["unprivileged-user"] = "nobody"; + exp_props["unprivileged_user"] = "nobody"; exp_props["var1"] = "value 1"; ATF_REQUIRE_EQ(exp_props, diff --git a/contrib/kyua/integration/cmd_test_test.sh b/contrib/kyua/integration/cmd_test_test.sh index f0862cf29582..4c2fe863a4f5 100755 --- a/contrib/kyua/integration/cmd_test_test.sh +++ b/contrib/kyua/integration/cmd_test_test.sh @@ -596,6 +596,48 @@ EOF } +utils_test_case config_unprivileged_user +config_unprivileged_user_body() { + cat >"my-config" <Kyuafile <