From nobody Sun Feb 15 08:58:02 2026 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 4fDKYl70gGz6SGvl for ; Sun, 15 Feb 2026 08:58:03 +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 4fDKYl1CCNz46BK for ; Sun, 15 Feb 2026 08:58:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771145883; 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=jEqiSxpE29IeEBdQ4X9GuLSF8zl22Y/3xfvFf01w58k=; b=UkbhgloixalckzVOI2iZrSQfIJCCCAPACc7yVvOG32ZZ3TQnk4XV2RJmwJqxDuf+XeR40z ZYLvdjyTrKwKh60D8PSQnjON7z+/bUJ0S9uYS6t/7276a7ZPNd0EnQikBE6y4HcMp4EbHO bkm6ZqpB5HCAzg6NaEya/tF7rtrxmvvdklOrnDJe5Y1l5iF8g/xMf8hdtcFt/WRfZn9jhY bIw5J0AASGxxwrVBH4Zk5/akjdDJJfPhFg+iOTsbNnXLkXzrqA5wIVMFNYTKrwDm5IrglX gwrPsjb0WP00ObmZi4KWZliYa+727ccm1TUBkVlaxVN0ssaixc6EN6B6sTuLjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771145883; a=rsa-sha256; cv=none; b=D57Qrh6IgBLSbohNFUjr0hZ7ZGSIMY4TcGFv7wpqWyCUbYB0ht8uNIUNSedRZW7ndvTS2z JSmGXxq8kGntVH5zGcIs22HgF5520kMmxFw6JcdosQgobUaunmLgFksyD/gjNqinvzQPsq gD/foTjpx0RESaHNxTD0pDyYz4jIOgW44Fox3qDIDHmsUuQHreZfyjCO7PSGi9lFIRA0UC SXyUHtgYnQczwMsjmzG9ivtPYvqw9NZsY+3TQ/n/LCHbl1Hk8IUi4cNjyH1u1EKmg1OkH6 4VkVge9nqD0vLKOVl+uu+2pQVT2w3934pQdtMqrXtB0LE/FtjkSUmwrQQSoy4Q== 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=1771145883; 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=jEqiSxpE29IeEBdQ4X9GuLSF8zl22Y/3xfvFf01w58k=; b=uPD0GIOClQFBLZ4/sr8WMlezHbjkERd+rGu4bNDpD0Pfhb/PC3HlOB/5VJRv4f+N9zgUMT gofpxsHjZfPCAnTCVfuC2426MLMpx1uwPEZaQ4TKona+smFp68S1QziJJf9weIcoP9r3n8 S5H73D1jXXoIpKLXWaWRhRM1+vMd2ziXdFlaX41SjxDctt8VDLTqLlm+CL5fbTgNJ7PKNE D+HV7G4kbDpq+/JjfkjeFLPi4raut3jP8Ma9ZOqVLzRsNrZ/u3uIGP1GfCGocmihWNXtMv NCSzPn20FMPEJJvNQBpy2cZc+3bMmuN9Ux07Mup1vC2p/Ol/KznztMP/IrwnnQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fDKYl05f9zmKq for ; Sun, 15 Feb 2026 08:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c2cf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Feb 2026 08:58:02 +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: 36fa67513b33 - stable/15 - pwd: Add tests 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 36fa67513b3385d912754c4cf92f6fb55e3ee62a Auto-Submitted: auto-generated Date: Sun, 15 Feb 2026 08:58:02 +0000 Message-Id: <69918a9a.1c2cf.22a7f7d6@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=36fa67513b3385d912754c4cf92f6fb55e3ee62a commit 36fa67513b3385d912754c4cf92f6fb55e3ee62a Author: Dag-Erling Smørgrav AuthorDate: 2026-02-10 14:29:08 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-02-15 08:57:46 +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 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 89f98f5d9a29..84534aaaf180 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -49,6 +49,8 @@ .. pwait .. + pwd + .. rm .. rmdir