From owner-dev-commits-src-branches@freebsd.org Tue Sep 7 13:36:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BAAB6649F0; Tue, 7 Sep 2021 13:36:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3mWV20b4z3vSt; Tue, 7 Sep 2021 13:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 23FC713618; Tue, 7 Sep 2021 13:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187DaMot007992; Tue, 7 Sep 2021 13:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaMJD007991; Tue, 7 Sep 2021 13:36:22 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:22 GMT Message-Id: <202109071336.187DaMJD007991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9c82ba247373 - stable/13 - mdconfig: Add a regression test for mediasize rounding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c82ba247373069be477268ddf785797994eeb1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9c82ba247373069be477268ddf785797994eeb1e commit 9c82ba247373069be477268ddf785797994eeb1e Author: Mark Johnston AuthorDate: 2021-08-31 19:50:09 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:18 +0000 mdconfig: Add a regression test for mediasize rounding Sponsored by: The FreeBSD Foundation (cherry picked from commit ed59446b47095fc20c1f77e832286f5b953cd289) --- sbin/mdconfig/tests/mdconfig_test.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sbin/mdconfig/tests/mdconfig_test.sh b/sbin/mdconfig/tests/mdconfig_test.sh index 92ba0342447c..c3a5f85e341b 100755 --- a/sbin/mdconfig/tests/mdconfig_test.sh +++ b/sbin/mdconfig/tests/mdconfig_test.sh @@ -267,6 +267,36 @@ attach_with_specific_unit_number_cleanup() cleanup_common } +atf_test_case attach_size_rounddown cleanup +attach_size_rounddown() +{ + atf_set "descr" "Verify that md provider sizes are a multiple of the sector size" +} +attach_size_rounddown_body() +{ + local md + local ss=8192 + local ms=$(($ss + 4096)) + local ms2=$((2 * $ss + 4096)) + + # Use a sector size that's a likely multiple of PAGE_SIZE, as md(4) + # expects that for swap MDs. + atf_check -s exit:0 -o save:mdconfig.out -e empty \ + -x "mdconfig -a -t swap -S $ss -s ${ms}b" + md=$(cat mdconfig.out) + # 12288 bytes should be rounded down to one sector. + check_diskinfo "$md" 8192 1 $ss + + # Resize and verify that the new size was also rounded down. + atf_check -s exit:0 -o empty -e empty \ + -x "mdconfig -r -u ${md#md} -s ${ms2}b" + check_diskinfo "$md" 16384 2 $ss +} +attach_size_rounddown() +{ + cleanup_common +} + atf_init_test_cases() { atf_add_test_case attach_vnode_non_explicit_type @@ -277,4 +307,5 @@ atf_init_test_cases() atf_add_test_case attach_malloc atf_add_test_case attach_swap atf_add_test_case attach_with_specific_unit_number + atf_add_test_case attach_size_rounddown }