From nobody Tue Feb 10 14:29:29 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 4f9P8V2bhnz6RPWY for ; Tue, 10 Feb 2026 14:29:30 +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 4f9P8T5Y5sz3stM for ; Tue, 10 Feb 2026 14:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770733769; 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=gvZDA5u7si3JAmeA6YNOog5V/o4k32jaIdr8GBreYuI=; b=xYjp7Tjym6m6Y06j6jkFF0rRWv8oMhAcau2QR/W4xpdw7yk5RhOWO3ci+HnCoMk8TBvBnj uv5zbr7TlLVJtqOPOiRQMbkIFxFZqgf/4SkuUXFIyIoY4G637OuJoNYHDqkOIdNzgDChhI BV4Fh9HKfczANGPtY6xV3yrDgUfjVqWen1BH210K4tScBR5PLilD0NDELcZgxD/ICcB7pY CjmflT/vNxaVLFWFgDgvvLxis0tR6G2nXWbezfgc6vhM0iNB/dIpPAahHau1FqDVWe7EBO 9ZMi78nRsXWy8jD7JHyxebONYNN0kbT5KxJ8sxxn9vZxeS4Mn+/nmVSCjF789Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770733769; a=rsa-sha256; cv=none; b=ez9XufXHUxjrtceVNsYW8ND77P3T+mESmQJez3rPkvLZ6awJsYavbXsVOViyJ/4nYyl0qO UCRgoRogIbUDTR/56xnr7qHSzpn10bVJ6deK1PjIEHM4fUWNQXwB6NJF4sedbblHDggD6b e1bI9ACrNiyvmmCKlrfHo6JesYbHHJhAgKhAJH0zsGbhmBWp9bZx06Tf8ipIUeCNE66LbT SSbXJho8lG6sXfJ/qf34BM07+mpbh18HpVItejNqu9cG+f1r0vaP4XIX+r/r/DN7HfweJ4 9cbVt/5tMjn+6KvE3gcdu3+QhhgLkfj4v6nNYHuDMQMUhjZ84k0s91g4IP8mZA== 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=1770733769; 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=gvZDA5u7si3JAmeA6YNOog5V/o4k32jaIdr8GBreYuI=; b=uDR1hSMeRkgXlS/CkUvVaHagxZgMVBvgcLSECqlB3MeFqk4/UPsqaxbeI0MiSeuIntdu6a vn5A1unbYS+IxJPKHNfsTtNy0bj5XiabA/7KkABCxpWp6FKGz2A8rOuc2oL7cqu+i/Qkyq zVUzAk9Naf3FRWvbNFZZTjkK+hoEm6wlC8kWLqsFXy9N6VOj0DK1XYbS2V1XRfp8IUoBOF ntLtkvIYcViG1/qXUWaUDdO+EIFIVlhEW8g4mfJwJVMql4gWRKSqXguF9K3UZZcRer0ZJj wzhoOStyuZZX+0x+rZiFEb1w5/rSU0QUcjPEJUOr39eRxfRp5rj6yjp8521KPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f9P8T4xcrz1LsQ for ; Tue, 10 Feb 2026 14:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fe94 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Feb 2026 14:29:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 36ec2b1c104f - main - 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/main X-Git-Reftype: branch X-Git-Commit: 36ec2b1c104f9e5383a160e21109e1308fce0364 Auto-Submitted: auto-generated Date: Tue, 10 Feb 2026 14:29:29 +0000 Message-Id: <698b40c9.3fe94.79612a37@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=36ec2b1c104f9e5383a160e21109e1308fce0364 commit 36ec2b1c104f9e5383a160e21109e1308fce0364 Author: Dag-Erling Smørgrav AuthorDate: 2026-02-10 14:29:08 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-02-10 14:29:08 +0000 pwd: Add tests MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55153 --- 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 f6065e1d5b9f..cda245fadc94 100644 --- a/bin/pwd/Makefile +++ b/bin/pwd/Makefile @@ -1,4 +1,8 @@ -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 97b3bdefe8d4..1895877c82eb 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -49,6 +49,8 @@ .. pwait .. + pwd + .. rm .. rmdir