From nobody Wed Apr 8 15:36:06 2026 X-Original-To: dev-commits-src-main@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 4frRx25Xc1z6YK5Z for ; Wed, 08 Apr 2026 15:36:06 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4frRx22vFQz44QB for ; Wed, 08 Apr 2026 15:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775662566; 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=hyMfmTtfVrQERNGcKnAfRgm49o6Q+XILxTH2+hvEbGw=; b=BaCxAMDlMm4M9Kgi2tSIymFQKw+g/XPviaaHAF9IWQLjI4fhAzCtIvNv3Owf7Qmv30fbA3 8zvZdOPjJLvvJApNYrLSWoRMaX0+cB81ygOBKYnxFQTPG3dkRNGdgxp+shtzT/cfddRM88 hFOA6OZAQ0fqR27MEHgyUh56JFEF3l7r6WUj58qyfHQO52m0F+JOubALwCeirMxUMGYtwN wiRx1XJD/2sgm5HOFNwVlpX+8n+4zfWKSo3FUS9pMIohUyCLDBBUMZGWWjoFcVhVeQke8B JWEmfgFe1ucSOERxtxUIyhVyiVBj0gDdMyNRTSmBz0+tmfs+f1VnonKRlg+4AA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775662566; a=rsa-sha256; cv=none; b=TO+//kcjQGP+qvd707SEZ2tSD7S/ZmE4B4aS0Yh8LWi6CXnmnr80XDSZGCjneAIyLOSZ1a U5PGMF4VonezTalvSWo1w77/ToqrouSjPA5UoLDUrbsOZTPKvDIWRCKqgIIGWGwrsWxVxR EXJAO3rpp7J7mDF+xGT6e9lYJ2/Oq7itHE3RVSZ8UhVwuiYN1+YBOUBnByduCnrjDtc0Yh 0Zgl5T+WkQ5Md1jQxMJ0ttkKY07oMyFrkMsdb3r0ZsADgzTtFgKGtEWlV9yBZIud10Ncpe TIUEesj+g36w+c5O3Z3P5ygPu2WnfgNrAFhLk14de0AGIKOKZq0re/G5IJqgfw== 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=1775662566; 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=hyMfmTtfVrQERNGcKnAfRgm49o6Q+XILxTH2+hvEbGw=; b=VgQBe9oMtlHlanXp3S9lAlTRrdz4XhtvZYRXD+/doKTyP225AKMGIk7htDOtz/uFxs4FXs vB2zJl0g/+F00QkcitnJI811GAxMDqAn2QgJLVbQ2HjKnJEhXVXQtMxtxrdWNY36CaKPCn pPXXBcMM48ni1Wmx8CCKaKlEBQP3A6lT5CWJJLkAkGFr5LO/oJFl5Toh93y+gAJF3p61eq NtbFFpPGLGl1YfMK8JD686L7xYYDdp75yFppA7KU+X+RFADPEPdZDTmpXtcws5HYKwV+3p qVSyYAQrfmdPlCTBusXV8H5xad/BFNUVYdR/tNcKS67zSSog8BsjNslXy4sx8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4frRx21jzyzY8M for ; Wed, 08 Apr 2026 15:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 431c5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Apr 2026 15:36:06 +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: 8cbd3949297d - main - stat: Nits in stat tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 8cbd3949297d56e3960dcde73bd7e2277ac4bee8 Auto-Submitted: auto-generated Date: Wed, 08 Apr 2026 15:36:06 +0000 Message-Id: <69d675e6.431c5.278a082e@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8cbd3949297d56e3960dcde73bd7e2277ac4bee8 commit 8cbd3949297d56e3960dcde73bd7e2277ac4bee8 Author: Dag-Erling Smørgrav AuthorDate: 2026-04-08 15:35:35 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-04-08 15:35:35 +0000 stat: Nits in stat tests * Use ourselves as test file instead of /COPYRIGHT, which may or may not be present in the test environment. * atf-check understands \n in strings, use it. * Some file systems don't like creating small holes, so create large ones instead. This means we need two variables: ps (page size) is the minimum size of a data region and the alignment for a hole, while hs (hole size) is the minimum size of the holes we create. This makes no difference on FreeBSD but makes it easier to port the test to other platforms. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D56304 --- usr.bin/stat/tests/stat_test.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/usr.bin/stat/tests/stat_test.sh b/usr.bin/stat/tests/stat_test.sh index afe698575034..6043686396be 100755 --- a/usr.bin/stat/tests/stat_test.sh +++ b/usr.bin/stat/tests/stat_test.sh @@ -54,6 +54,7 @@ h_flag_head() } h_flag_body() { + file=$(realpath $0) # POSIX defines a hole as “[a] contiguous region of bytes # within a file, all having the value of zero” and requires # that “all seekable files shall have a virtual hole starting @@ -82,27 +83,27 @@ h_flag_body() atf_check -o inline:"$((ps)) .\n" stat -h . atf_check -o inline:"$((ps)) ." stat -hn . - # For a file, prints a list of holes. + # For a file, prints a list of holes. Some file systems don't + # like creating small holes, so we create large ones instead. + hs=$((16*1024*1024)) atf_check truncate -s 0 foo atf_check -o inline:"0 foo" \ stat -hn foo - atf_check truncate -s "$((ps))" foo - atf_check -o inline:"0-$((ps-1)) foo" \ + atf_check truncate -s "$((hs))" foo + atf_check -o inline:"0-$((hs-1)) foo" \ stat -hn foo - atf_check dd status=none if=/COPYRIGHT of=foo \ - oseek="$((ps))" bs=1 count=1 - atf_check -o inline:"0-$((ps-1)),$((ps+1)) foo" \ + atf_check dd status=none if="${file}" of=foo \ + oseek="$((hs))" bs=1 count=1 + atf_check -o inline:"0-$((hs-1)),$((hs+1)) foo" \ stat -hn foo - atf_check truncate -s "$((ps*3))" foo - atf_check -o inline:"0-$((ps-1)),$((ps*2))-$((ps*3-1)) foo" \ + atf_check truncate -s "$((hs*3))" foo + atf_check -o inline:"0-$((hs-1)),$((hs+ps))-$((hs*3-1)) foo" \ stat -hn foo # Test multiple files. - atf_check dd status=none if=/COPYRIGHT of=bar + atf_check dd status=none if="${file}" of=bar sz=$(stat -f%z bar) - atf_check -o inline:"0-$((ps-1)),$((ps*2))-$((ps*3-1)) foo -$((sz)) bar -" \ + atf_check -o inline:"0-$((hs-1)),$((hs+ps))-$((hs*3-1)) foo\n$((sz)) bar\n" \ stat -h foo bar # For a device, fail.