Whamcloud - gitweb
LU-17310 tests: make m_assume_storage_prezeroed more robust
authorAndreas Dilger <adilger@dilger.ca>
Thu, 23 Nov 2023 02:47:38 +0000 (19:47 -0700)
committerLi Dongyang <dongyangli@ddn.com>
Tue, 14 Jan 2025 04:06:32 +0000 (15:06 +1100)
commit802489a1e5842670211df7f2bd4904e2e2090ebe
treef6d87524fb1b400c9176552d365a1d0f11addc4f
parent879d811dd45b706f545b50e624998a1ab906345e
LU-17310 tests: make m_assume_storage_prezeroed more robust

Don't assume that mke2fs is going to zero out an exact number
of blocks when run with/without "-E assume_storage_prezeroed",
since this depends on a number of different options that are
not specified in the test script.

Instead, check that the number of blocks zeroed in the image is
a small fraction (1/15th) of the number of blocks zeroed when
"-E assume_storage_prezeroed" is not given, which makes it more
robust when running in different environments.  This varies from
1/16 in the original test to 1/91 in my local test environment.

Avoid "losetup --sector-size 4096", use "mke2fs -b 4096" instead.
Clean up the loop device before checking "stat" so that all
blocks are flushed to the backing storage before calling sync.
Only one loop device and test file is needed for the test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Change-Id: I98fc3f5334cb8e2dd754c5d4994f2ca582300c13
Reviewed-on: https://review.whamcloud.com/c/tools/e2fsprogs/+/53217
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
tests/m_assume_storage_prezeroed/expect [deleted file]
tests/m_assume_storage_prezeroed/script