From nobody Sun Feb 23 10:49:24 2025 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 4Z10x04RyMz5pyn1; Sun, 23 Feb 2025 10:49:24 +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 4Z10x02bbXz3fdf; Sun, 23 Feb 2025 10:49:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740307764; 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=5viaRHPlJgl1AJUzjtadGaeAGWSzrS6RaR+BS0a5t30=; b=b0ySzlXIxm69/MJ82zcLB2s7BUPOTNZkmHfASVoJG8H3kZmAdyrQs9eRWIqTej2Iygm8yC HhBHv3OqhUbfQLbNTc6AzWBSneOvDeNl/vpRhzEzHTzPrv4rWzdefkNDyItXB8XodNi4+h qz1R3D5VKr+EG5r4nd9tIpUjOKhjq7FSa5eFqOcw29MlfYrA8yzC72mKfxsqW0eZL8QySB gJ05RJy6QMlZARwaB0/7+T4qhO6vNPO3wr/rHhIoybuhlVD0OBxJPoDi9tt4QgBEkeASfI U/BdW2S4BnS8hm6I9bAu+UQ/hfmlg+L0MQfq6CSF/qRWJXXslhwUIBHyUq/38Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740307764; a=rsa-sha256; cv=none; b=oTNQh43dvGEXGLbuLSrrv6SPh5xQRXAG/4K18UIdt+3p7DAs4bW92QJskc1+0AdexQ9VEv F8rc0Go2f025eYZFUMdTRP2hqP0B8Qp+ovaFMqBAjGPSPXcbDbXi/5nb8JMi2ZN/EVF5Kv mwxeie7th+dB7yBmVJztpU/V+850jJOt9nlaplO9xTiwKjl4onBNI4s9sybgY5syYgSg5i jfrZEz1VCIXzBM1t/ntlJO5mxV6taqoM4nWmR17qxFHsIQZCrsjTsVdb4xRhL0KIkOLfyR 7qDKwaSas74iIT9j8rWHoxdHwOxW1T/ciSU0XNIdB1kGT7Rpp3hJucNj6zVK1A== 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=1740307764; 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=5viaRHPlJgl1AJUzjtadGaeAGWSzrS6RaR+BS0a5t30=; b=fk45+Th4WBLlCVOpG8uF1gCKdn6QHg7iUddBr8xQztRdh603x/sJR+zPAMF23UtH0yV7FI IsTTb3Rdk9y7rF9SJoQOjTpKmbXSQ9YiiEInWbD+PlyWpBjJH6QhLx0vhQvVtvIOnSq0gc QIh98aeFPC/+KF58Fp60b0f5dI9hk2LIEQkojklellBT40CIKMEUfnGpyThyKSRq2bZcAh UF4HYwvU9ZNO2GSWZjIrpGguIEuWfL0Dbj+FH1oO3lHsPxBnaGZ31ekSSdrssWM4TI4KDi eA7Uu3YgvQ+UoETmx/3JL2asaMTCAc5aRAoHz9RS6VtenC3X5tdomYccXizo+w== 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 4Z10x01h94zrTl; Sun, 23 Feb 2025 10:49:24 +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 51NAnOpx054158; Sun, 23 Feb 2025 10:49:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51NAnOdC054155; Sun, 23 Feb 2025 10:49:24 GMT (envelope-from git) Date: Sun, 23 Feb 2025 10:49:24 GMT Message-Id: <202502231049.51NAnOdC054155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Igor Ostapenko Subject: git: 51a8eb641046 - main - kyua: Pass unprivileged user config prop to ATF using all known names 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: igoro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51a8eb6410461c94c8e0f2b59e3417cfb5d7da75 Auto-Submitted: auto-generated The branch main has been updated by igoro: URL: https://cgit.FreeBSD.org/src/commit/?id=51a8eb6410461c94c8e0f2b59e3417cfb5d7da75 commit 51a8eb6410461c94c8e0f2b59e3417cfb5d7da75 Author: Igor Ostapenko AuthorDate: 2025-02-23 10:41:58 +0000 Commit: Igor Ostapenko CommitDate: 2025-02-23 10:41:58 +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 --- 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 100644 --- 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 <