From nobody Sun Feb 15 08:58:45 2026 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 4fDKZY754Hz6SGr0 for ; Sun, 15 Feb 2026 08:58:45 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fDKZY5TQlz46bk for ; Sun, 15 Feb 2026 08:58:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771145925; 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=16cb+kmzKKht8nGI9VwkoIwYXjnR3hieRQzLnef5TCU=; b=gjGh7WlX15iNEz93E9jfLclon+k1gaRL4NWORrw2y+1TKefns6yNNQqxZ+rTwG2IY3bJ5y 3ESLnYbvd9fu/LfUonsS8dMJpxVHoaWqEum/lSK+zRROarSc3BEvMFwaEHobM/WogkBX9g HIlkuEwBOEayS0Dr6SRIZRmyTwb+g2G88Rx2EM6bgU/RW5HbTyKVZpwdOXpvc5L2XZXfZS piVOTZcZfw3mqE1GuGi8qgSNIInoAF+6JCCeqhoihMz1slqS9jyuZ6QplShj9Iu9UVJYPV 5rhAVGv6mY2rLaqEjnYI1ZflmQXCElxyfkGUb61B3DgcGfhepYYGd/ZVGJXMjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771145925; a=rsa-sha256; cv=none; b=UF9n7pYwkVbN0/fVqE3y6RJZh0RkSBlfYFZNvUGw9m9/rNpXgr4EqSytsnbGkV4dbZyfZK 6eRNVw+nJPxW4gAZKt8l3jUAGZgSlpK57IHWbqg9RY25OPC4NOxu4MHYafhvO5PYnyrcFL 6yr8cSWz6y2YHNM3Nv4R0HwO0WoFYococ22Xe5Zhp3VOgxEOwX4oLs7lwkV7yCWBx5U/aX 3OOk7jkSO44lO25skr85BammDreeYwWT9vEbbr/5DtosSMvSl8JSXUS2IKmE/2VaSR2f+Z QLk8wxGl598yHxXVnnkYmrLMPkBXsBIvcHB5/6lRSwFug5tiQWeA83kCqUDtwA== 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=1771145925; 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=16cb+kmzKKht8nGI9VwkoIwYXjnR3hieRQzLnef5TCU=; b=GfnV3LktOoSeaV8+ETjoXU9wPBuHs/G5+8JJkNNXrbQZd7tlMq0VsQtYrgsDPb9RBZdtfo nPJgODGGFPpF5HfWx+k41Uj2+l4vOvnAg1aGSyT7jDoeTrXboqXNFzX9enOWk8nyfM+pK5 39TMAcZXxq3ps3sV86WUM3Er4FC+LtC3fkkmMsu/LmWai+/ie7JLV39xC+Y0V03GXN1TvD Vu0JpYNcJOBQmtRGhOKJqlKgkAxX3FUhObrxgpGGUhGVZqy8MUQr6RZTaNLpThtS65IaHZ 2kmeChUIgvbixvs6v+um3oljznIGYdne9zJ03jq805RVZ9V+63lkzR7mt0o/Dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fDKZY4w2czmKy for ; Sun, 15 Feb 2026 08:58:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e0b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Feb 2026 08:58:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 11a22ea28ecf - stable/14 - pwd: Add tests 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 11a22ea28ecf942c20db092ce99de34f2121f44a Auto-Submitted: auto-generated Date: Sun, 15 Feb 2026 08:58:45 +0000 Message-Id: <69918ac5.1e0b1.12456846@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=11a22ea28ecf942c20db092ce99de34f2121f44a commit 11a22ea28ecf942c20db092ce99de34f2121f44a Author: Dag-Erling Smørgrav AuthorDate: 2026-02-10 14:29:08 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-02-15 08:58:34 +0000 pwd: Add tests MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55153 (cherry picked from commit 36ec2b1c104f9e5383a160e21109e1308fce0364) --- bin/pwd/Makefile | 8 ++++-- bin/pwd/tests/Makefile | 4 +++ bin/pwd/tests/pwd_test.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++ etc/mtree/BSD.tests.dist | 2 ++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/bin/pwd/Makefile b/bin/pwd/Makefile index 51e9c177c4f6..a46b52b9199a 100644 --- a/bin/pwd/Makefile +++ b/bin/pwd/Makefile @@ -1,6 +1,10 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 -PACKAGE=runtime -PROG= pwd +.include + +PACKAGE= runtime +PROG= pwd +HAS_TESTS= +SUBDIR.${MK_TESTS}= tests .include diff --git a/bin/pwd/tests/Makefile b/bin/pwd/tests/Makefile new file mode 100644 index 000000000000..8ce05fc4ae6f --- /dev/null +++ b/bin/pwd/tests/Makefile @@ -0,0 +1,4 @@ +PACKAGE= tests +ATF_TESTS_SH= pwd_test + +.include diff --git a/bin/pwd/tests/pwd_test.sh b/bin/pwd/tests/pwd_test.sh new file mode 100644 index 000000000000..e418e56a89fa --- /dev/null +++ b/bin/pwd/tests/pwd_test.sh @@ -0,0 +1,73 @@ +# +# Copyright (c) 2026 Dag-Erling Smørgrav +# +# SPDX-License-Identifier: BSD-2-Clause +# + +atf_test_case logical +logical_head() +{ + atf_set "descr" "Cases where pwd prints the " \ + "logical working directory" +} +logical_body() +{ + root=$(realpath $PWD) + atf_check mkdir -p phy/baz + atf_check ln -s phy log + cd log/baz + + # explicitly request logical + export PWD="$root/log/baz" + atf_check -o inline:"$root/log/baz\n" pwd -L + atf_check -o inline:"$root/log/baz\n" pwd -P -L + + # logical is also the default + export PWD="$root/log/baz" + atf_check -o inline:"$root/log/baz\n" pwd +} + +atf_test_case physical +physical_head() +{ + atf_set "descr" "Cases where pwd prints the " \ + "physical working directory" +} +physical_body() +{ + root=$(realpath $PWD) + atf_check mkdir -p phy/baz + atf_check ln -s phy log + cd log/baz + + # explicitly request physical + export PWD="$root/log/baz" + atf_check -o inline:"$root/phy/baz\n" pwd -P + atf_check -o inline:"$root/phy/baz\n" pwd -L -P + + # request logical but $PWD is relative + export PWD="log/baz" + atf_check -o inline:"$root/phy/baz\n" pwd -L + + # request logical but $PWD contains dot + export PWD="$root/log/./baz" + atf_check -o inline:"$root/phy/baz\n" pwd -L + + # request logical but $PWD contains dot-dot + export PWD="$root/log/../log/baz" + atf_check -o inline:"$root/phy/baz\n" pwd -L + + # request logical but $PWD does not exist + export PWD="$root/baz" + atf_check -o inline:"$root/phy/baz\n" pwd -L + + # request logical but $PWD does not match + export PWD="$root/log" + atf_check -o inline:"$root/phy/baz\n" pwd -L +} + +atf_init_test_cases() +{ + atf_add_test_case logical + atf_add_test_case physical +} diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 214d6f6162cb..eed5db1c806f 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -37,6 +37,8 @@ .. pwait .. + pwd + .. rm .. rmdir